Files
metal2vulkan/docs
Anees Iqbal 6276d55b25 Textures a shader writes over host pages in place, where the device's check passes for their writes
A texture over host pages whose usage writes it through a shader (`ShaderWrite` or `ShaderAtomic`)
was a shadow on every device: its texels copied in before each use and merged back after each
write. The owner's ruling of 11-07 (confirmed for discrete GPUs) has CPU-visible memory worked on
in place wherever the device can, slower or not, with a shadow only where in place is impossible,
announced and counted. This takes such a texture in place on the same terms as one that renders,
from the parked branch park/shaderwrite-in-place, onto the per-class, per-access check, with no
device-type rule: a discrete GPU takes it in place too.

- `in_place.rs`: a third access, `Access::Writes`, which a texture of `ShaderWrite` or
  `ShaderAtomic` usage takes; a texture is tried in place where its class's check passed for each
  access it takes (`Access::takes`: renders, writes, or reads where it does neither), asked in
  that order until one did not pass. A texture a shader writes of texels of 1 or 2 bytes, which
  the check's kernel stores none of, is a shadow (`ShadowCause::StoreWidth`); `ShadowCause::
  ShaderWrite` is gone. Nine verdicts a record (CHECK_VERSION 3).
- `in_place_check.rs`: the storage rounds, per class: a texture of `ShaderWrite` usage over the
  pattern, every texel stored by the crate-owned copy-in kernel through an unsigned-integer view
  (`Texture::store_in_place`, from a buffer outside the Metal address space), its first move
  first, while the writer writes the bytes between rows and after the image; every texel must read
  the kernel's bytes, every other byte the writer's or the pattern. `STORE_SHAPES`: 4, 8 and 16-byte
  texels, packed, padded at 512 bytes (widths no multiple of 4, odd heights) and at a tight 16-byte
  pitch, and 1920x1080.
- `WorkCounts`: `host_textures_in_place_written` (of `host_textures_in_place`, those a shader
  writes) and `host_texture_shadows_store_width` are new; `host_texture_shadows_shader_write` is now
  the subtotal of the shadows a shader writes, as `host_texture_shadows_render_target` is of those
  that render. The rebind of a texture in fresh pages asks every access its image's usage takes.

Tests: the decision test covers every usage, texel width and combination of the three accesses'
verdicts, and the order in which they are asked; the cause words and the record of nine verdicts.
Lanes: in_place_textures gains `written_textures_over_host_pages_take_the_path_their_checks_answered`
(64x64 `RGBA16Float` at 1024 and 512 bytes, 61x64 at 496, signaling-NaN halves beside the texels:
in place exactly where `Pointer writes` passed, a kernel's writes reaching the pages, every other
byte kept), and `textures_that_render_or_write_take_the_path_their_checks_answered` replaces the
test that counted every written texture a shadow; no_copy_textures and pitched_surfaces take a
written texture in place where its texels are 4, 8 or 16 bytes.

Docs: in_place.rs, in_place_check.rs, the policy's docs, API.md (the in-place paragraph, the
shadow paragraph, the `shadowed-texture` notice), HOWTO.md, the runtime README and FAST-PATHS.md's
in-place row and host-pages bullet.

(cherry picked from commit c3ffb08376251b87e16b7b417b39f1458e271085)
2026-11-07 13:24:33 -08:00
..