Skip to content

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

Merged
adriadam10 merged 1 commit into
boykopovar:mainfrom
XairRrR:feat/agc-depth-clear-draws
Oct 10, 2026
Merged

adriadam10 merged 1 commit into
boykopovar:mainfrom
XairRrR:feat/agc-depth-clear-draws

Conversation

@XairRrR

@XairRrR XairRrR commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

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 feat(agc): add experimental depth clear and copy recognition #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 (d70b899) with fix(agc): preserve ClearMRT color writes and validate stencil clears #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: fix(agc): preserve ClearMRT color writes and validate stencil clears #1534
  • AI-assisted: yes

@EdouardSence

Copy link
Copy Markdown
Contributor

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

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

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

Copy link
Copy Markdown
Contributor

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 d70b899 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

Copy link
Copy Markdown
Contributor

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 d70b899 in one build with 38 other PRs that had no Windows run.

No title was run.

🤖 Addressed by Claude Code

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 9, 2026
@tv7

tv7 commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

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 (d777057) merged onto main 54f28f2 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

Copy link
Copy Markdown
Collaborator

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

DEPTH_CLEAR_ENABLE (DB_RENDER_CONTROL bit 0, Mesa sid.h) makes the DB
write DB_DEPTH_CLEAR wherever the draw covers. Such a draw is now
rasterized as submitted with an always-passing depth write, no depth
bounds, no depth bias and the viewport depth range pinned to the clear
value, so it touches exactly the pixels the title's geometry covers.
Clearing 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.

Uncharted: Legacy of Thieves Collection (PPSA05684) clears with draws
that set DB_RENDER_CONTROL to 0x3 and stopped with "depth/stencil
clear, copy, resummarize or decompress draws (DB_RENDER_CONTROL) is
unsupported (register 0x0 = 0x00000003)".
@adriadam10

Copy link
Copy Markdown
Collaborator

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.

@adriadam10
adriadam10 force-pushed the feat/agc-depth-clear-draws branch from d777057 to 295223f Compare October 10, 2026 06:49
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 10, 2026
@adriadam10
adriadam10 merged commit 3a1c79f into boykopovar:main Oct 10, 2026
14 checks passed
SleglJan pushed a commit to SleglJan/AnyPS5 that referenced this pull request Oct 10, 2026
…draws

feat(agc-driver): draw DB_RENDER_CONTROL depth clears
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants