fix(agc): compare the depth write base only when the depth plane is written #6725
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/6725"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by johandavidcm on 2026-10-16T07:15:48Z.
What
decodeDepthrequiredDB_Z_WRITE_BASEto equalDB_Z_READ_BASEwhenever the depth plane was not read-only, also for draws that never write it. Yakuza 0 Director's Cut (PPSA31327, 01.015.000) stops on such a draw:A local diagnostic build (not part of this PR) printed the draw's registers:
DB_DEPTH_CONTROL0x00000701(stencil test only:Z_ENABLEandZ_WRITE_ENABLEclear)DB_RENDER_CONTROL0DB_DEPTH_VIEW00xed11340000/00xed14280000/0xed14280000DB_Z_INFO/DB_STENCIL_INFO0xa2900983/0x20000181DB_DEPTH_SIZE_XY0x0a1f11ff(4608x2592)The bases are now compared only when the depth plane can be written: a depth clear, a draw with both
Z_ENABLEandZ_WRITE_ENABLE(the condition that setsdepthWrite), or an expand pass withDEPTH_COMPRESS_DISABLEorSTENCIL_COMPRESS_DISABLEinDB_RENDER_CONTROL, which still throws. The surface keeps the read base. The stencil check is unchanged.Overlap: #6146 moves this check into its reworked
decodeDepthand runs out-of-place expands (DB_RENDER_CONTROL & 0x60) from the draw precheck. It keeps the strict comparison for every other draw, so it does not pass this one (DB_RENDER_CONTROL0). The behaviours are independent; I will rebase onto #6146 if it lands first.Tested
Windows 11 Pro 26200, WinLibs GCC 15.2.0 (ucrt, posix, seh, r7), NVIDIA GeForce RTX 4070 (driver 617.42).
agc_driver_graphics:DepthStencilTestsaccepts a stencil-only draw,Z_WRITE_ENABLEwithoutZ_ENABLEand a depth test without writes at another write base (depth not written, surface at the read base), and still rejects a written plane, a depth clear andDB_RENDER_CONTROL0x20, 0x40 and 0x60 there.agc_driver_depth_*(12),agc_driver_native_depth_*(3),agc_driver_native_multisample_depth,agc_driver_pipeline_optimized_readback_d16/d32(4),agc_driver_readonly_resummarize,agc_driver_sample_mask_depth_stencil,agc_driver_stencil_ref_export_unused,agc_driver_stencil_replay,agc_driver_stencil_replay_no_gpl,agc_driver_graphics);agc_driver_stencil_ref_exportskipped, the device lacksVK_EXT_shader_stencil_export.CMASK fast clears of a mipmapped, 3D or array color target are unsupported. Reaching the menus also needs the local changes listed in the bring-up discussion.tools/check_conventions.py --base origin/mainpasses.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-16T07:34:16Z.
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.
core/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppImported from boykopovar/AnyPS5. Originally posted by savvaniss on 2026-10-17T14:43:26Z.
Intel and AMD Windows data: no failures from this change.
Windows 11 Pro 26300, WinLibs GCC 15.2.0 r7, Release, every execution test built,
ANYPS5_NO_SHADER_CACHE=1, serial CTest,main47a266cf9. Intel UHD Graphics 770 (8086:a780, 32-wide subgroups), driver 32.0.101.7088. AMD Radeon RX 9070 XT (1002:7550, 64-wide subgroups), driver 32.0.31041.1004, withVkCacheemptied first.c8f7fc06emerged intomain: the 16 tests built fromtests/Graphics.cpp, ×3Full CTest (
--parallel 4) with six open PRs merged intomain(#6638, #6604, #6014, #6773, #6772, #6725): the same failures asmainalone on both GPUs, nothing new.mainalone: UHD 770 1392 of 1398, RX 9070 XT 1396 of 1398. The failures are image tables (#6647) andsample_multisample_target(#6971) on Intel, andquad_pixel_mask(#6255) andlayered_volume_vertex_no_gpl(#4768) on AMD.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by johandavidcm on 2026-10-17T17:17:45Z.
Thanks @savvaniss for the Intel and AMD runs.
@EagleBearerYS the overlap comment lists #6146 on the same lines of
decodeDepth(L288-289). The changes are independent: #6146 runs out-of-place expands (DB_RENDER_CONTROL & 0x60) from the draw precheck and keeps the strict base comparison for every other draw, while #6725 skips the comparison only when the depth plane cannot be written (no depth clear, not bothZ_ENABLEandZ_WRITE_ENABLE, noDB_RENDER_CONTROL & 0x60), so an expand still throws indecodeDepthand your precheck path is unchanged. PPSA31327's stencil-only draw (DB_DEPTH_CONTROL0x701,DB_RENDER_CONTROL0, Z write base 0) stops on the strict comparison with or without #6146.As #6725 is a two-line change, I suggest it goes first; on your side the conflict resolves by using its condition in the
Requireyou move to the top ofdecodeDepth. If you prefer #6146 first, I will rebase #6725 onto it and setDepends on: #6146. Which order works for you?Manual check of the PRs the overlap comment could not compare: #1395 also edits this
Require(it adds acopying ||exception for its experimental depth copy recognition) but is far behindmainand conflicts with it; #4650 only readsdepthWriteelsewhere; the others do not touch the base comparison indecodeDepthor theDepthStencilTestsblock this PR extends.Imported from boykopovar/AnyPS5. Originally posted by johandavidcm on 2026-10-17T17:18:35Z.
@oneandonlydean, could you take a look when you have time?
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-19T12:49:11Z.
Checked
decodeDepthagain against current main:depthWrittenmatches the condition that setsdepthWrite(Z_ENABLE and Z_WRITE_ENABLE, depth clear) plus theDB_RENDER_CONTROL & 0x60expand case, which still throws. The stencil check is untouched. The newDepthStencilTestscases pin both the accepted draws (0x711, 0x715, 0x713) and the rejected ones (0x717, clear, 0x20/0x40/0x60) at a different write base, and the stencil-only draw would have thrown before. Third-party Intel/AMD Windows runs from @savvaniss are clean. Merged.