Repository navigation
fix(agc): leave the depth surface out when no enabled test has its plane - #3702
Merged
adriadam10 merged 1 commit intoOct 11, 2026
Merged
Conversation
DecodeState bound the depth surface whenever DB_DEPTH_CONTROL enabled a depth, stencil or depth bounds test and either plane was valid. A stencil test beside a depth-only surface (DB_STENCIL_INFO format invalid, depth test off) tests nothing, but the surface was still attached and the render extent was clamped to it. A draw into a 1920x1080 target with a 960x540 depth surface left bound then covered only the top-left quarter. A test whose plane is present but invalid no longer binds the surface. Such a draw renders without a depth attachment, as it already does when both planes are invalid. DrawRejection follows the same rule.
9 tasks done
Collaborator
|
Checked on current main: build and ctest of libSceAgcDriver (390 tests) green, and |
Merged
9 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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, c1287d7, onmaina11c8f7.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 onmaina11c8f7 the 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, onmaina11c8f7 and 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(linux CI + NVIDIA:agc_driver_emulated_color_comparefails on main since #3438 (8-bit sRGB compare refused on the decode path) #3526).ctest -R "agc|shader|write", 391 tests) on lavapipe (Mesa 26.2.3, LLVM 22.1.8): the same two fail onmaina11c8f7 and 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.main2220eff with feat(agc): depth planes sampled as 2D arrays, cubes and integer views #425, fix(libSceAgcDriver): retire a depth surface once another writer covers its memory #454, perf(agc): keep unchanged guest layers of a depth plane copy #2490 and perf(agc): skip the depth plane copy when no slice changed #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 onmaina11c8f7.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)