fix(agc): accept a CB metadata pass whose depth test passes every fragment without writing #4861

Merged
Tamalero merged 1 commit from upstream-pr/4861 into main 2026-10-14 01:46:14 +00:00
Tamalero commented 2026-10-13 00:29:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Tamalero on 2026-10-13T00:29:07Z.


What

DecodeColorMetadataPass refuses an eliminate-fast-clear or DCC-decompress pass when any of the low four bits of DB_DEPTH_CONTROL is set while depth or stencil planes are bound. #4076 accepts the pass when no planes are bound; this PR covers the case where planes are bound.

Marvel's Guardians of the Galaxy (PPSA01748) issues such a pass with the Z test on, ZFUNC ALWAYS and no Z write (DB_DEPTH_CONTROL 0x72), while a Z32 and an S8 target are bound. That test passes every fragment and leaves depth unchanged, so the pass does no depth work. Draws already treat this state as a pass-through (depthPassThrough), and the metadata pass now uses the same rule.

Still refused:

  • depth bounds;
  • depth writes;
  • stencil tests;
  • DB_RENDER_CONTROL clears and copies.

The error now names DB_DEPTH_CONTROL, DB_RENDER_CONTROL, DB_Z_INFO and DB_STENCIL_INFO, so the next refusal can be read from a log. DB_DEPTH_CONTROL and DB_RENDER_CONTROL are only read when planes are bound, as before.

Tested

Linux (CachyOS), GCC 16, RTX 4090, Release, on main 1c5e62878:

  • agc_driver_graphics: metadataPassTests gains three cases with Z and S8 planes bound. 0x72 is accepted; 0x76 (adds a Z write) and 0x7a (adds depth bounds) are refused. With main's State.cpp the test fails with CB metadata pass with depth or stencil work; with the change it passes.
  • Guardians of the Galaxy (PPSA01748): without this change the title stops about 71 s in, at its loading screen, with this refusal (captured registers: DB_DEPTH_CONTROL 0x72, DB_RENDER_CONTROL 0). With it, the title gets past the loading screen to its first UI. That run also carries #757, #758 and the blend bypass PR.
  • tools/check_conventions.py --base origin/main: passes.

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
  • 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
  • Unblocks: PPSA01748 (no bring-up discussion yet)
  • AI-assisted: yes

Tested and written by Claude (AI assistant) on a contributor's machine.

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4836626576 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4861). Originally posted by [Tamalero](https://github.com/Tamalero) on 2026-10-13T00:29:07Z. --- ### What `DecodeColorMetadataPass` refuses an eliminate-fast-clear or DCC-decompress pass when any of the low four bits of `DB_DEPTH_CONTROL` is set while depth or stencil planes are bound. #4076 accepts the pass when no planes are bound; this PR covers the case where planes are bound. Marvel's Guardians of the Galaxy (PPSA01748) issues such a pass with the Z test on, ZFUNC ALWAYS and no Z write (`DB_DEPTH_CONTROL` 0x72), while a Z32 and an S8 target are bound. That test passes every fragment and leaves depth unchanged, so the pass does no depth work. Draws already treat this state as a pass-through (`depthPassThrough`), and the metadata pass now uses the same rule. Still refused: - depth bounds; - depth writes; - stencil tests; - `DB_RENDER_CONTROL` clears and copies. The error now names `DB_DEPTH_CONTROL`, `DB_RENDER_CONTROL`, `DB_Z_INFO` and `DB_STENCIL_INFO`, so the next refusal can be read from a log. `DB_DEPTH_CONTROL` and `DB_RENDER_CONTROL` are only read when planes are bound, as before. ### Tested Linux (CachyOS), GCC 16, RTX 4090, Release, on `main` 1c5e62878: - **`agc_driver_graphics`:** `metadataPassTests` gains three cases with Z and S8 planes bound. 0x72 is accepted; 0x76 (adds a Z write) and 0x7a (adds depth bounds) are refused. With `main`'s `State.cpp` the test fails with `CB metadata pass with depth or stencil work`; with the change it passes. - **Guardians of the Galaxy (PPSA01748):** without this change the title stops about 71 s in, at its loading screen, with this refusal (captured registers: `DB_DEPTH_CONTROL` 0x72, `DB_RENDER_CONTROL` 0). With it, the title gets past the loading screen to its first UI. That run also carries #757, #758 and the blend bypass PR. - **`tools/check_conventions.py --base origin/main`:** passes. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Unblocks: PPSA01748 (no bring-up discussion yet) - [x] AI-assisted: yes *Tested and written by Claude (AI assistant) on a contributor's machine.* 🤖 Generated with [Claude Code](https://claude.com/claude-code)
kr4y4 commented 2026-10-13 03:15:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by kr4y4 on 2026-10-13T03:15:13Z.


A Windows and Intel run, since the description covers Linux on an RTX 4090.

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 b90ec1ed4 merged into main 495bf91a0, which passes 1023 of 1023 on both GPUs.

  • agc_driver_graphics passes on both GPUs with --repeat until-fail:3. The full suite (ctest --timeout 120 --parallel 4) passes 1023 of 1023 on both.
  • With State.cpp as on main, agc_driver_graphics fails on both GPUs with CB metadata pass with depth or stencil work, as in the description.

Written with AI assistance.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6137394591 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4861#issuecomment-6137394591). Originally posted by [kr4y4](https://github.com/kr4y4) on 2026-10-13T03:15:13Z. --- A Windows and Intel run, since the description covers Linux on an RTX 4090. 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 b90ec1ed4 merged into `main` 495bf91a0, which passes 1023 of 1023 on both GPUs. - `agc_driver_graphics` passes on both GPUs with `--repeat until-fail:3`. The full suite (`ctest --timeout 120 --parallel 4`) passes 1023 of 1023 on both. - With `State.cpp` as on `main`, `agc_driver_graphics` fails on both GPUs with `CB metadata pass with depth or stencil work`, as in the description. Written with AI assistance.
blawesom commented 2026-10-13 18:05:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-13T18:05:22Z.


Rebase handoff — rebased onto current main, authorship unchanged.

One semantic conflict in State.cpp, resolved with both sides' intent: this PR's refined depth-work acceptance (a depth test that passes every fragment without writing no longer rejects the CB metadata pass, with the enriched register-values error message for real failures) is kept, and main's newer rasterizerSamples gating on the resolve-path sample count is kept alongside it.

Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, BUILD_TESTING=ON, AMD RX 9070 XT / RADV):

  • builds; tools/check_conventions.py --base origin/main passes
  • full suite: 1070/1071 — the only failure is the known main regression (agc_driver_tessellation, #4727)

To pick it up:

git fetch https://github.com/blawesom/AnyPS5 rebase/4861
git checkout <your branch>
git merge --ff-only FETCH_HEAD

Head is 8d302082c.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6151971038 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4861#issuecomment-6151971038). Originally posted by [blawesom](https://github.com/blawesom) on 2026-10-13T18:05:22Z. --- **Rebase handoff** — rebased onto current `main`, authorship unchanged. One semantic conflict in `State.cpp`, resolved with both sides' intent: this PR's refined depth-work acceptance (a depth test that passes every fragment without writing no longer rejects the CB metadata pass, with the enriched register-values error message for real failures) is kept, and main's newer `rasterizerSamples` gating on the resolve-path sample count is kept alongside it. Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, `BUILD_TESTING=ON`, AMD RX 9070 XT / RADV): - builds; `tools/check_conventions.py --base origin/main` passes - **full suite: 1070/1071** — the only failure is the known `main` regression (`agc_driver_tessellation`, #4727) **To pick it up:** ``` git fetch https://github.com/blawesom/AnyPS5 rebase/4861 git checkout <your branch> git merge --ff-only FETCH_HEAD ``` Head is `8d302082c`.
oneandonlydean commented 2026-10-14 01:20:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T01:20:18Z.


Rebased onto main to resolve the conflict in core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp after #2121; no other change.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6158736776 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4861#issuecomment-6158736776). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-14T01:20:18Z. --- Rebased onto main to resolve the conflict in `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp` after #2121; no other change.
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!4861
No description provided.