Heap textures: an image that fits Metal's answer lies in place before a shadow

A single-sample colour heap texture whose image of the route the device
first took (ANV's compressed optimal image under the default
HeapCompressionPolicy, say) takes more bytes or a coarser alignment of the
heap than Metal's answer was a shadow of the heap's bytes in Metal's tiles,
copied in before each command buffer's first use and back after each
writing encoder. The owner's rule keeps a shadow as a correctness fallback
only: where the device makes an image that fits the answer in the heap's
memory, the texture now lies there in place, its optimal image of
host-transfer usage first, else its linear image
(Device::fitting_heap_image), announced heap-texture-host-transfer or
heap-texture-linear with the making's facts and what the first image took.

Unverified: built and measured on ms01's Iris Xe in the commits that follow.
(cherry picked from commit c1a996cd53f74d0afa130dd867ab42499c2b758f)
This commit is contained in:
Anees Iqbal committed 2026-11-08 12:19:41 -08:00
1 parent c95bbf382c
commit 7fbbac9536
4 files changed
+143 -25

No files matched your search

+8 -2
View File
@@ -2290,7 +2290,10 @@ bound.
colour texture made in a heap on a device whose driver's compressed images hide writes through an
alias (`DriverFact::CompressedImagesHideAliasedWrites`), whose image takes host-transfer usage,
which the driver keeps uncompressed in the heap's bytes
(`metal2vulkan::device::DriverFact::HostTransferImagesKeepTheirBytes`). Cost: the texture's image
(`metal2vulkan::device::DriverFact::HostTransferImagesKeepTheirBytes`). Also, on any device, a
single-sample colour texture whose first image takes more bytes or a coarser alignment of the
heap than Metal's answer, where this one fits the answer: it lies in the heap's bytes in place of
a shadow of them. Cost: the texture's image
is kept uncompressed, so writes through the heap's buffers and textures over its bytes show
in it as Metal's do: a clear of it loses the driver's fast clear (334.5 us where a compressed
2048x2048 RGBA8Unorm image's took 4.1 us on an RPL-S), while its copies, sampling and blending
@@ -2299,7 +2302,10 @@ bound.
made in a heap on such a device whose image takes no host-transfer usage (the device did not
enable `hostImageCopy`, or an adopted device's consumer did not say so, or the format or shape
takes none there): a linear image, which the driver does not compress, where one does all the
optimal image does for the texture. Cost: the texture's image is linear, so writes through the
optimal image does for the texture. Also, on any device, a single-sample colour texture whose
first image takes more bytes or a coarser alignment of the heap than Metal's answer, where no
image of host-transfer usage fits the answer and a linear one does: it lies in the heap's bytes
in place of a shadow of them. Cost: the texture's image is linear, so writes through the
heap's buffers and textures over its bytes show in it as Metal's do: its reads and writes go
without the optimal tiling's locality and compression (3.9 to 9.6 times the host-transfer image's
time for copies, clears and draws of a 2048x2048 RGBA8Unorm texture on an RPL-S).