rt: depth tests, writes and bias as dynamic state, under static notes; an unknown store action stores

The render-state lane's depth step (the planner's step 1).

- A depth-stencil state's depth test, write and compare operation are dynamic state, recorded
  where they changed; DrawKind::DepthTest is gone. A pipeline bakes the depth format alone, so a
  change of depth-stencil state or bias makes no pipeline. In a pass without a depth attachment
  Vulkan skips the test, where Metal's documentation states no answer.
- set_depth_bias (setDepthBias:slopeScale:clamp:): the bias and slope scale as given, enabled for a
  draw of triangles where either is not zero and never for lines (Metal biases triangles alone).
  A clamp other than 0 is Gap::Draw of DepthBiasClamp (no stream sets one).
- Static notes, carried by the operation: PrecisionNote::DeviceDepthBias
  (RenderCommandEncoder::DEPTH_BIAS_NOTE: the slope measure, and a fixed-point attachment's unit,
  are the device's; Apple states neither; read from Vulkan's Depth Bias section and Apple's
  setDepthBias page), and PrecisionNote::DepthDenormals (DepthStencilState::precision_note, a state
  that tests or writes depth: every driver measured but MoltenVK on an M4 compares a denormal
  depth otherwise than Metal; RADV and ANV store one as zero). The old runtime maps DepthDenormals
  to its own depth-denormals kind and takes device-depth-bias as a note kind; codec, fast_paths,
  validation's allowance (Unbounded), API.md and ARTIFACT_FORMAT_VERSION 539 follow. No signed-depth
  note: no clear, viewport or upload gives rt a negative or NaN depth, and Vulkan leaves a depth
  past the viewport's range undefined.
- MTLStoreActionUnknown stores (Vulkan fixes the store as the rendering begins); the encoder's
  set_color_store_action, set_depth_store_action and set_stencil_store_action change nothing the
  device does and refuse a resolving action (Resolve). On a tile-based device this stores a
  target Metal would have discarded (README).
- set_triangle_fill_mode, set_depth_clip_mode, set_viewports and set_scissor_rects take Metal's
  defaults (Fill, Clip, one viewport or rectangle) as nothing and refuse the rest, typed
  (FillMode, DepthClamp, Viewports): replay found every stream at the defaults.
- The conformance rt side plays the depth bias, fill, clip and viewport-count steps and announces
  the encoder's notes; the replay player maps setDepthBias:slopeScale:clamp:, the three store
  action setters, setTriangleFillMode: and setDepthClipMode:.
- Tests: a depth attachment cleared to 0.5 with its store action unknown, tested under Less with
  writes, failing at 0.375, passing Greater by its bias alone, every mode setter's refusal, and no
  pipeline made by the state changes; the instructions a depth-tested draw retires beside a plain
  one, printed. REFUSALS.md regenerated, the API table blessed.
This commit is contained in:
Anees Iqbal committed 2026-11-18 18:02:33 -08:00
1 parent b180bf5b57
commit 9c40b3cd83
21 files changed
+707 -125

No files matched your search

+12
View File
@@ -4335,6 +4335,9 @@ bound.
measured but MoltenVK on an Apple M4). Cost: a denormal depth may read, sample and copy out as a
zero, or the depth test may compare it as zero (a positive one) or below zero (a negative one),
where Metal keeps it and compares a positive one above zero and a negative one not below it.
On `metal2vulkan-rt` it is the static note `PrecisionNote::DepthDenormals` of every
depth-stencil state that tests or writes depth (`DepthStencilState::precision_note`), on every
device, with no driver fact.
- `metal2vulkan-degrade-signed-depth-test` (precision). `SignedDepthTest`: A depth test that may
compare a negative value or a NaN stored in the 32-bit float depth of a render target as it is, or
a pass with depth writes that may store such a value with its sign, where Metal's test compares
@@ -5476,6 +5479,15 @@ bound.
reads them, and records none. An `air.convert` from `f8e4m3fn` or `f8e5m2` and a
simdgroup-matrix cell of those formats widen through the same type there and record none: their
formats are OCP's own, and Metal on Apple M3 does not compile them.
- `metal2vulkan-degrade-device-depth-bias` (precision). `PrecisionNote::DeviceDepthBias`: A draw
of triangles under a depth bias (`setDepthBias:slopeScale:clamp:` with a bias or a slope scale
other than 0) on `metal2vulkan-rt`, whose render encoder carries it as a static note
(`RenderCommandEncoder::DEPTH_BIAS_NOTE`): the biased depth is the device's. Vulkan biases by
`m × slopeScale + r × depthBias`, where the maximum depth slope `m` is the device's (exact, or
the larger of the two derivatives' magnitudes) and the unit `r` is `2^(e - n)` of the primitive's
largest depth exponent for a float depth attachment and the device's for a fixed-point one (at
most `2 × 2^-n`). Apple's documentation states neither the slope measure nor the unit. A draw of
lines is not biased, as Metal biases triangles alone.
- `metal2vulkan-degrade-device-pack-conversion` (precision). `PrecisionNote::DevicePackConversion`:
Native device maths (a conversion): `air.pack` or `air.unpack` of a normalized format is the
device's: `GLSL.std.450`'s `Pack`/`Unpack` `Unorm4x8`, `Snorm4x8`, `Unorm2x16` and `Snorm2x16`,