Files
metal2vulkan/docs
Anees Iqbal 6575c031f5 In place: 1- and 2-byte texels a shader writes, checked apart by the device's check
In every guest session reims measured (Iris Xe and Radeon 780M, macOS 26.7.2 guests),
host_texture_shadows_store_width was 114, from 23 distinct R8Unorm, A8Unorm and R16 textures a
shader writes (32x32 at 256-byte rows among them). They were shadows because the in-place
check's write kernel stored only 4-, 8- and 16-byte texels (STORED_TEXEL_BYTES,
ShadowCause::StoreWidth), so no check covered a driver's writes of narrower ones.

What changes:
- in_place.rs (from selfread's parked 0c587bcad5): Access gains NarrowWrites and
  NarrowBufferWrites, with 36 verdicts instead of 24. Access::written picks the writes check of
  a texel width and padding. STORED_TEXEL_BYTES holds 1, 2, 4, 8 and 16; NARROW_TEXEL_BYTES
  holds 1 and 2. in_place asks the written check in place of Writes. The report names
  "narrow writes" and "narrow buffer writes". CHECK_VERSION goes to 9 (development's dma-buf
  import fix took 8).
- in_place_check.rs: NARROW_STORE_SHAPES, rounds of their own for the narrow accesses, through
  the copy-in kernel's R8_UINT and R16_UINT views (a801dac7d7). The shapes are packed R8 256x16
  and R16 128x16 at 256; R8 61x37 and R16 45x29 at 256, whose rows end inside a word and whose
  heights are odd; the 16- and 64-byte tight pitches; and an R8 1024x1024. The source buffer
  holds a word per texel, the texel's bytes low and zeros above, since CopyIn takes 4*words()
  bytes a texel. A narrow round's change fails only the narrow verdicts, never a 4/8/16-byte
  texture's. A device whose kernel or image is not made (no shaderStorageImageExtendedFormats)
  leaves them unchecked.
- in_place::storable: one helper for a render target's storage usage, used by route.rs and
  storage_form.rs. It asks Access::written(texel, Padding::Kept) instead of Writes, so a narrow
  render target never takes the 4-byte verdict. writes_reach (the storage usage an image that
  does not render takes beyond its usage) and fresh_pages_take ask the written check of the
  texels' width; InPlaceWatch carries the width.
- InPlaceAccess::Writes covers the narrow accesses. Docs (in_place, the check, API.md, HOWTO,
  FAST-PATHS row, runtime README, WorkCounts, HostPageTexturePolicy, TextureShadowReason) say
  1, 2, 4, 8 and 16 bytes, with narrow writes checked apart. The lane's VERDICTS goes to 36.

Tests:
- The decision test runs every width, 3 bytes for StoreWidth among them, against narrow answers
  that differ from their wide twins'. It also checks storable.
- Shape tests cover the narrow set: tight pitches, row ends at 16/64/128/256, free padding.
- New: each_check_of_storage_writes_stores_its_texels_width. A narrow tally case.
- New device test narrow_writes_device: the guest's 32x32 R8Unorm and A8Unorm (and RG8Unorm and
  R16Unorm) at 256-byte rows over a no-copy buffer. Each takes its narrow verdict's path, its
  placement query agrees, a kernel's writes reach the bytes, and the padding and the bytes past
  the last row are kept.
- in_place_storage adds an R8Unorm render target.

Verified: not yet built; the build, clippy, unit and device runs follow as jobs.
(cherry picked from commit dbb985df199b1c46bb783aafbd50efd40bcab187)
2026-11-08 01:47:31 -08:00
..