rt: a render encoder sets the alpha test reference, and alpha-test states are made
A gap against the old runtime. rt refused every render state whose fragment
runs the private alpha test (PrivateRenderState::alpha_test_enabled with a
compare function other than Never or Always): the translator pushes
PushField::AlphaTestReference there, and render.rs draws() mapped no value for
it, so new_render_pipeline_state answered Gap::RenderPipeline { DrawInput }.
Nothing drew against an unfilled push word; Never and Always states, which read
no reference, were made and drew right.
Now RenderCommandEncoder::set_alpha_test_reference_value(f32) (Apple's
setAlphaTestReferenceValue: SPI) keeps the reference's 8-bit unorm code in the
encoder's state, Metal's 1 until set, not kept across encoders (the old
runtime's rule, from probes on an Apple M3 Max, macOS 27.0.1); draws() maps the
field to FieldValue::AlphaTestReference, and a draw pushes the code. A change of
code refills the push bytes; an equal one records nothing new. The code is the
translator's: bind::alpha_test_code, now public (api_surface row, docs/API.md
line), so rt and the binder compare as Metal does through one function.
Test: tests::alpha_test draws green at alpha 0.6 (code 153) under Greater, one
quadrant a draw through scissor rectangles: the default reference and 0.75
keep the clear, 0.25 (held across draws) draws, and a second encoder starts at
1 again (its whole-target draw changes nothing) until 0 draws. README and the
API signature table updated.
Verified: build and device legs follow.
This commit is contained in:
1 parent
e74d7ab714
commit
f6032c796c
12 files changed
+187
-12
No files matched your search
+8
-1
@@ -159,7 +159,14 @@ compile does. `DevicePolicy::default()` is `DevicePolicy::UNTRUSTED`:
|
||||
consumer pushes for it (`PushField::ConstexprSampler`), where the consumer places the device
|
||||
sampler `CombinedSampler::constexpr_sampler` describes, normalized: the shader scales a pixel
|
||||
sampler's coordinate. An integer write to a storage slot without a format saturates to the channel
|
||||
widths the consumer pushes (`PushField::TextureIntegerChannels`). Every precision note is
|
||||
widths the consumer pushes (`PushField::TextureIntegerChannels`). A fragment function under the
|
||||
pipeline's private alpha test (`PrivateRenderState::alpha_test_enabled`, a compare function other
|
||||
than `Never` or `Always`) compares its color 0's alpha with the code the consumer pushes
|
||||
(`PushField::AlphaTestReference`): `bind::alpha_test_code` of the encoder's
|
||||
`setAlphaTestReferenceValue:`, 1 until the encoder sets it. It is Metal's 8-bit unorm code of the
|
||||
reference (a NaN taken as 0, clamped to `[0, 1]`, the exact product with 255 rounded to
|
||||
nearest), the form the function converts its alpha to, so a consumer that pushes it compares as
|
||||
Metal does. Every precision note is
|
||||
static there: no constant or binder decides one. So far they lower a kernel that reaches memory
|
||||
through its buffer slots and reads, writes, sizes or tests for nil its texture slots and its
|
||||
argument buffers' textures, and samples its texture slots through its runtime sampler slots
|
||||
|
||||
Reference in new issue
Block a user