fix(agc): accept aliased views of the guest buffers in graphics shaders #4381
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4381"
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 Celegans12 on 2026-10-12T08:24:22Z.
What
The SPIR-V emitter declares extra views of the guest buffers binding when a shader needs them:
buffers_coherentfor GLC or DLC accesses (#2369) andbuffers_u64for 64-bit atomics. Each is another StorageBuffer variable on the same set and binding, decoratedAliased, which Vulkan allows when the types fit the descriptor.ShaderValidation, which checks the stages of every draw (compute dispatches are not validated), accepted one StorageBuffer variable per binding with u32 elements only. A vertex, tessellation or pixel shader with a GLC store next to a plain access, or with a 64-bit buffer atomic, was refused at draw time with "duplicate SPIR-V resource binding".Aliased; an aliased view may hold u64 elements.PPSA26344 stopped on this at a pixel program (0x80003a6b00). Its shader cache holds 32 graphics programs that declare
buffersandbuffers_coherenton one binding (26 vertex, 1 hull, 1 domain, 4 pixel), so any draw using one of them was refused.#4250 and #4085 add 8- and 16-bit views of the same binding; they need the same acceptance for u8 views, which can follow once one of them lands.
Tested
Based on
main1c5e6287. Windows 11 (MinGW-w64 GCC 15.2.0) and Linux: configure -DBUILD_TESTING=ON, full build, --target libs, ctest.log_macrosalso fails onmainhere.main: 1002/1003;agc_driver_depth_compare_copyalso fails onmainthere.agc_driver_graphicsrecompiles pixel shaders with a GLC store and with a 64-bit atomic, validates them, and checks that the same modules withoutAliasedare refused. It fails on main with "duplicate SPIR-V resource binding".Not tested: console behaviour.
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)Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-12T15:07:06Z.
Rebase handoff — rebased onto current
main, authorship unchanged.One test-file conflict: main landed the stencil-reference export tests where this PR adds its aliased-buffer-view tests — kept both test families and both calls.
Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release,
BUILD_TESTING=ON, AMD RX 9070 XT / RADV):tools/check_conventions.py --base origin/mainpassesTo pick it up:
Head is
926492c95.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-13T00:19:43Z.
Conflicts with main in
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp(the stencil-reference export tests landed where this adds its own); please rebase.Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-13T00:46:43Z.
@oneandonlydean done.
Thanks @blawesom for doing the rebase and running the whole suite on RADV, that's a GPU I can't test here. I've just force-pushed a rebase onto a newer
main(1c5e6287) rather than fast-forwarding to your branch, sincemainhad moved again in the meantime. I resolved theGraphics.cppconflict the same way you did, keeping the stencil-reference export tests and the aliased buffer view tests side by side; the only difference from your 926492c is a stray blank line inmain().On my side the Windows NVIDIA run is 1019/1020 and the Linux job on WSL lavapipe, merged with
main, is 1002/1003. The two failures,log_macroson Windows andagc_driver_depth_compare_copyon lavapipe, fail on plainmainhere as well.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-13T00:54: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/tests/Graphics.cppL4078, L5126