A newer heap texture placed over an older one's bytes moved out of UNDEFINED
in the upload ahead of its first command buffer. Vulkan lets that move write
the image's memory (a compression state's initialization), and a command
buffer that reads the older texture before writing the newer one then reads
changed bytes, where Metal changes none. AMDVLK does this on a Radeon 780M
(round job m3-max-79662, 1 of 915 failed; RADV and ANV pass).
The ruled form, one form on every device with no device or driver key: no
upload moves such a texture. Its first use moves it, in the command stream,
after the earlier reads.
- alias: a texture placed with links is unmoved (Placement::unmoved) as well
as stale. A first use in a command buffer of a texture unmoved as it is
encoded, a read included, adds a check at the head of its segment, as a
first write already did. The segment ends first where a link was read in
it. The submit thread resolves the check in queue order: a write's check
moves a stale texture, and any check moves an unmoved one, which is then
unmoved no more.
- Each heap lists its unmoved textures (Places::unmoved). An entry leaves as
its texture moves or is released, so the list never holds more than the
heap's live placements. The device counts them, so use_heap on a device with
none loads one atomic and locks nothing.
- use_heap (compute and render) is a read of each unmoved texture of the heap,
since a kernel or a draw may reach it next through an address: its check
goes where the use_heap is.
- get_bytes of an unmoved texture moves it in its own upload, ahead of its copy
(alias::host_read). replace_region already moved a stale texture
(host_write).
- Image.over and its source scope in Image::homing are gone: an unmoved
image is made homed and never enters an upload's homes.
- Runtime README: the heap texture contract says when the move happens. The
known gap of textures carries the residuals: a never-written newer texture
that is read; an older texture read through a heap declaration after a newer
one over its bytes was made and before that one is written (in both, the
move may change the older bytes, as AMDVLK's does); a first use rt cannot
name; and a draw's first use, checked where the pass's part of the command
buffer starts.
To verify at this commit (jobs in the handover): the red commit's counts test
and heap_alias on lavapipe, clippy in three configurations, doc and private
doc, the runtime and validation suites on lavapipe, AMDVLK on a Radeon 780M
red at the red commit and green here, and RADV, ANV and NVIDIA unchanged.