fix(agc): render partially resident depth and stencil planes whose pages are all mapped #14173
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/14173"
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 freneza on 2026-10-31T22:07:19Z.
What
DecodeStaterefused every depth or stencil plane withPARTIALLY_RESIDENT(bit 12 ofDB_Z_INFOorDB_STENCIL_INFO):That bit only changes how the DB treats pages that are not mapped. So a plane with it whose every page is mapped renders like any other plane, and this change lets it render.
DecodeStatenow marks the plane (DepthTarget::depthPartiallyResident,stencilPartiallyResident) instead of refusing it. The mark needs the plane: a depth format or a stencil plane.DepthSurfaceViewchecks residency each time it binds the plane, not at decode. Draw decodes are cached by their registers, and a title can unmap pages between two draws with the same registers. The check covers the range the driver reads and writes: the depth plane and its HTILE, and the stencil plane, each throughGuestMemory::DescribeCommitted.... with pages that are not mapped is unsupported). What the depth and stencil tests read from such a page, and whether a write to it lands, is not modeled.docs/dev/debt/libSceAgcDriver.mdrecords it.Where this was found. PPSA01317 (01.710.000) draws into a 2304x2304 D16 plane at
0x2900000000, withDB_Z_INFO = 0x80001181and no stencil or HTILE. A local log showed the following:sceKernelSetPrtAperture(0, 0x2900000000, 0x100000000).sceKernelBatchMap, from0x2900000000to0x2900a20000, exactly the plane's0xa20000bytes.DescribeCommittedreported the whole plane as mapped, in one run.Tested
Linux (Bazzite 44, Fedora-based), GCC 16.2.1, Release,
BUILD_TESTING=ON.New tests:
tests/Graphics.cpp:DecodeStatemarks aPARTIALLY_RESIDENTdepth plane and stencil plane, and doesn't mark a plane without the bit.tests/DepthSurfaceReuse.cpp(TestPartiallyResidentPlanes), over real memory with pages left unmapped:PARTIALLY_RESIDENTstill renders.Focused tests with
ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1andVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation(loader output confirmsVK_LAYER_KHRONOS_validationis inserted),ctest --test-dir build-test -R '<pattern>' -V -j1, onmain4977f64052and on this change merged onto it (20a0a6450d). The pattern isagc_driver_graphics,agc_driver_depth_bounds_state,agc_depth_copy_kept_bytes,agc_driver_unused_viewport_depth,agc_driver_depth_plane_.*,agc_driver_native_depth_.*andagc_driver_depth_surface_last_writer.VUID-lineswas not found but was requested by env var VK_INSTANCE_LAYERSmainPPSA01317 on a local branch of
main92d2fdc343with the GPU pull requests listed in #4697 and this change draws past the point where it used to stop onpartially resident depth. It now stops in two refusals that are not this one:0x120aed7f00, whose table holds 140 distinct targets (limit 64).the depth target's sample count differs from the rasterizer's, when entering one of the areas the World Map opens (#14861).That game run predates the merge of current
main; the focused tests above are from the merged head.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)🤖 Generated with Claude Code
Pull request closed