feat(agc): run DB depth copies into a single-sample R32 float target #8975
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/8975"
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 milescoviello on 2026-10-21T08:06:56Z.
What
This carries #5499 by @codingreapermaps, rebased onto current
main, with a fix for one-sample depth surfaces and the review fixes below on top. Their commit keeps its authorship. @oneandonlydean offered this route on #5499: a new PR crediting them, with #5499 closed in its favour.The change (codingreapermaps's commit,
191c8a8d2b). A draw withDB_RENDER_CONTROL.DEPTH_COPYthrewDB_RENDER_CONTROL depth copy, resummarize or decompress is unsupported. PPSA12361 (Transport Fever 2) issues one in every frame of a map:DB_RENDER_CONTROL = 0x84(DEPTH_COPYwithCOPY_CENTROID), a two-sampleZ_32_FLOATdepth surface and a single-sample R32 float color target of the same size, which its ambient occlusion pass samples next.DecodeDepthCopyPassrecognises the draw before shader compilation. It accepts only:Z_32_FLOATdepth plane;PA_SC_AA_MASK;Anything else throws, and draws without
DEPTH_COPYare unchanged.The copy runs as a compute pass (
DepthSample.comp). It fetches one sample of the host depth image and stores it into the target's resident storage image, which is then marked dirty like any other GPU write.With
COPY_CENTROID, the copied sample is the first one the draw covers. radeonsi programs its DB-to-CB copies withCOPY_CENTROIDand a one-sample mask per sample; under the full sample mask required here, that is sample 0. WithoutCOPY_CENTROID,COPY_SAMPLEselects it. The console is not measured;docs/dev/debt/libSceAgcDriver.mdrecords this.Rebase.
CMakeLists.txt,TextureDetiler.hpp/.cpp,DepthSurface.cppand the debt file conflicted.CopySamplereads through it, as the texture path does. TheSAMPLED-usage hunk is gone, becausemainnow covers it.DescriptorRing, asmain's other detiler passes do now.One-sample surfaces (
120900a342, mine). PPSA34501 and PPSA34502 (#6304) copy from a one-sample D32 surface. Before, its single-sample view was bound to the shader'ssampler2DMS, which Vulkan allows only for multisampled views (VUID-RuntimeSpirv-samples-08726; it happened to work on NVIDIA).DepthSample.compis now built in asampler2Dvariant and asampler2DMSvariant, and the copy picks one by the surface's sample count.samplingActive). It reads the host image the draws rendered into.VK_PIPELINE_STAGE_HOST_BITbesideALL_COMMANDS, as the CMASK clear's do, because their access masks include host bits.Review fixes (
127aba3ed6, mine).decodeDepthdecodes it: a multisampled plane's pipe-bank XOR bits are stripped and aDB_DEPTH_VIEWslice is added. Mipmapped and partially resident planes are refused.planeSurface), and it must be a 32-bit float surface with the decoded sample count.The copy is still chosen from the viewport and scissor. The maintainers accepted that with its debt line, so the draw-based copy (the title's draw with a driver pixel program) will be its own PR.
Tested
Ubuntu 24.04, GCC 13.3, NVIDIA RTX 4070 Ti, driver 595.99.02.
On
223e90289b, the lavapipe fix for the CI failure:DepthCopyCasenow copies at 2 samples when the device can sample them, otherwise 4, and skips the multisample half when neither works.agc_driver_depth_storagepasses 3 of 3 under lavapipe (llvmpipe, LLVM 20.1.2, which samples depth at 1 and 4 samples only).On
67cea1c314, @simonbbby's addition (co-author), which @oneandonlydean asked for: on a device that can't sample two-sample depth,DepthCopyCasecreates a two-sample surface and expects thecannot sample at its sample countrefusal.agc_driver_depth_storagepasses 3 of 3 and printsDB depth copy: unsupported two-sample source refused cleanlyeach time.On
127aba3ed6, onmainf894ba69d3: the 30 tests matchingdepth|Depth|db_copy|DbCopy|^agc_driver_graphics$pass 3 of 3.The decode tests now also cover XOR stripping, slice addressing and the mip refusal.
On
120900a342, before the review fixes, the 29 depth tests passed.The tests for the one-sample fix:
depthCopyPassTestsdecodes a one-sample plane and refuses its sample 1.DepthCopyCase, after the multisample checks, copies from a one-sample D32 surface, expects its clear value in every texel, and refuses sample 1.Khronos validation layer (LunarG SDK 1.4.363) over
^agc_driver_(depth_storage|graphics):127aba3ed6,120900a342andmainf894ba69d3each pass 5 of 5 with no VUID.The same layer at the previous head (815c622e3a, the same two commits on an older
main), overagc_driver_depth_storage*andagc_driver_graphics:VUID-RuntimeSpirv-samples-08726×2, plus-02815×6 and-02816×12 (host bits onALL_COMMANDS).CoD Black Ops II (PPSA34502):
mainstops at 15 s onregister 0x0 = 0x00000084.120900a342(release libs, 12 GB cap): the scripted 203 s run reaches the war-room menu, which renders at about 0.7 FPS without the performance PRs. The log has no0x00000084stop and no driver failure.@alexpournaras: PPSA34501 gets past the
0x00000084stop with this branch (#5499).codingreapermaps's original testing (Windows 11, MinGW-w64 GCC 15.2.0, NVIDIA MX450): PPSA12361's map renders, and a RenderDoc capture shows the R32 float target holding the copied depth that the ambient occlusion pass reads.
@clairtonmichel, AMD Radeon RX 7900 XTX (RADV, Mesa 26.2.5, Fedora): the same 30 tests pass at
127aba3ed6.Not tested: Intel at this head.
Checklist
main; no other open PR implements the same functions (supersedes #5499; overlaps the draft #1395)NotImplemented_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)0x84stop; untested here)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-21T08:21:56Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)core/libs/prx/libSceAgcDriver/Graphics/shaders/DepthSample.compcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppL324core/libs/prx/libSceAgcDriver/Graphics/include/DepthSurface.hppL67core/libs/prx/libSceAgcDriver/Graphics/include/State.hppL203core/libs/prx/libSceAgcDriver/Graphics/src/State.cppL1899-1916core/libs/prx/libSceAgcDriver/Graphics/include/TextureDetiler.hppL58core/libs/prx/libSceAgcDriver/Graphics/include/TextureDetiler.hppL58docs/dev/debt/libSceAgcDriver.mdL157Some 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/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/include/DepthSurface.hppcore/libs/prx/libSceAgcDriver/Graphics/include/State.hppcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawPrecheck.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/DepthSurface.hppcore/libs/prx/libSceAgcDriver/Graphics/include/State.hppcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/Draw.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/Draw.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawPrecheck.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/DepthSurface.hppcore/libs/prx/libSceAgcDriver/Graphics/include/Draw.hppcore/libs/prx/libSceAgcDriver/Graphics/include/State.hppcore/libs/prx/libSceAgcDriver/Graphics/include/TextureDetiler.hppcore/libs/prx/libSceAgcDriver/Graphics/shaders/DepthSample.compcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/Graphics/src/TextureDetiler.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/execution/DepthStorage.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawPrecheck.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/Draw.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawPrecheck.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/Draw.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/include/State.hppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/include/DepthSurface.hppcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppcore/libs/prx/libSceAgcDriver/Graphics/src/TextureDetiler.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawPrecheck.cppcore/libs/prx/libSceAgcDriver/Graphics/include/Draw.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawPrecheck.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/Draw.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/TextureDetiler.hppcore/libs/prx/libSceAgcDriver/Graphics/src/TextureDetiler.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/State.hppcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/Graphics/src/TextureDetiler.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/TextureDetiler.hppcore/libs/prx/libSceAgcDriver/Graphics/src/TextureDetiler.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/TextureDetiler.hppcore/libs/prx/libSceAgcDriver/Graphics/src/TextureDetiler.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/TextureDetiler.hppcore/libs/prx/libSceAgcDriver/Graphics/src/TextureDetiler.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/TextureDetiler.hppcore/libs/prx/libSceAgcDriver/Graphics/src/TextureDetiler.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/DepthSurface.hppcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppcore/libs/prx/libSceAgcDriver/Graphics/include/State.hppcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/DepthSurface.hppcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawPrecheck.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/Draw.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/DepthSurface.hppcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/include/TextureDetiler.hppcore/libs/prx/libSceAgcDriver/Graphics/src/TextureDetiler.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/include/State.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/State.hppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/execution/DepthStorage.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/include/State.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdImported from boykopovar/AnyPS5. Originally posted by clairtonmichel on 2026-10-21T08:32:14Z.
Tested on AMD Ryzen 7 9800X3D and AMD Radeon RX 7900 XTX (RADV NAVI31) with Fedora Linux (Mesa 26.2.5):
agc_driver_storage_write_back_no_window, which passes cleanly when isolated).Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-21T08:32:51Z.
Thanks @clairtonmichel, that's the first AMD run of this. Heads-up: the next push replaces the compute copy you tested (
120900a342) with the draw-based copy the review asked for. The title's own draw then runs with a driver pixel program reading the depth sample, so coverage comes from its geometry. The tests change with it. I'll say here when that's up, in case you'd like to rerun on RADV.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-21T08:34:27Z.
@milescoviello an update from the maintainer side: the whole-surface copy has been accepted as it is, with its debt line, so #8975 doesn't need to wait for the draw-based copy. If you mark it ready as it stands, we'll run full CI and merge it, then close #5499 as carried. The draw-based copy can follow as its own PR whenever you get to it.
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-21T08:56:54Z.
Thanks @oneandonlydean. Before marking it ready I went over the rebase once more and fixed four things in
127aba3ed6(one commit on top, codingreapermaps's commit unchanged):DB_DEPTH_VIEWslice would copy slice 0's surface. The address now strips the XOR and adds the slice offset, asdecodeDepthdoes, and mipmapped or partially resident planes (DB_Z_INFO0x000f1000, the view's mip level) are refused.planeSurface), like the texture and storage paths, instead of the last surface created at that address. It also requires a 32-bit float surface with the decoded sample count.The decode tests cover 2: XOR stripping, slice addressing and the mip refusal. On
127aba3ed6, the 30 tests matchingdepth|Depth|db_copy|DbCopy|^agc_driver_graphics$pass 3 of 3. The validation layer over^agc_driver_(depth_storage|graphics)passes 5 of 5 with no VUID, as at120900a342. It's marked ready now.The draw-based copy will follow as its own PR. I have a first version of it locally: the title's draw with a driver pixel program, and a coverage test against a reference draw of the same triangle.
AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by clairtonmichel on 2026-10-21T09:02:08Z.
Tested final rebase (
127aba3) on AMD Ryzen 7 9800X3D and AMD Radeon RX 7900 XTX (RADV, Fedora Linux, Mesa 26.2.5):depth|Depth|db_copy|DbCopy|^agc_driver_graphics$): 100% passed successfully (30/30 green).Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-21T09:03:09Z.
Thanks @clairtonmichel, that's this head on AMD. I added it to the Tested section and the GPU line.
AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-21T09:09:24Z.
The draw-based copy is up as #8999, stacked on this PR. It runs the copy as the title's draw with a driver pixel program, and a new execution test checks that only the texels a reference draw of the same triangle covers are written. It's for after this one merges.
AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-21T09:29:27Z.
@milescoviello thanks for marking it ready. Full CI found one problem on Linux (run 39574666009, llvmpipe; Windows is green):
agc_driver_depth_storagesegfaults right after the new refusal message:So on a device that can't sample the depth surface at its sample count, the refusal path crashes instead of refusing cleanly (llvmpipe hits it; the GPUs you tested probably don't). Could you take a look? We're reproducing it locally too and will add the line if we find it first.
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-21T09:39:04Z.
@oneandonlydean found it, it's the test. lavapipe samples depth only at 1 and 4 samples: llvmpipe 20.1 reports
sampledImageDepthSampleCountsandframebufferDepthSampleCountsas 1 | 4. The DB depth copy case inDepthStorage.cppused a two-sample surface, so the refusal itself is right. But that copy ran outside the expected-failure checks, so the exception left the test with depth surfaces and cached textures still alive. The segfault is most likely their teardown after the device was gone.The fix only touches the test. It uses 2 samples when the device can sample them, otherwise 4, and otherwise skips the multisample half. It also copies every sample of that count, not just 0 and 1. I'll push it as a new commit once it passes here under lavapipe and on the NVIDIA card. A title perf run has the machine for about another 15 minutes.
AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-21T09:53:25Z.
@oneandonlydean pushed as
223e90289b, a new commit that only touches the test.DepthCopyCasenow uses 2 samples when the device can sample them, otherwise 4, and skips the multisample half when neither works. It also copies every sample of that count.Under lavapipe (llvmpipe, LLVM 20.1.2),
agc_driver_depth_storagenow passes 3 of 3, and the 30 tests matchingdepth|Depth|db_copy|DbCopy|^agc_driver_graphics$pass (one of them skipped). On the RTX 4070 Ti they pass 3 of 3. I added this to the Tested section.#8999 is rebased on top of it. Its tree doesn't change, since it removes that test case anyway.
AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-21T10:09:32Z.
@milescoviello thanks, that matches what we see: lavapipe gives 1 | 4 for both depth sample counts, so the two-sample copy hit the refusal outside an expected-failure check.
223e90289breads right to us. It picks a count the device can sample, copies every sample of it, and keeps the past-the-end and extent refusals.One small addition, if you agree: with this change no device runs the new refusal itself. AMD and NVIDIA sample depth at 2, and lavapipe now takes the 4-sample path, so
Require(sampleable, "… cannot sample at its sample count")(DepthSurface.cpp:497) has no test. CouldDepthCopyCasealso take 2 samples when 2 is not insampledImageDepthSampleCounts(the old test showedDepthSurfaceViewstill creates that surface on lavapipe), and wrap the copy inExpectFailure(…, "cannot sample at its sample count", …)beforeClearDepthSurfaces? On lavapipe CI that runs the exact path that crashed, and it would show that the refusal fails cleanly once the exception is caught. That settles the "most likely teardown" question without anyone needing a debugger. On devices without such a count it just skips.Imported from boykopovar/AnyPS5. Originally posted by simonbbby on 2026-10-21T10:26:05Z.
I tested Dean's requested unsupported-count case at exact head
223e90289b643ba2465e82ffcd7d73c8c6794e26on native Linux. The refusal returns cleanly when caught before normal cache/device cleanup.DepthStorage.cppfrom the parent reproduces the original lavapipe failure: the expectedcannot sample at its sample countmessage, then exit 139. A GDB run places the SIGSEGV during__run_exit_handlers→StorageTextureCache::~StorageTextureCache→StorageTexture::~StorageTexture→StorageTexture::release→Context::Function<vkDestroyImageView>, rather than in the depth copy. The exception bypassesClearCachedTexturesinmain; unwinding destroysDevice(including unloading the Vulkan library) before process-exit cache destruction. This confirms the teardown explanation for the secondary crash.agc_driver_depth_storage_testspasses 3/3 on lavapipe, printingunsupported two-sample source refused cleanlyeach time.ExpectFailurerequires the specific sampling refusal, then the remaining one-sample copy/readback and normal teardown complete.agc_driver_graphics_testsalso passes.Ubuntu 24.04.3, GCC 13.3, Release; lavapipe Mesa 25.2.8 / LLVM 20.1.2; RTX 3090 / NVIDIA 595.99.02; gfx1036 (
1002:13c0) / RADV Mesa 25.2.8. Required Vulkan, shader cache disabled. No Khronos validation layer available, and no title run. All temporary edits were removed, the exact head rebuilt and the stock lavapipe test rerun successfully; checkout is clean.This can be folded into the existing PR; it adds the requested expected-refusal coverage without changing production code. It does not make arbitrary unexpected exceptions in this fixture safe to tear down.
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-21T10:27:32Z.
@oneandonlydean agreed. Thanks @simonbbby for the diff and for the GDB trace: the crash is the cache teardown after
Devicewas gone, as you showed, so that settles it. I've committed your addition unchanged as67cea1c314, with you as co-author. I'm building it now to run under lavapipe and on the 4070 Ti, and I'll push it when it passes.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-21T10:29:42Z.
Pushed
67cea1c314, @simonbbby's addition as is, with them as co-author. Under lavapipe,agc_driver_depth_storagepasses 3 of 3 and printsDB depth copy: unsupported two-sample source refused cleanlyeach time. The 30 depth tests pass under lavapipe and 3 of 3 on the RTX 4070 Ti, which samples two-sample depth and so skips the case. It's in the Tested section, together with simonbbby's RTX 3090 and RADV runs and the GDB finding.AI-assisted: yes (Claude Code)