An unstored DontCare load in a pass that draws clears, as Metal's draws read it

Metal (an M3 Max, macOS 27.0.1, lane dont_care_unstored): an attachment a pass loads `DontCare`
and does not store reads zero (a color) or the pass's clear value (a stencil) wherever the pass's
draws read it, never its earlier texels. The runtime left such an attachment `DONT_CARE`
(clear_reach::dont_care_loads skipped every attachment the pass does not store): the first
instance's DONT_CARE load read 0 for the stencil (MoltenVK names no clear value there), later
instances of a split pass LOAD what the first left, so the tiles it did not reach read the
earlier texels, and a color the only instance leaves out (fetched through the pixel interlock)
read its earlier texels everywhere.

Now such an attachment (not memoryless, not separate depth and stencil textures) takes `Clear`
in a pass whose draws reach a tile: zero for a color (dont_care_clear), the attachment's clear
value for depth and stencil, by the first instance's load operation over the render area, and a
color that instance leaves out is cleared before the pass by the existing path for cleared
storage colors (cleared_ahead, or the reach pass over the render area). It is not tile-bounded
and not announced: no fragment reads a tile no draw touches, so the answer is Metal's wherever it
is read. `dont-care-load-tiles`' text, rustdoc and catalogue entry are scoped to stored
attachments; clear_reach.rs records Metal's measured answer and the rule.
This commit is contained in:
Anees Iqbal committed 2026-11-11 09:59:04 -08:00
1 parent 51c488062e
commit f3f6696eb9
4 files changed
+45 -8

No files matched your search

+5 -1
View File
@@ -2343,7 +2343,11 @@ bound.
with `DontCare` and stored, in a pass that draws, is cleared before the draws to zero (a color) or
its clear value (depth, stencil) over the render area and the tiles past it a clear reaches, where
Metal clears only the tiles a draw's primitives touch and keeps the texels of the others. Cost:
the tiles no draw touches hold zero or the clear value where Metal keeps their texels.
the tiles no draw touches hold zero or the clear value where Metal keeps their texels. An
attachment loaded with `DontCare` that the pass does not store is not announced: in a pass that
draws, the runtime clears it over the render area to zero or its clear value, which is what
Metal's draws read of it wherever they read it (an M3 Max, macOS 27.0.1: a framebuffer fetch of
a second color and a stencil test, in passes split and whole).
- `metal2vulkan-degrade-fresh-pattern-zeroed` (precision). `FreshPatternZeroed`: On a device that
presents an Apple silicon Mac's compression (`DeviceProperties::lossless_compression`,
`MacClass::AppleSilicon`; never on one that presents a Mac with an Intel or AMD GPU, whose new