heap depth textures: a merge's keep holds the heap's bytes, not the image's

A 2-slice Depth32Float 64x64 x2 multisample texture in a Shared placement heap
on ANV (Iris Xe, RPL-P, Mesa 26.2.6) lost the samples a blit wrote into one
slice: 16384 of 16384 were off Metal's tiles after the merge back, while a
read straight from the image matched. The heap's bytes held 0xee before the
blit. The copy in hands the image 0xeeeeeeee, a float outside [0, 1], which
Vulkan leaves undefined in a depth image without
VK_EXT_depth_range_unrestricted, and ANV stores 0.0. The merge's keep was
moved out of the image (only drivers announced drawn-depth-copy kept the
heap's bytes), so it held 0.0, and the merge kept the heap's 0xee in every
byte of a written sample that equals 0.0's: a probe found 9155 0xee bytes
left in the slice, the 9134 zero bytes of the samples plus 21 sample bytes
that are 0xee, and no sample whole.

Now a heap's tiled texture with a depth aspect, of any sample count, keeps
the heap's bytes: the staging buffer its copy in filled where the keep
follows it (WorkCounts::shadow_keeps_from_staging), else the heap's bytes
themselves, and plans no moves out of the image for the keep. Every byte a
command wrote is merged whatever the copy in changed; a value the copy in
changed in a texel no command wrote is written back as stored, as a copy back
writes it.

That clamp is the device's: a heap's 32-bit float depth texture whose shadow
copies the heap's bytes into its image now announces restricted-depth-upload
as it is made, on a device without VK_EXT_depth_range_unrestricted whose
driver is not measured to keep such a value (ANV; not MoltenVK, NVIDIA or
lavapipe with the extension). Its declaration, docs/API.md's catalogue and a
device-gap row in docs/FAST-PATHS.md say so.

The measured drawn-depth-copy flag a multisample texture held for its keep
is gone with its one reader; the announcement at making stays.

heap_multisample_textures_keep_their_samples_in_metal_s_tiles now also
checks, for each counted 32-bit float depth texture, restricted-depth-upload
as it is made where the device clamps, and that a blit into one slice or
aspect keeps from staging. Verification in the tip report.

(cherry picked from commit 688e1dcc00ff67979833fdcbaf2f5484057e18a6)
This commit is contained in:
Anees Iqbal committed 2026-11-08 13:16:59 -08:00
1 parent a3dd61db7a
commit ec94c62dce
10 files changed
+140 -52

No files matched your search

+5 -3
View File
@@ -2218,9 +2218,11 @@ bound.
on a device without `VK_EXT_depth_range_unrestricted` enabled, where Vulkan leaves a value outside
`[0, 1]` undefined, whose driver is not measured to keep one
(`DriverFact::DepthImageKeepsValuesOutsideUnitRange`). And a render pass's NaN clear depth on such
a device, which Metal stores as `0x7fc00000`, cleared to 1.0. Cost: a value outside [0, 1] may be
stored clamped to [0, 1], where Metal's keeps it, so reads, samples, comparisons and depth tests
of it can differ.
a device, which Metal stores as `0x7fc00000`, cleared to 1.0. And a heap's texture of such a depth
whose shadow's copies in move the heap's bytes into its image, announced as it is made: its
copies back write each value as the image stored it, one no command wrote too. Cost: a value
outside [0, 1] may be stored clamped to [0, 1], where Metal's keeps it, so reads, samples,
comparisons and depth tests of it can differ.
- `metal2vulkan-degrade-host-read-dispatch-arguments` (performance). `HostReadDispatchArguments`: An
indirect dispatch, or a dispatch after `setStageInRegionWithIndirectBuffer:indirectBufferOffset:`:
its arguments or its stage-in region are GPU memory the work before it may write, so they are