fix(agc): accept a copy's sample selection on a draw that copies nothing #5937
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5937"
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-14T16:24:26Z.
What
Forspoken (PPSA03984) stops 43 s after start on
main:0xc0isDEPTH_COMPRESS_DISABLE(bit 6) andCOPY_CENTROID(bit 7), withDEPTH_COPYandSTENCIL_COPY(bits 2 and 3) clear (Mesa's GFX10.3 register definitions).COPY_CENTROIDandCOPY_SAMPLE(bits 8–11) select the sample a depth or stencil copy reads; AMD's PAL sets them only together with a copy (gfx9DepthStencilView.cpp), and #5499 uses them that way to pick the copied sample. On a draw with neither copy bit set, nothing is copied and they have no effect.DepthMaintenanceRejectionanddecodeDepthboth rejected them as if they were a copy.Both checks now accept bits 7–11. A draw with
DEPTH_COPYorSTENCIL_COPYis still rejected, whatever sample it selects.depthMaintenanceTestsgains0x80,0xc0(Forspoken's value),0x100,0xf00and0x2fe3as ordinary controls, and keeps a copy with a sample selection (0x84,0x108,0xf88) as maintenance. The clear test decodes a combined depth and stencil clear with0xc0and with0xf00added and requires the same clear, and still rejects a clear with a copy and a sample selection. Onmain'sState.cppthe test stops at "ordinary depth controls were mistaken for maintenance"; with onlyDepthMaintenanceRejectionchanged it stops indecodeDepthon0xe3.Tested
Ubuntu 24.04, GCC 13.3 (CI's compiler), Release with CI's configure flags, on
maine34c47921, RTX 4070 Ti with NVIDIA 595.99.02:libSceAgcDriverpass.agc_driver_stencil_ref_exportis skipped because the device lacksVK_EXT_shader_stencil_export, andagc_host_import_sparseandagc_driver_sparse_dma_buf_importbecause/dev/udmabufis not accessible here.--to-inteland run on Linux. The two runs differ only inlibSceAgcDriver.prx;mainran first with an empty shader cache, this PR second with the entriesmain's run had written:main: stops at 43 s with the error above.DB_RENDER_CONTROLrejection; it was still running at 99 s, when it reached the 12 GB memory cap I set for the run. That is a separate problem: started from a filled shader cache,mainreaches a 15 GB cap within 10 s as well, and a jemalloc heap profile of that start puts most of the memory in SPIRV-Tools optimization.maina08de6827(default unoptimized build, mock Vulkan device):agc_driver_graphicspasses 3 of 3, and with onlyGraphics/src/State.cppput back tomainit fails 3 of 3 atordinary depth controls were mistaken for maintenance.DB_RENDER_CONTROLmasks against the GFX10.3 register layout (0x101cindecodeDepth,~0x2fe3inDepthMaintenanceRejection): copy and resummarize/decompress still throw, and a sample selection without a copy is ordinary.agc_driver_graphicspassed, and failed withmain'sState.cppatordinary depth controls were mistaken for maintenance.tools/check_conventions.py --base upstream/mainpasses, andtools/pr_overlap.py --branchfinds no overlap.PPSA03984-app0) on currentmain8856f180c, 1920x1080, pad input, one run each:mainstops at 22 s on theDB_RENDER_CONTROLcheck (#5937); with #5937 it stops at 61 s on the indirect vertex buffer read (#5975); with #5937 and #5975 at 116 s on the depth pyramid view (#5982); with all three it draws an in-game scene by 60 s (the lower half still black, about 4 FPS) and runs to 195 s, wherevkAllocateMemoryfor a render target fails withVK_ERROR_OUT_OF_DEVICE_MEMORYon the 12 GB RTX 4070 Ti. The memory goes to retired depth surfaces that are never freed. With #6465 added as well, it reaches a 600 s limit (onmain0c4816f61).Not checked on Windows or on a console.
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
Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-15T02:09:35Z.
I ran this PR's test on Linux.
Setup: this PR's diff applied to main at
8cd937e29(the PR's base is 421 commits behind it), default CMake build (CMAKE_BUILD_TYPE empty, unoptimized), clean environment.ctest -R '^agc_driver_graphics$', 3 runs each. The test did not open a GPU device, so this is a CPU-only run.So the new test catches the old behaviour here. I did not check Windows, macOS or a real GPU.
Note: #5855 also edits Graphics/src/State.cpp and the same
DepthStencilTestsarea of tests/Graphics.cpp, so whichever of the two merges second will likely need a rebase.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-15T02:13:55Z.
Thanks for running it. I've rebased the branch onto
main760ffa683; there were no conflicts,agc_driver_graphicspasses on an RTX 4070 Ti, andtools/check_conventions.pypasses. Noted about #5855 — whichever lands second gets a rebase.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-15T11:05:04Z.
Thanks. I reran the same Linux check on the current head 573bf5aea, after the latest push. Its change has the same
git patch-id --stableas the head I tested before (802ff5d52), so only the line numbers moved.Setup: head 573bf5aea merged into main at
a08de6827(no conflicts; main has 14 commits that the head does not), default CMake build (CMAKE_BUILD_TYPE empty, unoptimized), clean environment (env -i, only HOME, PATH and VK_ICD_FILENAMES set).ctest -R '^agc_driver_graphics$', 3 runs each. CPU-only as before (the test uses a mock Vulkan device).So the result from my first run holds on this head. I did not check Windows, macOS or a real GPU.
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T12:11:52Z.
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/src/State.cppL258-261, L918core/libs/prx/libSceAgcDriver/Graphics/src/State.cppL258-259Some 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/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppImported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-16T11:47:59Z.
Checked the
DB_RENDER_CONTROLmasks against the GFX10.3 register layout (0x101cindecodeDepth,~0x2fe3inDepthMaintenanceRejection): copy and resummarize/decompress still throw, a sample selection without a copy is ordinary.agc_driver_graphicspasses, and fails onmain'sState.cppat "ordinary depth controls were mistaken for maintenance". Merging once the full Build is green.Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-16T11:53:09Z.
Thanks for checking the masks. One thing that will hold up the Build:
mainat65d56a297doesn't compile on Linux with libstdc++. #5875's journal guardsMeshConfigurationat 36 bytes, and #5884 made it 40, soPipelineJournal.cppstops on itsstatic_asserts. #6784 fixes that (MarcZX100 approved it). Until it lands, the Linux job here fails for that reason, not this change.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-16T16:35:38Z.
An update for the Build: #6784 is in, so
maincompiles on Linux again. One test still fails onmainitself:agc_driver_graphics, since #5804 (#6792, a zero-filled vertex code span). #6789 fixes it and is approved, so a Build of this PR before #6789 lands will show that one failure regardless of this change. With #6789 applied,agc_driver_graphicspasses with this PR, as you saw.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-16T18:06:52Z.
Rechecked on current main
93e54cedd: head merges cleanly,agc_driver_graphicspasses and still fails on main'sState.cpp; merging once the full Build is green.