fix(agc): decode primitive type 3 as a line strip #4584
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4584"
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 xXPBSXx on 2026-10-12T16:13:34Z.
What
DecodeStatemappedVGT_PRIMITIVE_TYPE1, 2, 4, 5, 6, 7, 9 and 17 and threwAGC graphics: unsupported primitive type 3for 3, the line strip (V_008958_DI_PT_LINESTRIP 0x3in Mesa'sr600d.h, the same enum that gives 2 = line list and 4 = triangle list). Type 3 now decodes asVK_PRIMITIVE_TOPOLOGY_LINE_STRIP.RasterPrimitiveOfinState.cpp(the primitive class a pixel shader sees when it reads the ancillary word) maps the line strip toRasterPrimitive::Lineas well, so a strip no longer falls to the triangle default (review of this PR).The other places that depend on the topology already handled the strip class and needed no change:
Primitive restart:
Draw.cpp,Pipeline.cppand the draw precheck treat type 3 as a strip (restart allowed withoutVK_EXT_primitive_topology_list_restart), and Vulkan allows restart forLINE_STRIP.ValidateProvokingVertexalready acceptsLINE_STRIP.The conservative-rasterization and single-sample MSAA checks already name type 3 as lines and refuse it.
One change beside the case: the point and line depth bias enable (
PA_SU_SC_MODE_CNTLbit 13) is rejected on point and line draws because Vulkan applies depth bias to polygons only (af9e60b69).pointsOrLinesinState.cppnow includes the line strip so the bit is still rejected there.Tests (
agc_driver_graphics):LineStripTests: type 3 decodes toLINE_STRIP; with primitive restart enabled (user config register0x24b) and reset index0xffffffff(context register0x103) the restart is kept and the draw precheck accepts an indexed draw.The provoking-vertex loop now includes type 3.
The depth bias test refuses the point and line enable bit on type 3 like on type 2.
Without the
State.cppchange the test fails withunsupported primitive type 3.Tested
Windows 10, MinGW,
agc_driver_graphicspasses with the change and fails without it as above (checked before the last rebase). After the rebase onto main2a5eca11cit passed in 8 of 10 runs; of the two failures I saw the message of one:host import of ... failed at vkAllocateMemory (-2)followed bywrite-watched arena contained no host exclusion to test, which is unrelated to line strips. I did not check whether the test fails the same way on plainmainunder load.tools/check_conventions.py --base upstream/mainpasses.Branch rebased onto
mainc13dc7e6b, built there (Windows 10, MinGW, Release):agc_driver_graphicspasses 10 of 10 runs with the change; with theRasterPrimitiveOfpart taken out the test fails (a line strip draw did not get the line primitive class, 2 of 2 runs).After the rebase onto main
0c3dc9ca2(a conflict intests/Graphics.cppwith the newaliasedBufferViewTests; both tests kept) the branch was built on that main andagc_driver_graphicspassed 10 of 10 runs on Windows 10. Then rebased once more onto37dd48308without a conflict (not rebuilt).Not tested: no game run, no Vulkan draw of a line strip. Record of Lodoss War -Deedlit in Wonder Labyrinth- (PPSA05347) stopped on
unsupported primitive type 3in two user runs (after about 270 s and about 73 s); whether it runs on past this stop is untested. The enum source is the older-generationr600d.h; I did not check the value against a GFX10 header.Overlap: #4587 made the same
case 3change inState.cpp; it was closed in favour of this PR.Checklist
Based on current
main(last build on0c3dc9ca2, later rebases not rebuilt); no other open PR makes the same change (#4587 was closed)One topic per PR; follow-ups go in a new PR
No comments in code except technical debt
Unimplemented paths throw; no silent stubs added
No notes, investigation
.mdfiles or images added to the repositoryNew third-party code is a submodule built from source (none added)
Generic behaviour, not specific to one title
Depends on: none
Unblocks: none
AI-assisted: yes
AI-assisted (Claude Code).
🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-12T17:30:23Z.
Correction to my comment above (I overstated it): the test run of Record of Lodoss War -Deedlit in Wonder Labyrinth- (PPSA05347) with a local build of
main2a5eca11c+ this PR (1858502b4) + #4491 reached the 300 s limit with nounsupported primitive type 3in the log, but the player left the game standing in a dialog for most of the run, so it did not go through the new game and the later dialogs as I wrote. The earlier aborts happened after progressing through dialogs (about 73 s to 270 s), so this run does not show that the stop is gone. It only shows that sitting in the first dialog does not hit it. I will repeat the run while playing on and report the result here.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by kr4y4 on 2026-10-12T18:15:50Z.
The
agc_driver_graphicsfailure in the Tested section (write-watched arena contained no host exclusion to test) isn't from this change. That check depends on the process's address layout and fails in about 2.5 % of starts onmaintoo. Details and a fix are in #4660.Written with AI assistance.
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-12T20:06:41Z.
Windows test of the LineStrip change (
1858502b4):agc_driver_graphics(Vulkan, RTX 4080 SUPER, MinGW,-j2, nothing else running) passed 9 of 10 runs. The failing run logged[gpu] host import of 0x11226110000+0x20000 failed at vkAllocateMemory (-2); falling back to copies(-2isVK_ERROR_OUT_OF_DEVICE_MEMORY).Control on plain
main3e0e01f35without this commit: 8 of 10 passed, and the two failing runs show the samevkAllocateMemory (-2)message. So the flakiness is present onmainand not caused by this change. The sample is small and I did not investigate the cause of the-2. The LineStrip test itself never failed on its own in these runs.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-12T20:35:40Z.
Correction to the flake note above: the
host import ... failed at vkAllocateMemory (-2)lines I quoted are not the cause of theagc_driver_graphicsfailure. The cause is the one in #4660:hostWriteWatchExclusionTestsneeds a host region inside the write-watched arena, and some process address layouts have none ("write-watched arena contained no host exclusion to test"). It also fails on plainmain, independent of the line strip.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-13T02:43:48Z.
One place is missed:
RasterPrimitiveOfinState.cppmaps onlyVK_PRIMITIVE_TOPOLOGY_LINE_LISTtoRasterPrimitive::Line, so a line strip falls to the default and a pixel shader that reads the ancillary word gets the triangle class. Please addVK_PRIMITIVE_TOPOLOGY_LINE_STRIPthere, with a check inLineStripTests.#4587 is the duplicate; this is the one to keep.
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-13T03:24:18Z.
Done:
RasterPrimitiveOfmapsVK_PRIMITIVE_TOPOLOGY_LINE_STRIPtoRasterPrimitive::Linenow, andLineStripTestschecks it (the test fails without that part:a line strip draw did not get the line primitive class). The branch is one commit onmainc13dc7e6b;agc_driver_graphicspasses 10 of 10 on Windows there. Thanks for the pointer, and for choosing this over #4587.AI-assisted (Claude Code).