feat(agc): implement primitive-ordered pixel shaders with fragment shader interlock #1130
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1130"
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-07T13:20:32Z.
What
DecodeStateand the draw precheck rejected DB_SHADER_CONTROL bit 16, PRIMITIVE_ORDERED_PIXEL_SHADER (field), which orders the pixel shaders of overlapping primitives.orderedPixelShader, and such a shader runs in aPixelInterlockOrderedEXTinterlock (extension) up to its return, not to ORDERED_PS_DONE. Its collision SGPRs read 0, so the title skips its POPS wait and runs its per-collision loop once (TechnicalDebt). An invocation that a BDA read fault kills ends the interlock before itsOpKill.fragmentShaderPixelInterlockthe recompile throws, as does a nonzero POPS_OVERLAP_NUM_SAMPLES. The field is in the cache and draw keys and the serialized request (version 11, after #1182's 10); the disk cache format stays 7, as only the key grows.ValidateShadersmode line withPixelInterlockOrderedEXT. #423, #448, #1077, #1190, #1383 and #1442 change the serialized request too; #448, #1190, #1383 and #1442 write version 10 as well, so they need a later number now, and whichever of them lands after this one needs 12 or more. #1112 and #1184 add lines next to ours inVulkanDevice.cpp, #1112, #1252 and #1333 intests/Graphics.cpp, and #1190 inShaderMemory.cpp.Tested
main0e173a46: configure-DBUILD_TESTING=ON, full build,--target libs,ctest:ctest --output-on-failure)VK_DRIVER_FILES): 423/423 pass;agc_driver_flat_storeis left out there because it takes several minutes on Windows llvmpipeorderedPixelShaderTests(agc_driver_graphics) also walks every path of an ordered shader with BDA reads and requires oneOpEndInvocationInterlockEXTbefore each exit, 5 fault kills included; without the End inStopBdaInvocationIfit fails. It does not compile onmain.agc_driver_pixel_interlock: 64 overlapping triangles add 1 to a dword per pixel; every pixel counts 64 on an RTX 3080 and lavapipe (2 on the RTX 3080 without the interlock); when a BDA read fault kills every 8th column, the others still count 64. It does not compile onmain.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 (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-07T21:29:05Z.
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.cppL67core/libs/prx/libSceAgcDriver/tests/Graphics.cppL1887core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppL759-760, L764core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppL759-760, L764Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-07T21:51:55Z.
The linux job here didn't get to the build: it hung on
apt-get update(the Ubuntu mirror) and was cancelled at the 30-minute limit. Windows, conventions and report pass, so a re-run of the linux job should be all it needs.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-08T08:12:20Z.
Review: CHANGES_REQUESTED
Checked on current
main(build + ctest 425/425,agc_driver_pixel_interlockruns on a device withfragmentShaderPixelInterlock; the new tests don't compile without the change). The linux job failed on a hungapt-get update; I re-ran it.One thing before merging:
OpBeginInvocationInterlockEXTand thenOpEndInvocationInterlockEXTexactly once. An End before everyOpReturn(SpirvFlowEmitter.cpp:91) is fine for that, butStopBdaInvocationIf(SpirvBdaFault.cpp:95) emitsOpKillin pixel shaders between Begin and End when a BDA read faults (the four call sites inSpirvBdaRead.cpp), so that invocation leaves the critical section without End. Please emit End before thatOpKillwhen the ordered mode is on, and add a test case where an ordered pixel shader takes the fault path.Everything else (key/serializer v10, legacy request, TechnicalDebt placement) looks right. Note #423/#448/#1182/#1190 also take request version 10: whichever lands second moves to the next one.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-08T09:33:46Z.
Review: APPROVED
mainnow uses request version 10 for the compute scratch size (#1182), so I rebased this onto it and moved the ordered-pixel field to version 11 (RequestSerializer.cppwrite/read/limit,ShaderMemory.cpp: new prefix, unsupported versions 0 and 12, a legacy v10 request added, mapping offset unchanged at +163). Build + ctest 431/431 on Linux (RADV); the new tests don't compile without the change. The OpKill/End fix from the earlier review is in and the mutation without it fails.Pushing the rebase now; merging once CI is green on the new head. The PR description still says "version 10": it is 11 now.
Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-08T09:38:29Z.
Thanks for doing the rebase and the move to version 11 yourself, and for checking the mutation. I've updated the description: it now says version 11 and lists which of the other request-changing PRs still write 10. I'll move our #1485 and #1492, which also wrote 10, to 12 and 13 so they don't collide with this one.