Metal's pass, once it draws, writes each 32x32 tile a draw reaches back through its texels'
values: a signed normalized channel's minimum code (-128, -32768) reads as -1.0 and is stored as
the code above it, and an RGB9E5Float word whose largest mantissa is below 256 under an exponent
above 0 is stored normalized. A Vulkan pass's load and store keep those bytes.
What changes:
- New degradation kind snorm-minimum-kept (Precision), announced at every draw and indirect
execution in a pass that loads a single-sampled R8, RG8, RGBA8, R16, RG16 or RGBA16 Snorm colour
attachment and keeps it, naming each such attachment. It joins shared-exponent-kept for RGB9E5.
- New DevicePolicy::tile_store, TileStorePolicy { Device (default), Exact }; exact_answers()
selects Exact. It is the runtime's choice alone and keys no profile. Under Exact the load pass
that already rewrites extended-range, padded and bfloat attachments also takes a single-sampled
snorm or RGB9E5Float attachment in the tiles the pass's draws reach, with two new
bind::unused_bits_module rules (SnormMinimum, SharedExponent; the module is keyed by
PixelFormat), and nothing is announced. An attachment the load pass cannot take keeps the
device's load and store, announced.
- New answer fact DriverFact::TileStoreIsMetals for MoltenVK 1.4.1 on Apple's GPUs: its render
pass is a Metal render pass, so its tile store is Metal's for both kinds. There neither value
adds a load pass or a notice.
- Docs: one FAST-PATHS row for the switch, its cost the load pass's measured GPU time; a known gap
for lavapipe, which states no blend for any snorm format, so a blending snorm pipeline is
refused there; API.md's policy bullet and catalogue entries; the unreached-tiles-rewritten text.
Why: a code no Metal write leaves, but uploaded or copied bytes may hold, reads back differently
after a drawing pass. The exact form costs a copy of the render area through a dispatch before
every such pass, so the device's store stays the default, announced, and Metal's store is a
switch away.
Verified:
- Metal's behaviour probed on an M3 Max under macOS 27.0.1 (70x40 targets of five snorm formats):
a pass that draws nothing moves no code; a tiny triangle moves every minimum code of its first
32x32 tile and none elsewhere; a blended full-target draw moves all of them; a blit there and
back moves none. The guest's sweep showed the same on R8Snorm and RG8Snorm.
- Unit tests: unused_bits (both rules against CPU models over every code, the M3's example
RGB9E5 word, the masked-tile rewrite), fast_paths (the row, no profile key), driver_facts,
api_surface, owned_divisions: 38 passed on gem10.
- runtime_lane::snorm_tile_store under Device and Exact for both kinds, asserting load-pass
counts, bytes and notices: on lavapipe with padded_loads, extended_range_blends and the notice
site check, 15 passed (Exact took the load pass, Device announced); on the M3 Max under
MoltenVK 1.4.1, 4 passed through the fact (no load pass, no notice) and 11 more beside them.
- The load pass's cost (FAST-PATHS): on the Radeon 780M, a 1080p pass per frame of BGRA10_XR
1958.8 us against RGBA16Float's 135.3 us; the snorm and RGB9E5 cases take the same pass, not
timed alone.
- clippy -D warnings (plain, m2v_gpu, m2v_cpu_icd) and rustdoc.