RUNTIME 2337: A pass's first draw that samples a color the pass clears reads its copy cleared to the clear, with no barrier too

A draw that samples a texture its own pass renders reads the texture's shadow, a copy taken
before the pass's load actions (texture/attached_reads.rs). In a pass that clears the color, a
first draw that sampled it with no barrier read the texels from before the pass at every pixel it
read: the M3 Max's answer, while both x86 Macs read the clear there (probe ownread: no draw
before it, so the load and the draws before it wrote only the clear). The copy was cleared to the
clear (Texture::cleared_copy, vkCmdClearColorImage) only after a memory barrier before the pass's
first draw.

The Macs disagree, so Metal's answer is either; the macOS guests are x86 ones, and a clear of the
copy costs less than a copy of the texture. RenderLowering's draw now takes the cleared copy for
every draw that samples a color the pass clears before any draw of the pass recorded, wherever
Texture::cleared_copy holds (a whole single-sampled 2D texture of one level and slice that one
color renders in place), with a barrier before it or none; the draw keeps nothing to draw again,
as after the barrier. A pass that loads the color, and every read outside cleared_copy, read as
before.

Tests: attachment_reads' no-barrier lane becomes a_first_draw_with_no_barrier_reads_its_pass_s_load,
Load and Clear over both target kinds, the texture of its own image taking the cleared copy
(attachment_read_clears) and reading the clear where the pass clears; check() counts a cleared
copy as taking no split's place with no barrier. framebuffer_fetch gains
a_first_fetch_after_a_clear_reads_the_clear (a fetch after a Clear reads the clear, not the texels
from before the pass). The conformance rows pass-start-barrier-*-sample with no barrier accept the
clear too, as the -read rows did. docs/API.md's accepted differences and attached_reads.rs's docs
say which Macs answer what.

Verification: the jobs that compile and run it are reported with this sha.

With: 645f1c3323 snapshot_reads' first test makes its readers' pipelines before the counted pass; af0a44cc6d The render lanes and inline-split tests read their fixtures where the test runner names the crate; 8b5cd6dfb4 attachment_reads' first-draw lane lets a target over a buffer's bytes take the cleared copy too (test-only).

The user's GitHub issue 17. Compiled in m3-max-31319 at 8b5cd6dfb4 (clippy x3; lavapipe lanes, the first-draw lane, the
fetch-after-clear lane, the 14 pass-start-barrier conformance rows exact and default; the negative fails).
This commit is contained in:
Anees Iqbal committed 2026-11-14 22:00:02 -08:00
1 parent 86d50ef800
commit 5fcd8be7de
14 files changed
+237 -109

No files matched your search

+8 -1
View File
@@ -5513,7 +5513,8 @@ each item named states the rule in full.
pass's first instance, where the copy can be so (`WorkCounts::attachment_read_clears`), else
an instance after one of the clear alone. With no
barrier a draw reads at its own pixel what the draws before it wrote where the runtime takes no
copy for it, else the texels from before the pass, the M3 Max's answer (below). The
copy for it; else, before any draw of a pass that clears the color, the clear where its copy can
be cleared to it, and otherwise the texels from before the pass, the M3 Max's answer (below). The
conformance cases `pass-start-barrier-*` keep the M3 Max's texels and take the Mac2 answer as
the one other, and their rows that read at their own pixels with no barrier the clear (below).
- **A draw that reads its own pass's color attachment at its own pixels reads what the draws
@@ -5537,6 +5538,12 @@ each item named states the rule in full.
large scissors alone (`WorkCounts::reading_draws_snapshotted`). On a Radeon 780M a
compositor's frame of six such readers over surfaces took 3.41 ms of GPU time against 4.07
with the copies;
- a draw before any draw of a pass that clears the color reads a copy cleared to the clear,
where the copy can be so (`Texture::cleared_copy`: a whole single-sampled 2D texture of one
level and slice that one color renders in place; `WorkCounts::attachment_read_clears`): what
both x86 Macs read at such a draw's pixels, as the load and no draw before it wrote only the
clear there, the answer x86 macOS guests are written against, and a clear of the copy costs
less than a copy of the texture;
- every other such draw reads a copy taken before the pass, the M3 Max's answer: a private
texture's reader through small scissors, and every reader on lavapipe (which has
rasterization-order access) or on a device without the interlock, such as the Radeon RX 550