fix(agc): draw stencil clears requested through DB_RENDER_CONTROL #2504

Closed
esatturan wants to merge 1 commit from upstream-pr/2504 into main
esatturan commented 2026-10-09 23:33:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by esatturan on 2026-10-09T23:33:01Z.


Split from #2053 in review.

What

A draw with DB_RENDER_CONTROL.STENCIL_CLEAR_ENABLE threw depth/stencil clear, copy, resummarize or decompress draws (DB_RENDER_CONTROL) is unsupported. It is now drawn with a stencil test that always passes and replaces with DB_STENCIL_CLEAR on both faces.

  • A partial stencil write mask (front, or back when back-face stencil is on), a read-only stencil view or a missing stencil plane throw.
  • The other DB_RENDER_CONTROL operations (depth clear, copy, resummarize, decompress) still throw.
  • Whether the hardware applies the draw's own stencil function under STENCIL_CLEAR_ENABLE, and the HTILE state a fast clear leaves, are recorded in TechnicalDebt.

PPSA29141 clears its stencil this way while Unity starts. On main with #1482, it stops with depth/stencil clear, copy, resummarize or decompress draws (DB_RENDER_CONTROL) is unsupported (register 0x0 = 0x00000022).

Tested

Windows 11, i7-13650HX, RTX 4070 Laptop, MinGW-w64 GCC 15.2.

  • agc_driver_graphics: the decode of a stencil clear draw (ALWAYS and REPLACE with DB_STENCIL_CLEAR on both faces) and the three refusals. It fails on main with the error above.
  • Full ctest on current main (c6e3aa76) merged with this branch, the other LEGO Party! PRs and #1482: 547/547 pass. On Windows, main's libs step currently fails with duplicate patched export name: LibwuIonIBw: #1714 added APS5_EXPORTs for sceVideoOutAddVrrActiveStatusEvent and sceVideoOutAddVrrStatusFlagsPrivilege, whose names the NID table already maps. Those two lines were removed locally for the run.

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 in TechnicalDebt
  • 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
  • AI-assisted: yes (Claude Code)
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4806976828 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2504). Originally posted by [esatturan](https://github.com/esatturan) on 2026-10-09T23:33:01Z. --- Split from #2053 in review. ### What A draw with `DB_RENDER_CONTROL.STENCIL_CLEAR_ENABLE` threw `depth/stencil clear, copy, resummarize or decompress draws (DB_RENDER_CONTROL) is unsupported`. It is now drawn with a stencil test that always passes and replaces with `DB_STENCIL_CLEAR` on both faces. - A partial stencil write mask (front, or back when back-face stencil is on), a read-only stencil view or a missing stencil plane throw. - The other `DB_RENDER_CONTROL` operations (depth clear, copy, resummarize, decompress) still throw. - Whether the hardware applies the draw's own stencil function under `STENCIL_CLEAR_ENABLE`, and the HTILE state a fast clear leaves, are recorded in TechnicalDebt. PPSA29141 clears its stencil this way while Unity starts. On `main` with #1482, it stops with `depth/stencil clear, copy, resummarize or decompress draws (DB_RENDER_CONTROL) is unsupported (register 0x0 = 0x00000022)`. ### Tested Windows 11, i7-13650HX, RTX 4070 Laptop, MinGW-w64 GCC 15.2. - `agc_driver_graphics`: the decode of a stencil clear draw (ALWAYS and REPLACE with `DB_STENCIL_CLEAR` on both faces) and the three refusals. It fails on `main` with the error above. - Full `ctest` on current `main` (`c6e3aa76`) merged with this branch, the other LEGO Party! PRs and #1482: 547/547 pass. On Windows, `main`'s `libs` step currently fails with `duplicate patched export name: LibwuIonIBw`: #1714 added `APS5_EXPORT`s for `sceVideoOutAddVrrActiveStatusEvent` and `sceVideoOutAddVrrStatusFlagsPrivilege`, whose names the NID table already maps. Those two lines were removed locally for the run. ### 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 in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [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] AI-assisted: yes (Claude Code)
github-actions[bot] commented 2026-10-09 23:36:24 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-09T23:36:24Z.


Thank you for your interest in the project! We are sorry, but we cannot accept more PRs while we work through the existing backlog. This PR has been automatically closed and labeled "intake paused". This is not a judgment of the quality of your changes.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6091093762 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2504#issuecomment-6091093762). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-09T23:36:24Z. --- Thank you for your interest in the project! We are sorry, but we cannot accept more PRs while we work through the existing backlog. This PR has been automatically closed and labeled "intake paused". This is not a judgment of the quality of your changes.

Pull request closed

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!2504
No description provided.