fix(agc): treat other-shaped views of a depth surface's stencil plane as reused memory #3277
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3277"
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-11T04:54:41Z.
Carried unchanged from @AlxcBTW's fork (AlxcBTW/AnyPS5#26,
a1827af1, authorship kept); the intake pause closes PRs opened from that account.What
FPV Simulator (PPSA10698 v01.006.000, Unity 2021.3 URP) ends when it presents a frame:
Unity reuses the memory of transient render targets. The T# base, 0x231590000, is the stencil plane of the D32S8 surface at 0x230cd0000, and the first line shows the title binding that address as a color target. The view is a 1920x1080 RGBA8 sRGB texture, which reads the color data, not an 8-bit stencil plane.
9d65003c(#1495) already treats this as memory reuse for the depth plane: a view with another extent, or a depth-plane view in a format that cannot hold the plane, falls through to the ordinary texture path. Stencil-plane views of the same extent kept the old handling: they all went to the depth surface, which throws for any format other than R8 uint. This applies the same rule to the stencil plane: a view whose texels are not one byte wide cannot hold the 8-bit plane, soDepthSurfaceTexturereturns nothing and the memory is read like any texture.Related: #454 (open) is broader: it retires a depth surface once another writer covers its depth or stencil plane. This PR extends only the format rule from #1495 and doesn't track writers. Both change the same lines in
DepthSurfaceTexture, so whichever lands second needs a small rebase.Tested
Windows 11, WinLibs GCC 15.2.0 r7, Release, RTX 5070 Laptop (driver 616.92).
DepthSurfaceReuse.cpp(agc_driver_graphics), on a 320x180 D32S8 surface: an R8 uint view of the stencil plane still samples the plane; RGBA8 and R32F views of the same extent are read as reused memory. Without the source change,agc_driver_graphicsfails on the RGBA8 case with the original error:sampling the stencil plane of depth surface 0x60000000 (320x180, vk format 130) as a 320x180 texture of guest format 56 (vk 37) ... is not implemented.agc_driver_graphics,agc_driver_depth_bias_per_face,agc_driver_pending_exact_surface,agc_driver_prepared_graphics,agc_driver_cmask_fast_clear,agc_pass_hazards): 6/6.agc_driveron NVIDIA RTX 5070 Laptop: 253/253.check_conventions.pypasses.mainwith other patches.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🤖 Generated with Claude Code
Fixes #2994.