Take the device's own Depth16 bias and its store of an extended-range, padded or bfloat attachment's untouched texels

The device's depth bias unit on every format, and the device's store of untouched texels in
place of the unused-bits load pass (deleted with its capture machinery); the NaN depth
discard documented as capability. SEMANTICS 1910, RUNTIME 1682.

One work packet, landed as 7 commit(s) (88bcfeaea8..6aec9db4e9 on archive/development-linear-2026-10-28-evening), in order:

* Take the device's depth bias on a Depth16Unorm depth

Rule 1: the device's depth bias is its native form, so it is the only one. A
constant bias (or a slope alone) on a Depth16Unorm depth was recorded through
VK_EXT_depth_bias_control's depthBiasExact as Metal's own rule, c + 1 units of
1/65535 for c of 0 or more and c - 1 below (one unit for a slope alone), in
depth (floatRepresentation) or in 2^-16. Now `metal::state::depth_bias` hands
Metal's constant to vkCmdSetDepthBias in the device's own unit r on every depth
format; Vulkan leaves a fixed-point format's r to the implementation, at most
2 x 2^-16 ("Depth Bias", primsrast.adoc).

Deleted, nothing reading them any more: `depth16_units`, `DepthBiasUnit` and
`DepthBias::unit`, the `depth_format` parameter of `depth_bias` and of the
runtime's `vk_depth_bias`; the runtime's vkCmdSetDepthBias2EXT path
(`DepthBiasCommand`, `depth_bias_command`, the record's pinned representation,
the device's command, its priming and `DEPTH_BIAS_CALLS`, the exit guard's and
recorder's `CmdSetDepthBias2`, `Logged::SetDepthBias2` and its thunk, so
`CommandsReplayed::cmd_set_depth_bias2` goes). VK_EXT_depth_bias_control is
still described but no longer consumed, so the core recommends enabling neither
it nor its three features.

RADV on the 780M no longer takes DriverDeviation::MetalDepth16BiasedStores: it
was measured through the exact unit. MoltenVK keeps it (it hands Metal its
constant, by construction). Elsewhere `unorm-depth-bias` announces the device's
bias; its cost text, docs/API.md's entry, the deviation and property docs and a
new FAST-PATHS device-gap row state it.

Tests: `metal::state::a_unorm_depth_bias_is_metals_constant_in_the_devices_unit`
(the constant as given on lavapipe, NVIDIA and MoltenVK, which have
depthBiasExact or not); the recommendation test leaves the extension and its
features out; the driver-facts test drops RADV's row; the exit-guard tests lose
the priming group and render_state.rs as a keeper of the device's functions.
api_signatures blessed (DepthBiasUnit, DepthBias::unit, depth_bias's signature);
the refusal surface is unchanged. Not bumped here: RUNTIME_VERSION (the versions
commit) and the runtime-sources pin (landing).

Verified: cargo clippy -p metal2vulkan -p metal2vulkan-runtime
-p metal2vulkan-validation --all-targets --all-features -D warnings; nextest of
metal::state, device::tests::{enables,driver_facts,profile}, tests::fast_paths,
api_surface, api_signatures, exit_guard, render_state, degradation_catalogue,
draw_shape_notices and ash_interop: 159 passed.

* Cite the spec that leaves a NaN fragment depth undefined, which makes its discard capability

The native-arithmetic audit asked whether `clamp_depth`'s discard of a positive NaN
depth, on every profile, emulates Metal where the device has a native form. It does
not: Vulkan defines no answer for such a depth. "Depth Clamping and Range
Adjustment" (fragops.adoc, 35.10.1): "If zf is not in the range [zmin, zmax],
then zf is undefined following this step", with or without depthClampEnable, and a
NaN lies in no range; only depthClampZeroOne, which no profile enables, keeps a
float depth unchanged (and then the comparison of a NaN would still pass ALWAYS
and NOT_EQUAL, where Metal's fails every test). So the discard stays, as
capability, and the comment says why, so a later audit does not re-raise it.

Docs only (a doc comment); no behaviour changes.

Verified: cargo fmt --all.

* Drop the cube's unmeasured gradient route from the anisotropic tests' profile comment

The route was deleted with the native cube gradients; the comment still named it as a second
home of the anisotropic emulation. Only a profile without samplerAnisotropy emulates it now.

Verified: comment only; git grep finds no other mention of the unmeasured gradient route.

* Keep the device's store of an extended-range, padded or bfloat attachment's untouched texels

What: a render pass that loads and stores a color attachment of an extended-range, padded
10-bit or bfloat format now keeps the bytes its draws do not write, the device's own load and
store (VK_ATTACHMENT_STORE_OP_STORE of a loaded attachment), on every device. The runtime no
longer reproduces Metal's tile store: the load pass that rewrote the texels' unused bits before
the pass (render/unused_bits_load.rs, bind::unused_bits_module), the capture replay that found
the tiles a pass's draws reach for it (render/capture.rs, bind::capture_assembly_module,
capture_settle_module, tile_reach_module, the translator's capture form
LoweringInputs/VariantKey::captured_positions, CaptureForm, RuntimeFact::CapturedPositions,
PushField/PushHole::CaptureAddress, Feature::TileReach, StatusBits::CAPTURED_REACH_UNMEASURED,
StatusReport::captured_reach_unmeasured) and the pipeline states' capture forms are deleted, with
ExtendedRange::load_code, Degradation::UnreachedTilesRewritten and the WorkCounts fields
unused_bits_load_passes, unused_bits_load_texels and capture_reach_*. Every draw in such a pass
announces extended-range-bits-kept, naming the attachments (render/tile_store.rs, the renamed
module); its catalogue entry, the FAST-PATHS device-gap row and the format docs state what
differs: the unused bits, BGRA10_XR's alpha clamp, a padded sRGB twin's table and a bfloat code
through half, which Metal's pass rewrites in each tile a draw reaches. snorm-minimum-kept and
shared-exponent-kept are unchanged (TileStoreIsMetals still says where the device's store is
Metal's).

The de-indexed and private list forms keep the index read the capture form shared
(PushField::CaptureIndexAddress, CaptureLayout, CapturedIndex); the binder's de-indexed draw no
longer goes through the capture draw, and the vertex function's strip restart return, which only
the capture form's layout could take (a de-indexed strip is NotImplemented(PrimitiveId)), is
gone.

Why: the owner's rule 1. The device has a native load and store; reproducing Metal's tile store
emulated Metal's bits where the device has a native form. The difference is recorded and
announced (rule 2).

Verified: cargo clippy -D warnings, all targets and features, over metal2vulkan,
metal2vulkan-runtime, metal2vulkan-validation and metal2vulkan-conformance, plain and with
--cfg m2v_gpu: clean. api_signatures blessed, REFUSALS.md regenerated. The test runs (translator
and runtime suites, the touched validation lanes on lavapipe and on the M3 Max's MoltenVK) follow
this commit and are reported with the lane.

* Bump the semantics and runtime versions for the device's tile store and depth bias

What: SEMANTICS_VERSION 1907 -> 1908 and RUNTIME_VERSION 1681 -> 1682.

Why: SEMANTICS_VERSION, because the translator's output changes under unchanged keys: the
de-indexed and private list vertex forms no longer carry the strip restart return, and the
capture form, its runtime fact and its push field are gone. RUNTIME_VERSION, because runs of
unchanged artifacts now do something else: a Depth16Unorm depth takes the device's depth bias
(no depthBiasExact or unit rescale), and a pass that loads an extended-range, padded or bfloat
attachment keeps its untouched texels' bytes (no unused-bits load pass, no capture replay) and
announces extended-range-bits-kept. ARTIFACT_FORMAT_VERSION stays: the codec tags variants by
name, and the removed ones (CaptureForm, PushField::CaptureAddress,
RuntimeFact::CapturedPositions) leave their tags unused, so an old entry holding one is a miss.

Verified: the constants alone change; the golden tables and the runtime-sources pin are
re-blessed at landing.

* Hold the lanes and the fact census to the device's store of untouched texels

What: three runtime lanes still expected Metal's tile store after 5e710fb988 made the device's
store the only form, and the mechanism test still counted the deleted
RuntimeFact::CapturedPositions.
- extended_range_blends::a_pass_of_extended_range_and_padded_colors_names_each_loaded_color:
  the padded colors, which the function does not write, keep their bytes (all ones), where
  Metal's pass leaves each word 0xffc0.
- extended_range_blends::a_fetched_two_plane_attachment_written_unblended_stores_metals_write:
  color 2, loaded and unwritten, keeps its bytes, where Metal's pass zeroes its color words' top
  two bits.
- extended_range_blend_table::a_memoryless_color_2_blends_as_a_stored_color_does: the stored
  color 0's bands are compared with the unused bits as Metal's pass leaves them
  (as_metal_leaves), the codes exactly, as the table's other passes already are.
- device::tests::mechanism: the variant census is 0..89 (MergedDraws takes the freed index).

Why: the lanes held the deleted exact form; the device's store is now the contract and
extended-range-bits-kept announces the difference.

Verified: on the M3 Max (MoltenVK, --cfg m2v_gpu, under maclock and memcap) the three lanes and
the rest of extended_range_blends pass (11 of 11, with waiter_submits, which failed once under a
load of 40 and passed on its rerun); on plain, device::tests::mechanism and tests::fast_paths
pass (12 of 12); clippy -D warnings clean, plain and --cfg m2v_gpu, over the four crates.

* Re-pin the runtime sources at the landing tip

The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
This commit is contained in:
Anees Iqbal committed 2026-10-28 21:19:28 +02:00
1 parent 487e23f3ee
commit bd3c50d741
123 files changed
+955 -19351

No files matched your search

+22 -30
View File
@@ -1335,9 +1335,11 @@ bound.
- `metal2vulkan-degrade-unorm-depth-bias` (precision). `UnormDepthBias`: A draw biases a
`Depth16Unorm` depth by a constant, or by a slope alone, which brings Metal's constant unit, on a
device whose driver is not measured to store Metal's codes so
(`DriverDeviation::MetalDepth16BiasedStores`): the device biases and converts the depth. Cost: a
biased depth can store a code next to Metal's: the device rounds the biased sum its own way, and
without depthBiasExact counts the bias in its own unit.
(`DriverDeviation::MetalDepth16BiasedStores`): the device biases by Metal's constant in its own
unit and converts the depth. Cost: a biased depth can store another code than Metal's: the
device biases by the constant c in its own unit, up to twice 2^-16, where Metal biases by c + 1
units of 1/65535 (c - 1 below 0, one unit for a slope alone), and rounds the biased sum its own
way.
- `metal2vulkan-degrade-unorm-depth-rounding` (precision). `UnormDepthRounding`: A draw tests or
writes a `Depth16Unorm` depth on a device whose driver is not measured to convert a depth to
Metal's code (`DriverDeviation::MetalDepth16Stores`), or a pass clears one to a depth that a
@@ -2034,21 +2036,24 @@ bound.
the bytes Metal's blit reads from outside the texels: from outside the planes below a width of 4,
and those an earlier blit left in a row's padding or past a plane, which Metal keeps.
- `metal2vulkan-degrade-extended-range-bits-kept` (precision). `ExtendedRangeBitsKept`: A draw in a
render pass that loads a color attachment of an extended-range or padded 10-bit format
render pass that loads a color attachment of an extended-range, padded 10-bit or bfloat format
(`BGR10_XR`, `BGRA10_XR`, `RGB10A8_2P_XR10`, `R10Unorm_X6`, `RG10Unorm_X12` and their sRGB twins,
and `RGB10A2Unorm_sRGB`) and does not discard it at the store, where the pass's load pass does
not take it: a multisampled attachment, a texture held as a shadow of another image or of a
heap's bytes, a sparse one, or one whose image the device does not copy both ways (a padded format takes no multisample texture). Also, once per device, a GPU blit
into, out of or between textures of which one is a `BGRA10_XR` or `BGRA10_XR_sRGB` texture Metal
keeps losslessly compressed: Metal's blit moves the texels through the compression, which clears
the same bits and clamps the same alpha, where the device's copy keeps the bytes. Cost: the
texels the pass's draws do not write keep their bytes; Metal's pass keeps their codes but rewrites
the bits they leave unused in each tile a draw reaches (BGR10_XR's bits 30 and 31 to ones,
BGRA10_XR's low six bits of each field to zeros, the two-plane color word's top two bits to zeros)
and clamps BGRA10_XR's alpha code to [384, 894]: a texel whose bytes no Metal write left (uploaded
bytes, or an alpha code past 894) keeps bytes Metal's pass would change, and a blit through a
BGRA10_XR texture Metal compresses keeps the bytes Metal's blit rewrites so; every such texel
reads the same value either way.
`RGB10A2Unorm_sRGB`, `R16Bfloat`, `RG16Bfloat` and `RGBA16Bfloat`) and does not discard it at the
store, on every device: the device's pass keeps the bytes its draws do not write, where Metal's
pass writes each 32 x 32 tile a draw reaches back through its tile store. Also, once per device, a
GPU blit into, out of or between textures of which one is a `BGRA10_XR` or `BGRA10_XR_sRGB`
texture Metal keeps losslessly compressed: Metal's blit moves the texels through the compression,
which clears the same bits and clamps the same alpha, where the device's copy keeps the bytes.
Cost: the texels the pass's draws do not write keep their bytes; Metal's pass rewrites, in each
tile a draw reaches, the bits their codes leave unused (BGR10_XR's bits 30 and 31 to ones,
BGRA10_XR's low six bits of each field, the two-plane color word's top two bits and a padded
word's low six bits to zeros), clamps BGRA10_XR's alpha code to [384, 894], moves a padded sRGB
twin's code through its table and a bfloat code through half (out of half's range to an infinity
or zero, a NaN to 0x7fc0): a texel whose bytes no Metal write left (uploaded bytes, an alpha code
past 894, a bfloat code off half's grid) keeps bytes Metal's pass would change, and a blit
through a BGRA10_XR texture Metal compresses keeps the bytes Metal's blit rewrites so; an
extended-range texel reads the same value either way, a bfloat code off half's grid reads its own
value where Metal's reads the half it was moved to.
- `metal2vulkan-degrade-snorm-minimum-kept` (precision). `SnormMinimumKept`: A draw in a render pass
that loads a single-sampled color attachment of a signed normalized format (`R8Snorm`, `RG8Snorm`,
`RGBA8Snorm`, `R16Snorm`, `RG16Snorm`, `RGBA16Snorm`) and does not discard it at the store. Cost:
@@ -2186,19 +2191,6 @@ bound.
read_write access) that does not name it reads what an earlier such write left in the stand-in's
sink, where Metal drops those writes and reads zero; a sampled read, and a size query, are
Metal's.
- `metal2vulkan-degrade-unreached-tiles-rewritten` (precision). `UnreachedTilesRewritten`: A render
pass that loads a color attachment of an extended-range, padded 10-bit or bfloat format
(`BGR10_XR`, `BGRA10_XR`, `RGB10A8_2P_XR10`, `R10Unorm_X6`, `RG10Unorm_X12` and their sRGB twins,
`RGB10A2Unorm_sRGB`, `R16Bfloat`, `RG16Bfloat` and `RGBA16Bfloat`), stores it and draws,
whose load pass rewrites every 32 x 32 tile of its render area: Metal's pass rewrites
only the tiles a draw's primitives reach, and every tile only where a color attachment of the pass
is cleared and stored (announced where none is, or where the pass renders more than one layer).
Cost: in tiles no draw reaches the pass rewrites what Metal keeps: the unused bits made canonical
(BGR10_XR's bits 30 and 31 ones, BGRA10_XR's low six bits of each field and the two-plane color
word's top two bits zeros) and BGRA10_XR alpha codes clamped to [384, 894], so an out-of-range raw
alpha reads back changed, a padded word's low six bits zeroed (an sRGB twin's code moved through
Metal's table), a bfloat code moved through half (out of half's range to an infinity or zero, a
NaN to 0x7fc0); the tiles a draw reaches are Metal's.
- `metal2vulkan-degrade-zero-layer-map-after-release` (precision). `ZeroLayerMapAfterRelease`: A
draw in a render pass over a rasterization-rate map of no layers that was made after the device
released a map of one or more layers, or reset from one of layers. Cost: the draws write nothing,