fix(agc): ignore stale depth clear flags when no planes are bound #5855

Merged
tototomate123 merged 1 commit from upstream-pr/5855 into main 2026-10-15 21:01:16 +00:00
tototomate123 commented 2026-10-14 13:52:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by tototomate123 on 2026-10-14T13:52:26Z.


What

HFW (PPSA01521) retains DB_RENDER_CONTROL clear bits during color-only draws with both depth/stencil planes disabled. Current main enters depth decoding anyway and throws depth clear requires a writable depth plane before the loading screen.

Decode depth only when a depth/stencil surface is bound, and apply the precheck's writable-plane requirements only when a plane exists. Clears on existing read-only or missing individual planes still reject. Regression cases cover depth, stencil and combined stale flags without changing color writes or viewport depth.

Tested

Linux x86-64, GCC/G++, Release: built and ran agc_driver_graphics_tests; conventions and whitespace checks pass. Existing writable-depth/stencil rejection checks remain active. Guest-arena/host-import checks that require the unavailable arena were skipped by the suite.

The failure was observed in the user's HFW run on an RTX 4070 SUPER. This environment cannot expose a GPU, so no controlled hardware run is claimed. This fixes the stale-clear startup failure, not the separate 60-second guest-allocation pin timeout or all later loading failures.

Checklist

  • Based on current main; no other open PR found implementing this stale-clear handling
  • One topic per PR
  • No code comments added
  • Unsupported active clear paths still throw
  • No investigation files or images added
  • No new third-party code
  • Generic behavior
  • Depends on: none
  • Unblocks: PPSA01521 startup depth-clear stop; Game bring-up discussion not provided
  • GPUs tested: none in this environment
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4858951590 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5855). Originally posted by [tototomate123](https://github.com/tototomate123) on 2026-10-14T13:52:26Z. --- ### What HFW (PPSA01521) retains DB_RENDER_CONTROL clear bits during color-only draws with both depth/stencil planes disabled. Current main enters depth decoding anyway and throws `depth clear requires a writable depth plane` before the loading screen. Decode depth only when a depth/stencil surface is bound, and apply the precheck's writable-plane requirements only when a plane exists. Clears on existing read-only or missing individual planes still reject. Regression cases cover depth, stencil and combined stale flags without changing color writes or viewport depth. ### Tested Linux x86-64, GCC/G++, Release: built and ran `agc_driver_graphics_tests`; conventions and whitespace checks pass. Existing writable-depth/stencil rejection checks remain active. Guest-arena/host-import checks that require the unavailable arena were skipped by the suite. The failure was observed in the user's HFW run on an RTX 4070 SUPER. This environment cannot expose a GPU, so no controlled hardware run is claimed. This fixes the stale-clear startup failure, not the separate 60-second guest-allocation pin timeout or all later loading failures. ### Checklist - [x] Based on current `main`; no other open PR found implementing this stale-clear handling - [x] One topic per PR - [x] No code comments added - [x] Unsupported active clear paths still throw - [x] No investigation files or images added - [x] No new third-party code - [x] Generic behavior - [x] Depends on: none - [x] Unblocks: PPSA01521 startup depth-clear stop; Game bring-up discussion not provided - [x] GPUs tested: none in this environment - [x] AI-assisted: yes
Dextroid17 commented 2026-10-15 02:09:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-15T02:09:34Z.


I ran this PR's test on Linux.

Setup: this PR's diff applied to main at 8cd937e29 (the PR's base is 485 commits behind it), default CMake build (CMAKE_BUILD_TYPE empty, unoptimized), clean environment. ctest -R '^agc_driver_graphics$', 3 runs each. The test did not open a GPU device, so this is a CPU-only run.

  • with this PR: 3 of 3 pass.
  • with Graphics/src/State.cpp put back to main's version (the new test kept): 3 of 3 fail at "AGC graphics: stencil clear requires a writable stencil plane".

So the new test catches the old behaviour here. I did not check Windows, macOS or a real GPU.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6182790082 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5855#issuecomment-6182790082). Originally posted by [Dextroid17](https://github.com/Dextroid17) on 2026-10-15T02:09:34Z. --- I ran this PR's test on Linux. Setup: this PR's diff applied to main at 8cd937e29 (the PR's base is 485 commits behind it), default CMake build (CMAKE_BUILD_TYPE empty, unoptimized), clean environment. `ctest -R '^agc_driver_graphics$'`, 3 runs each. The test did not open a GPU device, so this is a CPU-only run. - with this PR: 3 of 3 pass. - with Graphics/src/State.cpp put back to main's version (the new test kept): 3 of 3 fail at "AGC graphics: stencil clear requires a writable stencil plane". So the new test catches the old behaviour here. I did not check Windows, macOS or a real GPU. AI-assisted: yes
github-actions[bot] commented 2026-10-15 12:10:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T12:10:31Z.


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 4650 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 5499 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 5500 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 5867 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 5925 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6188 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6222 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6235 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6454 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6191719973 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5855#issuecomment-6191719973). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-15T12:10:31Z. --- <!-- pr-overlap --> 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](https://www.github.com/boykopovar/AnyPS5/pull/1395) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 4040](https://www.github.com/boykopovar/AnyPS5/pull/4040) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 4650](https://www.github.com/boykopovar/AnyPS5/pull/4650) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 5499](https://www.github.com/boykopovar/AnyPS5/pull/5499) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 5500](https://www.github.com/boykopovar/AnyPS5/pull/5500) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 5867](https://www.github.com/boykopovar/AnyPS5/pull/5867) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp` | | [PR 5925](https://www.github.com/boykopovar/AnyPS5/pull/5925) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6188](https://www.github.com/boykopovar/AnyPS5/pull/6188) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6222](https://www.github.com/boykopovar/AnyPS5/pull/6222) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6235](https://www.github.com/boykopovar/AnyPS5/pull/6235) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6454](https://www.github.com/boykopovar/AnyPS5/pull/6454) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` |
adriadam10 commented 2026-10-15 13:49:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-15T13:49:08Z.


Checked on Linux (RADV): agc_driver_graphics passes with the PR and fails with State.cpp reverted, so the new cases pin the change; the stencil/depth plane rejections that remain are still covered. Matches @Dextroid17's run. Merging once the full build is green.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6193657408 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5855#issuecomment-6193657408). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-15T13:49:08Z. --- Checked on Linux (RADV): `agc_driver_graphics` passes with the PR and fails with `State.cpp` reverted, so the new cases pin the change; the stencil/depth plane rejections that remain are still covered. Matches @Dextroid17's run. Merging once the full build is green.
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!5855
No description provided.