fix(agc): leave the depth surface out when no enabled test has its plane #3702
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3702"
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 oneandonlydean on 2026-10-11T15:39:08Z.
What
DecodeStatebinds the depth surface whenDB_DEPTH_CONTROLenables a depth, stencil or depth bounds test and either plane is valid. It doesn't ask whether the enabled test has its own plane. A stencil test beside a depth-only surface (DB_STENCIL_INFOformat invalid, depth test off) tests nothing, but the surface was attached anyway, and the render extent and the scissor were clamped to it.A title we test with leaves a 960x540 depth surface bound after a half-resolution pass and then draws into its 1920x1080 target with
DB_DEPTH_CONTROL0x007007b1 (stencil test on, always pass; depth test off),DB_Z_INFO0x80000183 andDB_STENCIL_INFO0x20000180. The draw's viewport is 1920x1080, but its render extent became 960x540, so a full-screen transition covered only the top-left quarter of the frame.A depth or stencil test whose plane register is present with an invalid format no longer counts towards binding the surface.
decodeDepthalready turns such a test off (#453); the surface was bound for it all the same. When no enabled test is left, the draw renders without a depth attachment, as it already does when both planes are invalid (#453, #2179).DrawRejectionfollows the same rule. A test with a valid plane binds the surface as before, and so does a clear.Not changed:
depth bounds without a depth planewhen the depth plane is invalid.Tested
Linux (CachyOS, kernel 7.2.3, GCC 16.2.1, Release with CI's configure flags and
ANYPS5_ENABLE_SPIRV_TOOLS=ON), RTX 4090, NVIDIA 610.57.04. One commit,c1287d73, onmaina11c8f7f.agc_driver_graphicshas three new cases: an always-pass stencil test and a failing stencil test, each without a stencil plane beside a valid 32x2 depth plane the draw doesn't test, decode without a depth surface, keep the color target's extent and are not rejected; a depth test on that plane still binds it and clamps to 32x2. With only the test change onmaina11c8f7fthe test fails witha stencil test without a stencil plane bound the depth plane it does not test. With the change it passes.ctest(--parallel 4,ANYPS5_REQUIRE_VULKAN=1), 838 tests, onmaina11c8f7fand on this branch: 833 pass, 4 skip (video_out_flip_lifetime,_reopen,_controls,_overlay), 1 fails on both. The failure isagc_driver_emulated_color_compare(#3526).ctest -R "agc|shader|write", 391 tests) on lavapipe (Mesa 26.2.3, LLVM 22.1.8): the same two fail onmaina11c8f7fand on this branch (agc_driver_emulated_color_compare,agc_driver_image_plane_address_on_line_implicit_lod), the same 56 skip.python3 tools/check_conventions.py --base origin/mainpasses.main2220effbwith #425, #454, #2490 and #2491 (it needs them to get past its intro) and the same change: without the change every frame of the transition is drawn in the top-left quarter; with it the transition fills the frame in two runs of the scripted sequence (boot, title, menu, first level; no frame of either run has the quarter picture). The frames before and after the transition are the same by eye. In another level of the same title, one run each: 2.65 fps without the change, 2.55 fps with it. It was not run again onmaina11c8f7f.Not tested: Windows, AMD, Intel.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T21:52:43Z.
Checked on current main: build and ctest of libSceAgcDriver (390 tests) green, and
agc_driver_graphicsfails without theState.cppchange and passes with it.DecodeStateandDrawRejectionuse the same rule, and a clear or a test with a valid plane still binds the surface. Merging.