Read the sparse move rows through uncompressed textures

The move family's rows (inside-the-level, past-the-destination's-row,
clipped-source) read a tile a move rebound as 0 in 3,968 of its 4,096
words on Metal and whole on ours. probes/sparse_move_compression.m (job
m3-max-3570, an M3 Max under macOS 27.0.1, five descriptors, two runs
each, one outcome) shows that is lossless compression's: under the
case's own descriptor (ShaderRead, allowGPUOptimizedContents YES) a
moved tile kept its word in 128 texels, the first 4 by 2 of each 16 by
16 block, and with allowGPUOptimizedContents off, ShaderWrite or
PixelFormatView usage both moved tiles read whole. Controls: untouched
tiles whole, moved-from tiles zero, every command buffer completed,
usedSize unchanged.

A move is documented to move the tile's mapping, and the rows read
which tiles it moved, so they now make both textures with
allowGPUOptimizedContents off:

- SparseTextureSpec gains gpu_optimized (Metal's default, true) and
  unoptimized(); both sides forward it to their descriptor. An
  unoptimized texture adds a byte to its fingerprint and a site suffix
  where the default adds none, so every other sparse case's recording
  keeps its fingerprint.
- moved() builds its two textures unoptimized; the four move rows'
  recordings are re-taken on the M3 in the next commit.
- docs/API.md's accepted differences gain the compressed case: Metal's
  moved tile may read only part of its texels, ours reads all of them
  under every descriptor; the runtime does not reproduce the loss.
- The probe's header records its results.

(cherry picked from commit b3f8f28dbf18ce6756587702dd012ebd282c4f3a)
This commit is contained in:
Anees Iqbal committed 2026-11-07 06:26:30 -08:00
1 parent 167d22c9dd
commit d158a960dd
6 files changed
+61 -3

No files matched your search

+8
View File
@@ -4243,6 +4243,14 @@ each item named states the rule in full.
update_texture_mapping`), and leaves every texel as it was: Vulkan binds nothing past an image's
layers (`VUID-VkSparseImageMemoryBindInfo-subresource-01723`), and which texels Metal's page
reaches is not derivable from what was measured.
- **A sparse tile a move rebound reads all its texels, compressed or not.** Under Metal's default
`allowGPUOptimizedContents`, Metal may keep a sparse texture losslessly compressed, and a tile
`moveTextureMappingsFromTexture:…` rebound into one can then read its moved texels in only part
of the tile: on an Apple M3 Max under macOS 27.0.1 a `ShaderRead` `R32Float` tile held them in
128 of its 4,096 texels (the first 4 by 2 of each 16 by 16 block) and 0 in the rest. With
`allowGPUOptimizedContents` off, `ShaderWrite` or `PixelFormatView` usage, Metal's moved tile
read all 4,096. The runtime's moved tile holds all of its texels under every descriptor; it
does not reproduce the loss.
- **A heap's buffer and texture over the same bytes alias them, in the device's layout**, not
Apple's tiled or compressed one.