feat(agc): draw line-strip output of NGG geometry programs as mesh lines #5884
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5884"
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 AnthonyClemens on 2026-10-14T14:42:14Z.
What
A draw whose NGG geometry program outputs line strips (
VGT_GS_OUT_PRIM_TYPE= 1) is refused onmainwithunsupported geometry input or output assembly. Resident Evil 2 (PPSA04288) hits this with point-list input andVGT_GS_MAX_VERT_OUT= 5.On GFX10 NGG the geometry program assembles the strip itself: each primitive export is one line whose two vertex indices are packed the same way as a triangle's three (
ac_nir_lower_ngg_gs.c,ac_nir_pack_ngg_prim_exp_arg). So the host only has to change the output topology:DecodeShaderStagesacceptsVGT_GS_OUT_PRIM_TYPE1 from a geometry program (also with fast launch) and records a two-vertex output primitive in the mesh configuration. The value encoding is from Mesa'sgfx10.json.OutputLinesEXTand aPrimitiveLineIndicesEXTarray of two-component indices; validation and the raster class (Line) follow it.VGT_GS_MAX_VERT_OUT - 1lines, and a subgroup gets at leastGE_MAX_OUTPUT_PER_SUBGROUPline slots, because Mesa's lowering exports one primitive (possibly null) per emitted vertex and RADV programsPRIM_AMP_FACTORasvertices_out. Fast launch keeps taking the count fromPRIM_AMP_FACTOR. Triangle strips keep their current budget.Triangle-strip geometry is unchanged: the 29 triangle mesh modules from
agc_driver_meshare byte-identical before and after. Points, rectangle lists, per-stream output types and line strips from a vertex program still throw. Line width and the console's line rules are not measured;docs/dev/debt/libSceAgcDriver.mdrecords that and the primitive budget.Overlap: this bumps the serialization version from 25 to 26, as #4706 also does. Whichever lands second moves to 27. It also sits near #5604 in
DecodeShaderStages; neither depends on the other.Tested
Windows 11, MinGW-w64 GCC 15.2.0, Release, AMD Radeon RX 9070 XT.
agc_driver_graphics: the title's register state decodes as geometry rasterized as lines, with 255 line slots for 51 points; the same draw with a triangle strip is unchanged; values 0, 3 and per-stream types still throw; a fast-launch line strip takes 64 lines fromPRIM_AMP_FACTOR; triangle input with line output now refuses a triangle-only polygon offset.agc_driver_mesh: a hand-written geometry program draws line strips from points, and pixels are checked on both segments, beside them, inside the strip's triangle and on its closing edge. Onmainit fails because the second line is drawn as a triangle.agc_shader_memoryandrequest_serializer: the output size round-trips at version 26 and changes the cache keys; version 27 is refused.mainwith the title's message, and the mesh test fails onmainas above.spirv-val --target-env vulkan1.3.ctest: 1170 of 1171 pass, 10 expected skips.agc_driver_layered_volume_vertex_no_gplfails on this GPU onmaintoo.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 fdfawef324 on 2026-10-15T05:02:26Z.
Resident Evil 4 (PPSA07411), the RE2 engine sibling, stops on
mainat the same check this PR changes. Windows Server 2025, RTX 3060 12 GB, driver 591.86, MinGW GCC 15.2 Release.maineea428ca8+ #6126 (so the title gets past a Json2 boot stop) stops after 739 s, at 42.7 FPS, onAGC graphics: VGT_SHADER_STAGES_EN=0x2030: unsupported geometry input or output assembly.main8cd937e29, runs 801 s (21,930 frames, 60.6 FPS). It doesn't hit the geometry refusal again. It stops later on an unrelated recompiler refusal (GetImageResource dword 0 is not a valid runtime value, stage 7).Rebase notes, in case they help. All source files merged automatically except the request serializer:
mainalready uses request versions 26 (#4706) and 27 (#5314), so this PR's version becomes 28. InRequestSerializer.cppthe auto-mergedif (version >= 26u) configuration.outputPrimitiveSize = reader.ReadU32();has to becomeversion >= 28u. Otherwise v26/v27 requests misread the mesh configuration.RequestSerializerTests.cpp: keep main's added bytes, change the version bytes 27→28 and the "future" version to 29.tests/ShaderMemory.cpp: the version prefix becomes"NVNQQRwAAAA="and the unsupported list{"NVNQQQAAAAA=", "NVNQQR0AAAA="}.request_serializer,agc_shader_memory,agc_driver_graphicsandagc_driver_meshpass on that rebase. Not tested: other GPUs, the frame contents (RE4's output is still black at this point onmain), Linux.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by simonbronk on 2026-10-15T10:05:26Z.
Tested on a second RE Engine title: Onimusha: Way of the Sword (PPSA27836). Windows 11, RTX 5070 (NVIDIA 617.42).
Base:
main0afa6a607with the title's other PRs (#5907, #5776, #5770, #5703, #5841). Without this PR, the title stops right after New Game:With this PR that draw passes, and the scene load goes on to a different, unrelated stop (a depth target with fewer samples than the rasterizer, handled by #5915 and #5907).
The merge onto current
mainconflicts inRequestSerializer.cpp, becausemainalready uses serialization versions 26 to 29. I resolved it locally by moving this PR'soutputPrimitiveSizeread toversion >= 30uand writing version 30. The test conflicts (ShaderMemory.cpp,RequestSerializerTests.cpp) were left onmain's side for the title run, so I didn't run the PR's own tests.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T12:11:07Z.
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/Mesh.cppL362core/libs/prx/libSceAgcDriver/Graphics/src/ShaderValidation.cppL597-598core/libs/prx/libSceAgcDriver/Graphics/src/State.cppL873-893core/shader/recompiler/CacheKey.hppL107core/shader/recompiler/Optimization/include/Optimization/ShaderStageInputInfo.hppL94core/shader/recompiler/Translation/src/ShaderInputInfoBuilder.cppL219-220core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppL3062, L3180core/shader/recompiler/ControlFlow/src/RequestSerializer.cppL779, L812core/shader/recompiler/tests/RequestSerializerTests.cppL209, L248, L273, L397, L410, L429, L431Some 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/tests/ShaderMemory.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawLookup.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawRegisterKey.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppcore/shader/recompiler/CacheKey.hppcore/shader/recompiler/Recompiler.hppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderValidation.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawRegisterKey.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/shader/recompiler/CacheKey.hppcore/shader/recompiler/ControlFlow/src/RequestSerializer.cppcore/shader/recompiler/Optimization/include/Optimization/ShaderStageInputInfo.hppcore/shader/recompiler/Recompiler.hppcore/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cppcore/shader/recompiler/Translation/src/ShaderInputInfoBuilder.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawRegisterKey.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/shader/recompiler/ControlFlow/src/RequestSerializer.cppcore/shader/recompiler/Recompiler.hppcore/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawLookup.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawRegisterKey.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppcore/shader/recompiler/Recompiler.hppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawLookup.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawRegisterKey.cppcore/shader/recompiler/Recompiler.hppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawLookup.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawRegisterKey.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/shader/recompiler/Recompiler.hppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/shader/recompiler/CacheKey.hppcore/shader/recompiler/ControlFlow/src/RequestSerializer.cppcore/shader/recompiler/Recompiler.hppcore/shader/recompiler/tests/RequestSerializerTests.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawLookup.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/shader/recompiler/Recompiler.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderValidation.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/shader/recompiler/CacheKey.hppcore/shader/recompiler/ControlFlow/src/RequestSerializer.cppcore/shader/recompiler/Recompiler.hppcore/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cppcore/shader/recompiler/tests/RequestSerializerTests.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawLookup.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawRegisterKey.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderValidation.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/shader/recompiler/CacheKey.hppcore/shader/recompiler/ControlFlow/src/RequestSerializer.cppcore/shader/recompiler/Optimization/include/Optimization/ShaderStageInputInfo.hppcore/shader/recompiler/Recompiler.hppcore/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cppcore/shader/recompiler/Translation/src/ShaderInputInfoBuilder.cppcore/shader/recompiler/tests/RequestSerializerTests.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/shader/recompiler/Recompiler.hppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/shader/recompiler/Recompiler.hppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderValidation.cppcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/shader/recompiler/CacheKey.hppcore/shader/recompiler/ControlFlow/src/RequestSerializer.cppcore/shader/recompiler/Recompiler.hppcore/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvModuleSetup.cppcore/shader/recompiler/tests/RequestSerializerTests.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawLookup.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawRegisterKey.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppcore/shader/recompiler/Recompiler.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppImported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-16T11:13:00Z.
Checked on the PR merged onto current
main:agc_driver_graphics,agc_driver_mesh(runs on RADV, pixels on both segments),agc_shader_memoryand the serializer tests pass, and the new tests don't build without the change. Triangle-strip output, points, per-stream types and vertex-program line strips are unchanged and still throw. Line width and the console's line rules are recorded in the debt entry. Merging once CI is green.