Files
metal2vulkan/docs
Anees Iqbal 2105fa114e rt: heap textures, bound at the consumer's offsets in a heap's range of a Private block
A heap is a range of a Private block the consumer took at the heap's creation
(HeapRange: block, offset, length), as the plan decided: one Private range per
heap, resources at the offsets the guest's first-fit allocator picks.

Device::heap_texture_size_and_align answers heapTextureSizeAndAlignWithDescriptor:
with this device's image requirements (vkGetDeviceImageMemoryRequirements of the
same create info new_texture uses), never Metal's: the size rounded up to and
the alignment raised to bufferImageGranularity, so a buffer placed by the same
answers never shares a granularity page with the image. Replay showed why: one
vendor's image for a recorded heap texture is larger than the recording
device's (7.47 MB in a 5.9 MB heap), so the guest places by this answer.

Device::new_heap_texture binds the image at the heap offset: no allocation and
no texture block, bytes not zeroed (as Metal's heap textures), aliasing allowed.
A placement past the heap's end, an offset in the block off the image's
alignment, or a heap range past its block is Refusal::HeapTexturePlace at
creation; the image is never bound outside its heap. A Shared block, or an image
that requires an allocation of its own or does not take the Private type, is
Gap::HeapTexture (every optimal image measured takes the Private type). The
image holds the block, so a released block returns to the pool only once its
heap textures' images are gone.

new_texture's checks move into Device::prepare, shared with the size query, and
the image's create info into image_info. README: heap textures leave the
not-built line; REFUSALS.md and the signatures table updated.

Test: tests::heap::every_device_places_heap_textures_at_the_consumer_s_offsets
(answer equals the image's own size rounded to granularity; first-fit
placements allocate nothing and keep their own bytes; an alias; refusals for
past the end, off the alignment, a heap past its block, and a Shared block).
2026-11-17 18:26:07 -08:00
..