Skip to content

fix(agc): skip a pixel program whose color masks reach no formatted target - #21747

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
ashwin280802:fix/agc-pixel-skip-unbound-targets
Nov 19, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
ashwin280802:fix/agc-pixel-skip-unbound-targets

Conversation

@ashwin280802

Copy link
Copy Markdown
Contributor

What

PixelProgramSkipped compared the raw CB_TARGET_MASK and CB_SHADER_MASK. Both reset to all channels, so a draw with no formatted color target and no DB export or execution enable still ran its bound pixel program, and a rect-list draw of one with a pass-through input threw "custom per-vertex interpolation is unsupported". The check now uses ColorWriteMask, which leaves out the channels of targets whose CB_COLORn_INFO has no format, as DecodeState already does for hasColorTarget.

The change that starts the color masks at their reset values (fix(agc): start the color masks and viewport control at their reset values) exposed this: before it the masks started at 0 and such a draw used the null pixel program. Nine existing test setups enabled the masks on the reset context, which has no formatted target, only to make a pixel program run; seven now set a CB_COLOR0_INFO format and the two draws that go through the device set EXEC_ON_NOOP.

Sources: PAL DbShaderControl, GFX10 registers, radeonsi, which expects FORMAT INVALID to disable an unbound color buffer's writes; it does not say the pixel program is skipped. Not measured on the console: a mask on a FORMAT 0 target, and DB_ALPHA_TO_MASK (which always keeps the program); both are in the library's debt file.

Overlap: python tools/pr_overlap.py --names PixelProgramSkipped,ColorWriteMask reports open: none. The branch check found 68 open PRs sharing files with this branch and could not compare 37 of them; none was checked by hand, so I do not claim there is no overlap.

Tested

Windows 11, RTX 5070 (driver 621.24). The full suites, validation and title runs below were on bec1751a93, the same patch before its rebase onto current main; the 36 focused tests were run again after the rebase (e136e1a375) and pass.

  • ctest --test-dir build-full -R <the 36 AGC graphics, prepared graphics, prepared shaders, builtin program memory and unregistered graphics tests>: 100% tests passed out of 36.
  • Vulkan validation layer loaded, same 36 tests compared with a build of main c53d8bb: diagnostics: change 0, baseline 0, new 0.
  • Full Windows suite: 5756 tests, 5728 passed, 0 failed, 28 skipped. One test, agc_driver_upload_cache_read_only_flush_tests, does not build (UploadCacheReadOnlyFlush.cpp:177 setenv; the file is identical on main and untouched here), so it did not run.
  • Full Linux suite (container): 5636 tests, 5461 passed, 166 skipped, 9 failed (agc_draw_input_mirrors, agc_draw_input_reuse, agc_driver_coherent_atomic_loads_enabled, agc_driver_global_atomic_csub, agc_driver_recorder, agc_driver_stencil_copy_draw, title_run, title_run_identity, title_run_paths). The author's container also fails these 9 at main c53d8bb.
  • Title PPSA09259: on main the run aborts with driver failure: Rect-list SPIR-V: custom per-vertex interpolation is unsupported after 39 s; with this change a 180 s run ends by the time limit with 0 FATAL, driver failure or presentation failed lines and 12 present windows. Both runs used libraries built from main c53d8bb (the second with this State.cpp change) and an executable relinked at 8c33c148c3f.
  • python3 tools/check_conventions.py --base origin/main: All conventions checks passed.
  • I flipped the two operators of the changed condition one at a time; the tests failed on both.
100% tests passed out of 36
RESULT: PASS
layer: loaded
diagnostics: change 0, baseline 0, new 0
All conventions checks passed.

Not covered by a test: the rect-list draw with a pass-through pixel input that showed the problem; the tests cover PixelProgramSkipped and DrawRejection, and the draw path is covered only by the title run.
Not verified: the 9 Linux failures above were not investigated beyond matching main; behaviour on a console; other GPU vendors.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt and the licence notice of code adapted from upstream (see AGENTS.md)
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: PPSA09259 (no discussion number recorded)
  • GPUs tested: NVIDIA GeForce RTX 5070, driver 621.24, Windows 11
  • AI-assisted: yes

🤖 Generated with Claude Code

…arget

PixelProgramSkipped compared the raw CB_TARGET_MASK and CB_SHADER_MASK.
Since both reset to all channels, a draw with no formatted color target
and no DB export or execution enable ran its bound pixel program, and a
rect-list draw of one with a pass-through input threw "custom per-vertex
interpolation is unsupported". The check now uses ColorWriteMask, which
leaves out the channels of targets whose CB_COLORn_INFO has no format,
as DecodeState already does for hasColorTarget.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@github-actions github-actions Bot added unblocks title Names a title ID on the Unblocks line docs agc libSceAgc* review queue Next in the maintainer review queue: checks pass, no open change request, no conflict labels Nov 16, 2026
@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 1395 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 4040 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 5925 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6188 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 6235 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6280 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6481 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6804 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6808 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 7085 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 7256 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 7642 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/libs/prx/libSceAgcDriver/tests/execution/PreparedGraphics.cpp
core/libs/prx/libSceAgcDriver/tests/execution/PreparedShaders.cpp
PR 8246 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 9356 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 9387 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 9508 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/libs/prx/libSceAgcDriver/tests/execution/PreparedGraphics.cpp
core/libs/prx/libSceAgcDriver/tests/execution/PreparedShaders.cpp
PR 9563 core/libs/prx/libSceAgcDriver/tests/execution/PreparedShaders.cpp
PR 9712 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 9895 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 10193 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/libs/prx/libSceAgcDriver/tests/execution/PreparedGraphics.cpp
core/libs/prx/libSceAgcDriver/tests/execution/PreparedShaders.cpp
PR 10249 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 10351 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 11551 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 11825 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 13928 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/libs/prx/libSceAgcDriver/tests/execution/PreparedGraphics.cpp
core/libs/prx/libSceAgcDriver/tests/execution/PreparedShaders.cpp
PR 13929 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/libs/prx/libSceAgcDriver/tests/execution/PreparedGraphics.cpp
core/libs/prx/libSceAgcDriver/tests/execution/PreparedShaders.cpp
PR 14032 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 14944 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 15499 core/libs/prx/libSceAgcDriver/tests/execution/PreparedShaders.cpp
PR 15548 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 15570 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 17611 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 20315 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 20845 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 22687 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 22692 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/libs/prx/libSceAgcDriver/tests/execution/PreparedGraphics.cpp
core/libs/prx/libSceAgcDriver/tests/execution/PreparedShaders.cpp
PR 23229 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp

@domx4q

domx4q commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Ran the graphics and prepared-shader set with the Khronos validation layer on NVIDIA's proprietary Linux driver, since the PR's GPU run was on Windows.

Setup: Arch Linux (kernel 7.3.4), GCC 16.2.1, Release, NVIDIA GeForce RTX 4090 (vendor 0x10de, device 0x2684, Ada), proprietary driver 620.70.06, Vulkan 1.4.357, Khronos validation layer 1.4.363.1. Head 0ae7f5c275 merged onto main 89b0eef7ab with --no-ff, clean merge. Main baseline is a Release build of 89b0eef7ab on the same machine.

ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer \
ctest --test-dir build -R '^agc_driver_(graphics|builtin_program_memory|prepared_(graphics|shaders|unregistered_graphics).*)$' -V
main 89b0eef7ab this PR
Result 33 passed (33) 33 passed (33)
Insert instance layer "VK_LAYER_KHRONOS_validation" 63 63
was not found but was requested by env var VK_INSTANCE_LAYERS 0 0
VUID- none none

The set covers agc_driver_graphics with the new case and the changed agc_driver_builtin_program_memory, agc_driver_prepared_graphics*, agc_driver_prepared_shaders* and agc_driver_prepared_unregistered_graphics tests; all pass. It is my pattern for the Tested section's 36 tests, which the description does not list. Every device selection picked the RTX 4090.

No new VUID- errors; all focused tests pass on Ada.

AI-assisted: yes (Claude Code)

@mattiolocoding mattiolocoding left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed — no blocking findings

Nothing blocks this. The head is 0ae7f5c275386743b2d68ef5d4ab13a5c705a903.

What I ran

  • Read the full diff for head 0ae7f5c275386743b2d68ef5d4ab13a5c705a903: State.cpp, test updates in Graphics.cpp, BuiltinProgramMemory.cpp, PreparedGraphics.cpp, PreparedShaders.cpp, PreparedUnregisteredGraphics.cpp, and docs/dev/debt/changes/fix-agc-pixel-skip-unbound-targets.md.
  • Traced ColorWriteMask(cx) against AMD GFX10 register architecture: verifying channel masking against CB_COLORn_INFO format field ((info->second >> 2u) & 0x1fu).
  • Verified register guard ordering in PixelProgramSkipped: find(cx, 0x8e) and find(cx, 0x8f) check for presence before ColorWriteMask(cx) invokes read(cx, 0x8e) & read(cx, 0x8f), preventing std::runtime_error exceptions on unpopulated context states.
  • Audited test fixtures: verified that existing tests that relied on reset-context color masks correctly specify CB_COLOR0_INFO format or EXEC_ON_NOOP (0x203 = 0x400) to preserve intentional execution.

Results

Check Result Note
Logic audit passed ColorWriteMask(cx) == 0 correctly accounts for unbound targets where raw masks were non-zero
Diff audit passed Clean diff, consistent formatting, conventions respected
Technical debt passed Documented under docs/dev/debt/changes/ with proper register references

Findings

Blocking

None.

Non-blocking

None. The integration is clean, correctly handles all 8 color target slots, and appropriately accounts for PixelStageRunsMask and EXEC_ON_NOOP.

Sources

  • core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp lines 2350–2359 (ColorWriteMask) and 2855–2865 (PixelProgramSkipped).
  • core/libs/prx/libSceAgcDriver/tests/Graphics.cpp lines 328–350.
  • docs/dev/debt/changes/fix-agc-pixel-skip-unbound-targets.md.

AI-assisted: yes

@Colewiz7

Copy link
Copy Markdown
Contributor

Head 0ae7f5c275 merged onto main db68035f8b as 434e4f0d82, no conflict. Linux 7.3.4, GCC 16.2.1 Release, Mesa 26.2.6 RADV, RX 7900 XT (gfx1100) and 7800X3D iGPU (gfx1036).

No new failures and no new validation messages on either GPU.

RX 7900 XT iGPU
full suite (6018 tests), new failures vs main none none
-R '^agc' (1931 tests) with the layer, new failures vs main none none
VUID- / SYNC-HAZARD lines 0 / 0 0 / 0

Layer runs used VK_LAYER_KHRONOS_validation 1.4.363 with VK_LOADER_DEBUG=layer and ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1; the loader inserted the layer in every run, and the Undefined-Value-* warning set matches main. In the full suite, the failures both trees share are agc_driver_host_write_shadowed_unit (#21900), agc_driver_image_table_packed_guards (#22512) and, on the 7900 XT, agc_driver_pixel_interlock (#18770).

AI-assisted: yes

@eaglescoutmaster

Copy link
Copy Markdown
Contributor

RTX 5080 Windows run of head 0ae7f5c275.

  • 33 tests (the graphics, prepared graphics, prepared shaders, builtin program memory and unregistered graphics cases), 3 runs per side: 99 of 99 on main, 99 of 99 with the PR.
  • The 51 runnable cases of agc_driver_graphics_tests, 1 run per side: same pass set, no failures.
  • Not run: agc_driver_prepared_shaders_abi_deferred_vertex_inputs.

Setup: base main afe88d44ad, the PR diff applied with git apply (clean), only the affected targets rebuilt. Windows 11 Pro build 26300, Intel Core i9-14900K, NVIDIA GeForce RTX 5080 (10de:2c02), driver 617.14, Vulkan API 1.4.351, WinLibs GCC 15.2.0 r7, Release. ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, ANYPS5_GPU=RTX 5080. No validation layer installed, so no VUID- check. Another application was using the GPU during the runs.

AI-assisted: yes (Claude Code)

@oneandonlydean
oneandonlydean merged commit af1b2c2 into boykopovar:main Nov 19, 2026
14 checks passed
@github-actions github-actions Bot removed the review queue Next in the maintainer review queue: checks pass, no open change request, no conflict label Nov 19, 2026
B-Howell added a commit to B-Howell/AnyPS5 that referenced this pull request Nov 20, 2026
Since boykopovar#21747, PixelProgramSkipped also needs a color target with a
format, so without CB_COLOR0_INFO the fixture's pixel program decoded
as the null program.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* docs unblocks title Names a title ID on the Unblocks line

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants