Skip to content

shader: accept an unavailable debug layer in the attr0.z/w sampled draw - #1964

Merged
R0Y00 merged 1 commit into
R0Y00:mainfrom
alvaroolt:shader/attribute-sampled-debug-layer
Nov 24, 2026
Merged

R0Y00 merged 1 commit into
R0Y00:mainfrom
alvaroolt:shader/attribute-sampled-debug-layer

Conversation

@alvaroolt

Copy link
Copy Markdown
Contributor

Change

Follow-up to #1912. pixel_aot_attribute_sampled_hardware and pixel_aot_attribute_sampled_warp require the line debug_errors=0 debug_warnings=0 from every renderer run. offscreen_check prints those counts only when the D3D12 debug layer is enabled. Without the layer (Graphics Tools not installed) it prints debug_layer=unavailable and no counts, so both tests fail at the first draw on such a host even though the draw matches the reference exactly. The Windows CI job runs with debug_layer=enabled, so CI does not hit this.

tests/pixel_attribute_sampled_check.py now checks the debug layer through debug_status():

  • Layer enabled: both counts must be zero, as before.
  • Layer unavailable: the run is accepted only if it prints no counts.
  • Anything else (enabled without counts, no layer marker) is refused.

The per-draw line prints the status that was checked instead of always printing debug_errors=0 debug_warnings=0. This is the rule tests/pixel_cb_read_check.py already applies. The translator, the programs, the reference and the swapped-z/w controls are unchanged. One file changes.

Verification

Windows 11 build 26300.9974, D3D12 debug layer unavailable (Graphics Tools not installed), MSVC 19.52, DXC from SDK 10.0.26100.0. Adapters: NVIDIA GeForce RTX 5080 (driver 32.0.16.2124), AMD Radeon(TM) Graphics iGPU (driver 32.0.11034.2, selected with XBOX2WINDOWS_ADAPTER=Radeon) and WARP (10.0.26100.9818).

Before the change (upstream 6d0a788), the same failure on all three adapters:

ctest --preset dev --no-tests=error -R "^pixel_aot_attribute_sampled_" --output-on-failure
backend=warp debug_layer=unavailable
pixels=64 channels=256 max_absolute_error=0
AssertionError: whole_quad: unexpected result (exit 0)
0% tests passed, 2 tests failed out of 2      # RTX 5080 and WARP; the Radeon run fails the same way

After the change, GPU tests run serially. The two focused tests ran on the PR head, commit d28732b on main 11f11e8. The ^pixel_ group and the Python checks ran on the same commit one rebase earlier (320aa11 on 82f0db6), and the commits in between don't change this file or tests/offscreen_check.cpp:

ctest --preset dev --no-tests=error -R "^pixel_aot_attribute_sampled_" -V
whole_quad: exit=0 pixels=64 channels=256 max_absolute_error=0 debug_layer=unavailable
whole_quad swapped z/w: exit=1 pixel_mismatch x=1 y=0 debug_layer=unavailable
entry_lz: exit=0 pixels=64 channels=256 max_absolute_error=0 debug_layer=unavailable
entry_lz swapped z/w: exit=1 pixel_mismatch x=1 y=0 debug_layer=unavailable
whole_quad_bias: exit=0 pixels=64 channels=256 max_absolute_error=0 debug_layer=unavailable
whole_quad_bias swapped z/w: exit=1 pixel_mismatch x=1 y=0 debug_layer=unavailable
100% tests passed out of 2                    # RTX 5080 and WARP
100% tests passed out of 1                    # _hardware with XBOX2WINDOWS_ADAPTER=Radeon, same six lines

ctest --preset dev --no-tests=error -R "^pixel_"
100% tests passed out of 180                  # no skips

python -B tests/pixel_attribute_sampled_check.py
3 sampled attr0.z/w translations and their refusals checked
python -B tests/pixel_attribute_sampled_check.py binary <llvm-mc 15> <llvm-objcopy 15> <LLVM-C 15>
exit 0 (three programs, binary translation matches the source text)

The Python check list of the platform-independent CI job (69 files, through tools/run_checks_parallel.py) exits 0.

Full suites, on 6d0a788, three rebases earlier. The commits since then don't change this file:

ctest --preset dev --no-tests=error -j8       # 1185 passed, 27 skipped, 1 failed of 1213
ctest --preset release --no-tests=error -j8   # 1185 passed, 27 skipped, 1 failed of 1213

The 27 skips are the same capability skips in both configurations, and none is a pixel_aot_attribute_sampled_* test. The one failure is rdna2_tools_check in both configurations, caused by my shell environment: it had LLVM_LIB set without LLVM_MC/LLVM_OBJCOPY, and in that case the test fails by design. With none of the three set, and with all three pointing at LLVM 15, it passes in dev and release.

I could not run the draw with the debug layer enabled on this machine. That path keeps the previous requirement, and the pins below cover it without a device.

Negative controls

  • draw() pins debug_status() on six synthetic outputs before any device work: clean counts, unavailable layer, one error, two warnings, enabled without counts, no layer marker.
  • A mutant that returns "clean" for an enabled layer without reading the counts fails the pins: AssertionError: debug_status('backend=warp debug_layer=enabled\ndebug_errors=1 debug_warnings=0\n') is not None.
  • A mutant that accepts any output without counts fails them too: AssertionError: debug_status('backend=warp\n') is not None.
  • The swapped-z/w draws still mismatch at the predicted pixel (1, 0) on all three adapters.

Evidence and follow-up

No new fixture or input; the test keeps its source-built programs and its Fraction reference. No README or docs change: the reproduction command in docs/experiments.md is unchanged.

This change was AI-assisted (Claude Code); I reviewed the diff and the test results.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed. (No change needed.)
  • I did not include game files, dumps, distribution links or secrets.

pixel_aot_attribute_sampled_{hardware,warp} required the line
"debug_errors=0 debug_warnings=0" in every renderer run. offscreen_check
prints those counts only when the D3D12 debug layer is enabled; without
it (no Graphics Tools on the host) it prints debug_layer=unavailable and
no counts. Both tests therefore failed on such hosts at the first draw,
although the draw matched the reference exactly
(pixels=64 channels=256 max_absolute_error=0).

Add debug_status(): with the layer enabled both counts must be zero, as
before; with the layer unavailable the run is accepted only if it prints
no counts; any other output is refused. The per-draw line now prints the
status that was checked. draw() pins debug_status() on six synthetic
outputs (clean, unavailable, one error, two warnings, enabled without
counts, no layer marker) before any device work, so a version that
ignores the counts fails.

This follows the rule of tests/pixel_cb_read_check.py, which already
accepts debug_layer=unavailable.
@R0Y00
R0Y00 merged commit 889cd3f into R0Y00:main Nov 24, 2026
5 checks passed
@alvaroolt
alvaroolt deleted the shader/attribute-sampled-debug-layer branch November 24, 2026 22:26

@tedin7 tedin7 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review of head d28732b66d790be8314ccaba1af4622f7f357eaa (test-only change to tests/pixel_attribute_sampled_check.py, no CMake changes, clean-room).

The check now accepts debug_layer=unavailable (no counts) and still requires zero error and warning counts when the layer is enabled. The new in-test table covers the enabled/unavailable/missing cases.

Commands executed:

  • python3 -I tests/pixel_attribute_sampled_check.py (Linux): PASS
  • python3 tests/docs_links_check.py: PASS (18 files, 386 links)
  • python3 tests/bidi_controls_check.py: PASS
  • git diff --check origin/main...HEAD: PASS
  • git merge-tree --write-tree --name-only origin/main HEAD: no conflicts
  • python3 x2w_pipe.py win2025 1964 --wait 900 (Win2025, WARP): Debug pixel_aot_attribute_sampled_warp 1/1 passed; Release /O2 1/1 passed
  • CI: Windows build/test, Linux checks, gfx1013 fixtures all pass

Mutations (applied as a patch on Win2025, Debug):

  • Killed: accept an enabled layer with any debug_errors= text instead of exactly zero counts. The test fails with AssertionError: debug_status(...).
  • Survived (not blocking): drop the "no counts" requirement for debug_layer=unavailable. No table row covers "unavailable plus counts". A row such as backend=warp debug_layer=unavailable\ndebug_errors=1 debug_warnings=0\n -> None would close this.

P1: 0. P2: 0.

AI-assisted; commands listed were executed locally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants