Files
metal2vulkan/docs
Anees Iqbal 37875af7f3 Weigh a self-read's split by the texels its copy moves
The area rule (render/snapshot.rs) weighed the split as a copy of every texel of the color's
level. The split's copy for a draw that reads at its own pixels is cut: for a one-level,
one-slice color it moves only the texels inside the rectangle bounding the draw's scissors, a
pixel wider each way (render.rs's bound_own_pixel_reads, ShadowCopies::cuts). So the rule
overstated the split for readers through scissors smaller than the target, and since 61a367cb51
those took the snapshot where the split was the cheaper worst case: on the snapshot_crossover
lane's 1920x1080 private target, readers through 960x540 and 1280x720 scissors covering them
whole took up to 1.93x and 1.97x their split time on the Radeon 780M, and 1.32x and 1.41x on the
RX 7900 XTX (jobs 6872, 6871 against their own before runs).

The rule now weighs the split by what its copy moves, computed by the same two functions the copy
bound uses, now shared (scissors_bound, own_pixel_loads): a one-level, one-slice color's texels
around the scissors, else every texel of the level, as before. A reader through no scissor, the
consumer's self-reads, weighs as before and keeps the snapshot. By the rule a 4-byte color's
reader takes the snapshot through scissors whose rectangle holds about 786,432 pixels (1024x768)
or more and splits through smaller ones: on the crossover's target, 320x180 and 960x540 split,
1280x720 and the whole target snapshot.

Tests that relied on a small reader taking the snapshot now draw through scissors large enough:
- runtime_lane::snapshot_reads: a 1024x1024 target, the readers through the whole target's
  scissor (snapshot where the device takes the path); through QUARTER an RGBA8Unorm reader splits
  and an RGBA16Float one takes the snapshot; R8Unorm and RG8Unorm readers split; the
  feature-withheld and depth/stencil readers through the whole target, so their split is the
  feature's or the attachment's, not the rule's.
- tests::self_read_storage: a 1024x1024 target, the reader through no scissor.
- tests::snapshot_area: 8x8 scissors (copy of 10x10 texels): 4-byte split, 8-byte snapshot;
  960x540 split and 1280x720 snapshot over 1920x1080.
- attachment_read_costs: the composite workload's window readers split again; its docs say so.

docs/FAST-PATHS.md's attachment-read paragraph and the module docs carry the landed
snapshot_area_costs lane's numbers (rule against the split with fragmentShaderPixelInterlock
withheld): reader over 1.5% / the whole target, Radeon 780M 0.08-0.23x / 1.8-2.3x (job 6872),
RX 7900 XTX 0.25-0.43x / 1.3-2.1x (6871).

(cherry picked from commit ed15457d04c98f767511374ff4d368a0373a4361)
2026-11-07 23:05:20 -08:00
..