fix(agc): accept reported vertex stage state #4341

Merged
MarcZX10 merged 2 commits from upstream-pr/4341 into main 2026-10-14 23:14:33 +00:00
MarcZX10 commented 2026-10-12 07:05:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-12T07:05:39Z.


What

Fixes #4329. Accepts the exact reported VGT_SHADER_STAGES_EN=0x02002008 state on the existing vertex path. Other vertex routing states retain the current mask and validation.

Tested

Linux Release, GCC 12.2.0, Ninja:

  • Built agc_driver_graphics_tests from a clean current-main worktree.
  • agc_driver_graphics_tests passes, including the exact reported state and neighboring invalid encodings.
  • python3 tools/check_conventions.py --base upstream/main passes.
  • git diff --check passes.

The local graphics validation suite runs on llvmpipe; no Wobbly Life title or discrete GPU run was available.

Checklist

  • Based on current main; no other open PR implements the same change
  • One topic per PR
  • No comments in code except technical debt
  • No notes or investigation files added to the repository
  • Generic behavior
  • Depends on: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4826052405 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4341). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-12T07:05:39Z. --- ### What Fixes #4329. Accepts the exact reported `VGT_SHADER_STAGES_EN=0x02002008` state on the existing vertex path. Other vertex routing states retain the current mask and validation. ### Tested Linux Release, GCC 12.2.0, Ninja: - Built `agc_driver_graphics_tests` from a clean current-main worktree. - `agc_driver_graphics_tests` passes, including the exact reported state and neighboring invalid encodings. - `python3 tools/check_conventions.py --base upstream/main` passes. - `git diff --check` passes. The local graphics validation suite runs on llvmpipe; no Wobbly Life title or discrete GPU run was available. ### Checklist - [x] Based on current `main`; no other open PR implements the same change - [x] One topic per PR - [x] No comments in code except technical debt - [x] No notes or investigation files added to the repository - [x] Generic behavior - [x] Depends on: none - [x] AI-assisted: yes
exefer commented 2026-10-12 08:20:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by exefer on 2026-10-12T08:20:23Z.


Tested with #4328 alongside on Wobbly Life (PPSA29413, Linux (CachyOS), GCC 16.2.1, Intel i5-12400 + NVIDIA RTX 3060 Ti (615.71.09), current main plus both PRs, stock build plus relink): the VGT_SHADER_STAGES_EN=0x2002008 abort from #4329 is gone in 5 runs, played and unplayed. New endpoints past it: 2x compute-shader depth/stencil storage abort when opening the map, 1x segfault after storage image destroyed with GPU results pending warnings, 1x std::__ios_failure during teardown, 1x killed by me mid-run.

Map abort matches open #1409.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6120463551 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4341#issuecomment-6120463551). Originally posted by [exefer](https://github.com/exefer) on 2026-10-12T08:20:23Z. --- Tested with #4328 alongside on Wobbly Life (PPSA29413, Linux (CachyOS), GCC 16.2.1, Intel i5-12400 + NVIDIA RTX 3060 Ti (615.71.09), current `main` plus both PRs, stock build plus relink): the `VGT_SHADER_STAGES_EN=0x2002008` abort from #4329 is gone in 5 runs, played and unplayed. New endpoints past it: 2x compute-shader depth/stencil storage abort when opening the map, 1x segfault after `storage image destroyed with GPU results pending` warnings, 1x `std::__ios_failure` during teardown, 1x killed by me mid-run. Map abort matches open #1409.
kr4y4 commented 2026-10-12 21:00:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by kr4y4 on 2026-10-12T21:00:38Z.


Windows run on two GPUs, since the description's run was on llvmpipe.

Setup: Windows 11 (26200), WinLibs GCC 15.2.0 r7, Release, CI configure flags, an RTX 4070 Laptop GPU and an Intel Raptor Lake-S iGPU. The head 632331d1a merged into main 42496c5e5.

  • On the RTX 4070, agc_driver_graphics passes with --repeat until-fail:3. On the iGPU one run failed after 0.17 s with write-watched arena contained no host exclusion to test. That check depends on the process's address layout and also fails on main (#4660, #4746). It passed on the iGPU in the full-suite run.
  • With main's State.cpp and the new checks, agc_driver_graphics fails on both GPUs: VGT_SHADER_STAGES_EN=0x2002008: unsupported vertex routing, scheduling or wave-ID state.
  • Full suite (ctest --timeout 120 --parallel 4): 1007 of 1007 on both GPUs.

Written with AI assistance.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6132526501 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4341#issuecomment-6132526501). Originally posted by [kr4y4](https://github.com/kr4y4) on 2026-10-12T21:00:38Z. --- Windows run on two GPUs, since the description's run was on llvmpipe. Setup: Windows 11 (26200), WinLibs GCC 15.2.0 r7, Release, CI configure flags, an RTX 4070 Laptop GPU and an Intel Raptor Lake-S iGPU. The head 632331d1a merged into `main` 42496c5e5. - On the RTX 4070, `agc_driver_graphics` passes with `--repeat until-fail:3`. On the iGPU one run failed after 0.17 s with `write-watched arena contained no host exclusion to test`. That check depends on the process's address layout and also fails on `main` (#4660, #4746). It passed on the iGPU in the full-suite run. - With `main`'s `State.cpp` and the new checks, `agc_driver_graphics` fails on both GPUs: `VGT_SHADER_STAGES_EN=0x2002008: unsupported vertex routing, scheduling or wave-ID state`. - Full suite (`ctest --timeout 120 --parallel 4`): 1007 of 1007 on both GPUs. Written with AI assistance.
oneandonlydean commented 2026-10-12 21:22:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-12T21:22:21Z.


State.cpp:569 accepts one literal value. What 0x02002008 adds to the accepted set is ES_EN=1 (bit 3) without HS_EN; please decode that field instead: say what ES_EN=1 selects on a non-patch draw and why the vertex path draws it correctly, and accept it with the other bits the mask already takes (wave32, the scheduling bits), or throw where it differs.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6132847187 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4341#issuecomment-6132847187). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-12T21:22:21Z. --- `State.cpp:569` accepts one literal value. What 0x02002008 adds to the accepted set is ES_EN=1 (bit 3) without HS_EN; please decode that field instead: say what ES_EN=1 selects on a non-patch draw and why the vertex path draws it correctly, and accept it with the other bits the mask already takes (wave32, the scheduling bits), or throw where it differs.
xXPBSXx commented 2026-10-12 23:24:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-12T23:24:48Z.


Windows test (MinGW GCC 15.2, Release, Windows 10, RTX 4080 SUPER). Built in a batch with five other open GPU PRs cherry-picked onto main 44ab0c39e (not current main, which needs a submodule that isn't checked out here), so only the tests that belong to this PR say anything about it:

  • tests/Graphics.cpp (agc_driver_graphics): see below.

agc_driver_graphics over the batch: 9 of 10 runs passed. The one failure is the known address-layout flake from #4660 as far as I can tell: I kept only the first lines of that run's log (the host import ... vkAllocateMemory (-2) lines, which appear in passing runs as well), not its final error message, so I can't confirm the cause for that one run. Plain main failed 2 of 10 on the same machine earlier.

Not tested: no game run; the batch was not rebuilt per PR, so a failure would have needed a bisect (there was none besides the flake).

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6134543712 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4341#issuecomment-6134543712). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-12T23:24:48Z. --- Windows test (MinGW GCC 15.2, Release, Windows 10, RTX 4080 SUPER). Built in a batch with five other open GPU PRs cherry-picked onto main `44ab0c39e` (not current main, which needs a submodule that isn't checked out here), so only the tests that belong to this PR say anything about it: - `tests/Graphics.cpp` (`agc_driver_graphics`): see below. `agc_driver_graphics` over the batch: 9 of 10 runs passed. The one failure is the known address-layout flake from #4660 as far as I can tell: I kept only the first lines of that run's log (the `host import ... vkAllocateMemory (-2)` lines, which appear in passing runs as well), not its final error message, so I can't confirm the cause for that one run. Plain `main` failed 2 of 10 on the same machine earlier. Not tested: no game run; the batch was not rebuilt per PR, so a failure would have needed a bisect (there was none besides the flake). AI-assisted (Claude Code).
MarcZX10 commented 2026-10-13 07:50:37 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-13T07:50:37Z.


I checked the field before widening the accepted mask. AMD’s CIK register reference calls ES_EN=1 ES_STAGE_DS and describes it as the ES acting as the DS shader for tessellation evaluation. That does not explain why this value appears on a non-patch draw, nor establish the behavior for the PS5 GPU. The exact-value regression shows the reported state reaches the vertex path, but it does not establish the stage semantics or justify accepting other combinations.

I do not have stronger source or hardware evidence for those points, so I have not generalized the mask or claimed that ES_EN=1 is generally safe for non-patch draws. The existing report is for 0x02002008 specifically.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6140912459 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4341#issuecomment-6140912459). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-13T07:50:37Z. --- I checked the field before widening the accepted mask. AMD’s [CIK register reference](https://www.amd.com/content/dam/amd/en/documents/radeon-tech-docs/programmer-references/CIK_3D_registers_v2.pdf) calls `ES_EN=1` `ES_STAGE_DS` and describes it as the ES acting as the DS shader for tessellation evaluation. That does not explain why this value appears on a non-patch draw, nor establish the behavior for the PS5 GPU. The exact-value regression shows the reported state reaches the vertex path, but it does not establish the stage semantics or justify accepting other combinations. I do not have stronger source or hardware evidence for those points, so I have not generalized the mask or claimed that `ES_EN=1` is generally safe for non-patch draws. The existing report is for `0x02002008` specifically.
oneandonlydean commented 2026-10-13 10:32:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-13T10:32:12Z.


Then keep the one value, but record it: a line in docs/dev/debt/libSceAgcDriver.md that VGT_SHADER_STAGES_EN 0x02002008 (ES_EN=1 without HS_EN on a non-patch draw) is drawn as the vertex path, seen only on PPSA29413 and not verified on the console.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6143602159 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4341#issuecomment-6143602159). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-13T10:32:12Z. --- Then keep the one value, but record it: a line in `docs/dev/debt/libSceAgcDriver.md` that `VGT_SHADER_STAGES_EN` 0x02002008 (ES_EN=1 without HS_EN on a non-patch draw) is drawn as the vertex path, seen only on PPSA29413 and not verified on the console.
oneandonlydean commented 2026-10-14 22:16:06 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T22:16:06Z.


Added the debt line for 0x02002008 (drawn as the vertex path, seen only on PPSA29413, not verified on the console), which was the open point from 10-13.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6179702099 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4341#issuecomment-6179702099). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-14T22:16:06Z. --- Added the debt line for 0x02002008 (drawn as the vertex path, seen only on PPSA29413, not verified on the console), which was the open point from 10-13.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!4341
No description provided.