Separate depth and stencil textures: an unstored DontCare aspect follows UnstoredDontCarePolicy in the scratch image

A pass whose depth and stencil attachments are two textures renders through a scratch image of
the combined format (depth_stencil_scratch.rs), and clear_reach::dont_care_loads skipped it: an
aspect loaded DontCare and not stored took the scratch's DONT_CARE load under every policy, with
no notice. So under exact_answers() its draws read what the new scratch image held (on MoltenVK
a stencil of 0 and a depth of 1.0, Metal's defaults for a load that names no clear value), where
Metal's read the pass's clear value: measured on the M3 Max under macOS 27.0.1 by the lane's
passes through Metal itself (job m3-max-16522), each aspect apart, whether the other aspect is so
loaded or loaded and stored.

Now such an aspect takes the answer of any attachment so loaded, each aspect apart: in a pass
whose draws reach a tile, the scratch's Clear to the aspect's clear value under
UnstoredDontCarePolicy::Cleared and on a driver with DriverFact::UnstoredClearNoSlower (the
scratch image is a combined depth/stencil attachment, the shape the fact measured), else its
DONT_CARE, announced dont-care-unstored-load naming the aspect. Nothing is copied into the
aspect before the pass (only Load aspects are), so no earlier bytes reach it. An aspect the pass
stores keeps the scratch's DONT_CARE load as before.

Docs: clear_reach.rs records Metal's answer for separate textures and the rule; the scratch
module, the notice's rustdoc and catalogue entry, UnstoredDontCarePolicy's rustdoc, API.md's
section and the FAST-PATHS row name separate textures; the known gap is removed.
This commit is contained in:
Anees Iqbal committed 2026-11-11 10:35:17 -08:00
1 parent 876309a4c4
commit 9a67d986e6
6 files changed
+55 -45

No files matched your search

+8 -7
View File
@@ -263,8 +263,9 @@ compile does. `DevicePolicy::default()` is `DevicePolicy::UNTRUSTED`:
(`DriverFact::UnstoredClearNoSlower`: MoltenVK on the M3 Max, RADV on the Radeon 780M), and
leaves it to the driver's `DONT_CARE` elsewhere, announced `dont-care-unstored-load`: lavapipe's
draws then read its earlier texels. `unstored_dont_care_loads = UnstoredDontCarePolicy::Cleared`,
which `exact_answers()` selects, clears it on every device. A memoryless one, and one of separate
depth and stencil textures, are not covered.
which `exact_answers()` selects, clears it on every device. Separate depth and stencil textures
take the same answer, each aspect apart, in the scratch image the pass renders them through. A
memoryless one is not covered.
Loops run as written: no execution bound is translated in.
@@ -2362,11 +2363,11 @@ bound.
the tiles no draw touches hold zero or the clear value where Metal keeps their texels. Not an
attachment the pass does not store (`dont-care-unstored-load`).
- `metal2vulkan-degrade-dont-care-unstored-load` (precision). `DontCareUnstoredLoad`: An attachment
loaded with `DontCare` and not stored (not memoryless, not one of separate depth and stencil
textures), in a pass whose draws reach a tile, is left to the driver's `DONT_CARE` load under
`UnstoredDontCarePolicy::Driver`, the default, on a driver not measured to clear it no slower
(`DriverFact::UnstoredClearNoSlower`), where Metal's draws read zero (a color) or the clear value
(depth, stencil) wherever they read it. Cleared, and not announced, on a driver with the fact and
loaded with `DontCare` and not stored (not memoryless; an aspect of separate depth and stencil
textures in the scratch image the pass renders them through), in a pass whose draws reach a
tile, is left to the driver's `DONT_CARE` load under `UnstoredDontCarePolicy::Driver`, the
default, on a driver not measured to clear it no slower (`DriverFact::UnstoredClearNoSlower`),
where Metal's draws read zero (a color) or the clear value (depth, stencil) wherever they read it. Cleared, and not announced, on a driver with the fact and
under `UnstoredDontCarePolicy::Cleared` (`exact_answers()`). Cost: the pass's draws read what the
driver's `DONT_CARE` load leaves in the attachment (on lavapipe its earlier texels) where Metal's
read zero or the clear value.