feat(libSceAgcDriver): support polygon primitive type 21 #7175
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7175"
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 pushkarreddyy on 2026-10-17T14:55:24Z.
What
Support primitive type 21 (
PrimitiveType::Polygon, 0x15) inlibSceAgcDriver:core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp, map primitive 21 toVK_PRIMITIVE_TOPOLOGY_TRIANGLE_FANinDecodeStatealongside triangle fan (case 5).DrawRejectionand inDrawPrecheck.cpp(precheckDraw).inactiveVertexPointSize, mark point size inactive for primitive 21 draws, consistent with triangle fans and strips.decodeConservativeRasterizationandnonTriangleRejection, include primitive 21 alongside triangle fans and strips.core/libs/prx/libSceAgcDriver/tests/Graphics.cpp(PolygonPrimitiveTestsand primitive restart tests) verifying state decoding, restart handling, raster primitive classification, and precheck acceptance, and add primitive 21 toinactiveVertexPointSizeTests,singleSampleMsaaTests, andconservativeRasterizationTests.docs/dev/debt/libSceAgcDriver.md.Tested
PolygonPrimitiveTestsverifies thatVGT_PRIMITIVE_TYPE = 21decodes toVK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN, classifies as triangle primitive inRasterPrimitiveOf, preserves primitive restart when configured, and passes draw prechecks.python tools/check_conventions.py --base origin/mainpasses with 0 findings and 0 errors.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 oneandonlydean on 2026-10-17T15:07:00Z.
Thanks @pushkarreddyy. Mapping primitive type 21 to
VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FANlooks sound, and since 21 threw before, no title that works today changes.One blocker: the new test will fail. The single-sample MSAA loop in
tests/Graphics.cppnow includes21uand expectsDrawRejectionto be empty. ButnonTriangleRejectioninGraphics/src/State.cppstill accepts only primitive types 4, 5 and 6 (plus 7/17 for rectangles), so for 21 it returns the "primitives other than triangles" rejection andagc_driver_graphicsfails. The fix is to add21uto that check, next to the one you already added inrequireConservativeTriangles.A smaller point: the draw precheck (
DrawPrecheck.cpp) still rejects indexed draws with primitive restart for type 21. It fails closed, so it isn't dangerous, but the PR's claim that restart works for polygons isn't true end to end yet. Either allow it there (with a test) or drop the claim.After a new head we'll run full CI (the Linux and Windows build lanes were skipped on this PR's own run).
Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-17T15:15:04Z.
Hi @oneandonlydean,
Thank you for the quick and thorough review! Both points have been addressed in the amended commit:
onTriangleRejection**: Added *primitive != 21u to
onTriangleRejection in Graphics/src/State.cpp (alongside 4, 5, 6), so single-sample MSAA and single-sample depth scans accept polygon draws and pass the 21u assertion in singleSampleMsaaTests.
Local pre-flight checks (python tools/check_conventions.py --base origin/main) pass cleanly with 0 findings and 0 errors.
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-17T15:30:25Z.
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.cppL120, L1042-1043core/libs/prx/libSceAgcDriver/tests/Graphics.cppL120core/libs/prx/libSceAgcDriver/tests/Graphics.cppL196, L8747core/libs/prx/libSceAgcDriver/tests/Graphics.cppL196, L8747docs/dev/debt/libSceAgcDriver.mdL48-49Some 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/Execution/src/Driver/Draw/DrawPrecheck.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawPrecheck.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawPrecheck.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawPrecheck.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/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/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/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/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawPrecheck.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawPrecheck.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/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/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdImported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-17T15:37:26Z.
Full CI on d8536140a (run 39044632528) fails
agc_driver_graphicson both Linux and Windows. The failing line isAGC graphics: the precheck rejected a direct polygon draw, so theDriver::precheckDrawpath still rejects type 21 in that test. Main's latest push build passes this test, so it comes from this change. Could you take a look?Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-17T15:39:48Z.
I checked run 39044632528 because its event metadata says
workflow_dispatchfrommain. The Windows job log confirmsPR_NUMBER=7175,PR_HEAD=d8536140a85566cd2383433f5a2a63ed5a8084a7, fetchedrefs/pull/7175/head, and merged it before building. Both Linux and Windows failedagc_driver_graphicswith the direct-polygon assertion reported above. The later Build run on this same head skipped both application lanes, so it does not provide a passing rerun of that failure.Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-17T15:46:46Z.
Thanks @oneandonlydean for the CI run and finding!
The failure in
PolygonPrimitiveTests()was caused bymakeState()having an active pixel program (queue.shader[0x008] = 0x100), which causesAgcDriver::Graphics::DrawRejectionto validate thatSPI_PS_INPUT_ENA(DWORD0x1b3) andSPI_PS_INPUT_ADDR(DWORD0x1b4) are present in context before clearing a draw. BecausePolygonPrimitiveTests()did not set0x1b3and0x1b4,DrawRejection(queue, false)returned"AGC graphics: missing register at DWORD 0x1b3", triggering theRequirecheck.I have updated
PolygonPrimitiveTests()incore/libs/prx/libSceAgcDriver/tests/Graphics.cppto setqueue.context[0x1b3] = 2andqueue.context[0x1b4] = 2(matchingstateTests()andConservativeRasterizationTests()), verified conventions pass with 0 errors, and force-pushed commit555b7e824.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-17T17:55:21Z.
I checked the updated head
555b7e824. The previous full CI failure was ond8536140a, and the updated head currently has only eligibility/conventions/report checks; Linux and Windows build/test jobs are skipped. The new test setup addresses the reported missing-register cause, but the direct-polygon precheck path still needs an actual rerun on this head to confirm the original failure is cleared.Imported from boykopovar/AnyPS5. Originally posted by gjonn on 2026-10-17T19:46:01Z.
Another data point from PPSA01317 on current main, Windows 11, RTX 5090 Laptop: this PR fixes its abort
AGC graphics: unsupported primitive type 21, which hits right after the title's first frames. With this PR cherry-picked (it applied cleanly), the title gets past that draw and keeps booting.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-18T10:29:33Z.
@oneandonlydean Cleanly rebased onto latest
origin/main(f07df0796).The register setup in
PolygonPrimitiveTests()now includes the SPI input registers (0x1b3/0x1b4) required byDrawRejection, and @gjonn confirmed on hardware (RTX 5090) that this PR resolves the runtime abort on Gran Turismo 7 (PPSA01317). Ready for review when convenient!