feat(agc-driver): draw DB_RENDER_CONTROL depth clears #2219

Merged
XairRrR merged 1 commit from upstream-pr/2219 into main 2026-10-10 06:59:34 +00:00
XairRrR commented 2026-10-09 11:55:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-10-09T11:55:12Z.


What

Uncharted: Legacy of Thieves Collection (PPSA05684) clears depth and stencil with draws that set DB_RENDER_CONTROL to 0x3 and stops on main with:

depth/stencil clear, copy, resummarize or decompress draws (DB_RENDER_CONTROL) is unsupported (register 0x0 = 0x00000003)

#1534 handles STENCIL_CLEAR_ENABLE; this adds DEPTH_CLEAR_ENABLE (bit 0, Mesa sid.h) on top of it, as suggested in #1479.

  • The draw is rasterized as submitted, with an always-passing depth write, no depth bounds, no depth bias and the viewport depth range pinned to DB_DEPTH_CLEAR. It therefore writes the clear value exactly where the title's geometry covers; nothing is inferred from viewport or scissor state (the blocker #1395 describes).
  • A read-only or absent depth plane throws, at decode and in the draw precheck. Depth and stencil clears combine; copy, resummarize and decompress draws still throw.
  • That the DB ignores the depth test for such a draw is not measured; TechnicalDebt records it.
  • Tests in tests/Graphics.cpp (DepthStencilTests): depth clear state, read-only plane, combined 0x3 clear; the old expectation that bit 0 throws is replaced.

The first two commits are #1534's.

Tested

Arch Linux, GCC 16.2.1, NVIDIA GeForce RTX 4070 Ti SUPER (driver 615.71.09).

  • On current main (d70b8998) with #1534: tools/check_conventions.py passes; of the 513 ctest tests all pass except agc_driver_dcc_keys_first_write, which fails the same way on main, and agc_driver_storage_cache_budget, which passes run alone (a local 3 GB RSS limit stopped it under ctest -j8).
  • Uncharted: Legacy of Thieves Collection (PPSA05684): with this and the other changes of its bring-up, the title gets past these clears and reaches its main menu.

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: #1534
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4800056288 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2219). Originally posted by [XairRrR](https://github.com/XairRrR) on 2026-10-09T11:55:12Z. --- ### What Uncharted: Legacy of Thieves Collection (PPSA05684) clears depth and stencil with draws that set `DB_RENDER_CONTROL` to 0x3 and stops on `main` with: ``` depth/stencil clear, copy, resummarize or decompress draws (DB_RENDER_CONTROL) is unsupported (register 0x0 = 0x00000003) ``` #1534 handles `STENCIL_CLEAR_ENABLE`; this adds `DEPTH_CLEAR_ENABLE` (bit 0, Mesa `sid.h`) on top of it, as suggested in #1479. - The draw is rasterized as submitted, with an always-passing depth write, no depth bounds, no depth bias and the viewport depth range pinned to `DB_DEPTH_CLEAR`. It therefore writes the clear value exactly where the title's geometry covers; nothing is inferred from viewport or scissor state (the blocker #1395 describes). - A read-only or absent depth plane throws, at decode and in the draw precheck. Depth and stencil clears combine; copy, resummarize and decompress draws still throw. - That the DB ignores the depth test for such a draw is not measured; TechnicalDebt records it. - Tests in `tests/Graphics.cpp` (`DepthStencilTests`): depth clear state, read-only plane, combined 0x3 clear; the old expectation that bit 0 throws is replaced. The first two commits are #1534's. ### Tested Arch Linux, GCC 16.2.1, NVIDIA GeForce RTX 4070 Ti SUPER (driver 615.71.09). - On current `main` (d70b8998) with #1534: `tools/check_conventions.py` passes; of the 513 ctest tests all pass except `agc_driver_dcc_keys_first_write`, which fails the same way on `main`, and `agc_driver_storage_cache_budget`, which passes run alone (a local 3 GB RSS limit stopped it under `ctest -j8`). - Uncharted: Legacy of Thieves Collection (PPSA05684): with this and the other changes of its bring-up, the title gets past these clears and reaches its main menu. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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: #1534 - [x] AI-assisted: yes
EdouardSence commented 2026-10-09 12:31:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by EdouardSence on 2026-10-09T12:31:36Z.


Another title that needs this: Ratchet & Clank: Rift Apart (PPSA01474), on Linux with an RX 9070 XT (RADV).

Base: main 43972e69 plus the fixes it needs to get there: #1673, #1339, #1836, #1837, #1893, #2105, #2184, #2226.

  • Without this PR, the run stops about 20 s in, on its first draws: depth/stencil clear, copy, resummarize or decompress draws (DB_RENDER_CONTROL) is unsupported (register 0x0 = 0x00000001). That is a depth-only clear (DEPTH_CLEAR_ENABLE).
  • With it merged on top (only a TechnicalDebt.md conflict), the clear draws go through. The next stop is the null pixel program (#1902), then a rect-list draw (#1928), then color views of several array slices are unsupported (#2102).

No frame is presented yet, so I can't comment on the clear's visual result.

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

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6080943086 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2219#issuecomment-6080943086). Originally posted by [EdouardSence](https://github.com/EdouardSence) on 2026-10-09T12:31:36Z. --- Another title that needs this: Ratchet & Clank: Rift Apart (PPSA01474), on Linux with an RX 9070 XT (RADV). **Base:** `main` 43972e69 plus the fixes it needs to get there: #1673, #1339, #1836, #1837, #1893, #2105, #2184, #2226. - Without this PR, the run stops about 20 s in, on its first draws: `depth/stencil clear, copy, resummarize or decompress draws (DB_RENDER_CONTROL) is unsupported (register 0x0 = 0x00000001)`. That is a depth-only clear (`DEPTH_CLEAR_ENABLE`). - With it merged on top (only a `TechnicalDebt.md` conflict), the clear draws go through. The next stop is the null pixel program (#1902), then a rect-list draw (#1928), then `color views of several array slices are unsupported` (#2102). No frame is presented yet, so I can't comment on the clear's visual result. *Tested and written by Claude (AI assistant) on a contributor's machine.*
NahuelGenchi commented 2026-10-09 14:47:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by NahuelGenchi on 2026-10-09T14:47:30Z.


Tested with Sonic Origins (PPSA05324) on Linux, R9 380 (RADV, Mesa 26.0.8). It issues the same clears: first DB_RENDER_CONTROL 0x3, then repeated 0x1, with DB_DEPTH_CLEAR 0.0, DB_DEPTH_CONTROL 0x777 and no pixel program.

On main d70b8998 with this PR, #2022, #1902, #1928, #1837, #425 and #1544, plus local workarounds for #1789, the clears run and the title presents its boot frames, including the SEGA logo. Runs of 6 minutes end on the time limit. I had an equivalent depth half on a branch (mentioned on #1479), but this one also turns off depth bounds and bias, so I'm not opening mine.

Bring-up thread: #2021

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6083265417 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2219#issuecomment-6083265417). Originally posted by [NahuelGenchi](https://github.com/NahuelGenchi) on 2026-10-09T14:47:30Z. --- Tested with Sonic Origins (PPSA05324) on Linux, R9 380 (RADV, Mesa 26.0.8). It issues the same clears: first `DB_RENDER_CONTROL` 0x3, then repeated 0x1, with `DB_DEPTH_CLEAR` 0.0, `DB_DEPTH_CONTROL` 0x777 and no pixel program. On `main` d70b8998 with this PR, #2022, #1902, #1928, #1837, #425 and #1544, plus local workarounds for #1789, the clears run and the title presents its boot frames, including the SEGA logo. Runs of 6 minutes end on the time limit. I had an equivalent depth half on a branch (mentioned on #1479), but this one also turns off depth bounds and bias, so I'm not opening mine. Bring-up thread: #2021
popcoder565 commented 2026-10-09 15:47:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by popcoder565 on 2026-10-09T15:47:13Z.


Native Windows run, since no Windows results were posted. Setup: Windows 10 (19045), RTX 3060 Laptop (NVIDIA 616.92), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release. Head d7770574, merged onto main d70b8998 in one build with 38 other PRs that had no Windows run.

  • It conflicts with #2179 in State.cpp, so it was tested on main without it.
  • This PR's tests pass: agc_driver_graphics. None of them reported skipping a case.
  • Full ctest in that build: 519 of 519. That needed local fixes to three other PRs in the batch that don't build or pass on Windows: #1611, #1796 and #1824 (reported there).

No title was run.

🤖 Addressed by Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6084284302 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2219#issuecomment-6084284302). Originally posted by [popcoder565](https://github.com/popcoder565) on 2026-10-09T15:47:13Z. --- Native Windows run, since no Windows results were posted. Setup: Windows 10 (19045), RTX 3060 Laptop (NVIDIA 616.92), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release. Head `d7770574`, merged onto `main` d70b8998 in one build with 38 other PRs that had no Windows run. - It conflicts with #2179 in `State.cpp`, so it was tested on `main` without it. - This PR's tests pass: `agc_driver_graphics`. None of them reported skipping a case. - Full ctest in that build: 519 of 519. That needed local fixes to three other PRs in the batch that don't build or pass on Windows: #1611, #1796 and #1824 (reported there). No title was run. _🤖 Addressed by [Claude Code](https://claude.com/claude-code)_
tv7 commented 2026-10-10 01:51:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by tv7 on 2026-10-10T01:51:47Z.


Tested on Windows with a second title that stops on the same draw: Marvel's Wolverine (PPSA03671), also DB_RENDER_CONTROL = 0x3.

Setup: Windows 11 Pro (10.0.26200), RTX 3070, GCC 15.2.0 UCRT (WinLibs), Release. This PR (d7770574) merged onto main 54f28f2d3 with #1836, #1893, #1709, #1837, #1940, #2022, and a local change that lets sceKernelSignalSema accept a count of 0. The merge conflicted only in docs/dev/TechnicalDebt.md.

Without this PR: the first presentation fails with depth/stencil clear, copy, resummarize or decompress draws (DB_RENDER_CONTROL) is unsupported (register 0x0 = 0x00000003).

With this PR: the clear draws pass. The next stop is a null pixel program static ABI miss (#1901, fixed by #1902).

Limits: one title, one run each way. No frame is presented yet, so I can't confirm the clear values on screen.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6092384076 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2219#issuecomment-6092384076). Originally posted by [tv7](https://github.com/tv7) on 2026-10-10T01:51:47Z. --- Tested on Windows with a second title that stops on the same draw: Marvel's Wolverine (PPSA03671), also `DB_RENDER_CONTROL` = 0x3. **Setup:** Windows 11 Pro (10.0.26200), RTX 3070, GCC 15.2.0 UCRT (WinLibs), Release. This PR (d7770574) merged onto main 54f28f2d3 with #1836, #1893, #1709, #1837, #1940, #2022, and a local change that lets `sceKernelSignalSema` accept a count of 0. The merge conflicted only in `docs/dev/TechnicalDebt.md`. **Without this PR:** the first presentation fails with `depth/stencil clear, copy, resummarize or decompress draws (DB_RENDER_CONTROL) is unsupported (register 0x0 = 0x00000003)`. **With this PR:** the clear draws pass. The next stop is a null pixel program static ABI miss (#1901, fixed by #1902). **Limits:** one title, one run each way. No frame is presented yet, so I can't confirm the clear values on screen.
oneandonlydean commented 2026-10-10 05:18:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-10T05:18:11Z.


#1534 is in main now, so this needs a rebase onto main (conflicts in State.cpp, tests/Graphics.cpp and TechnicalDebt.md).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6094140187 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2219#issuecomment-6094140187). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-10T05:18:11Z. --- #1534 is in main now, so this needs a rebase onto main (conflicts in `State.cpp`, `tests/Graphics.cpp` and `TechnicalDebt.md`).
adriadam10 commented 2026-10-10 06:49:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T06:49:13Z.


Rebased onto current main now that #1534 is in. Conflicts were in State.cpp (the viewport line and DrawRejection, where main gained the collapsed-viewport path and the depth-bounds/absent-plane rule) and TechnicalDebt.md (adjacency); both sides kept. Scoped build + ctest: agc_driver_graphics and agc_driver_prepared_graphics pass, and agc_driver_graphics fails when the State.cpp/TechnicalDebt change is reverted. The unmeasured DB behaviour is recorded in TechnicalDebt. Also confirmed by @popcoder565, @tv7, @EdouardSence and @NahuelGenchi on Windows/Linux titles. Merging the rebase.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6094814564 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2219#issuecomment-6094814564). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-10T06:49:13Z. --- Rebased onto current `main` now that #1534 is in. Conflicts were in `State.cpp` (the viewport line and `DrawRejection`, where `main` gained the collapsed-viewport path and the depth-bounds/absent-plane rule) and `TechnicalDebt.md` (adjacency); both sides kept. Scoped build + ctest: `agc_driver_graphics` and `agc_driver_prepared_graphics` pass, and `agc_driver_graphics` fails when the `State.cpp`/TechnicalDebt change is reverted. The unmeasured DB behaviour is recorded in TechnicalDebt. Also confirmed by @popcoder565, @tv7, @EdouardSence and @NahuelGenchi on Windows/Linux titles. Merging the rebase.
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!2219
No description provided.