feat(agc): decode GS_FAST_LAUNCH geometry with one point per subgroup #4702
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4702"
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 tv7 on 2026-10-12T19:14:52Z.
What
First step for #3880, as discussed there: decode
VGT_SHADER_STAGES_EN.GS_FAST_LAUNCH = 1for the case games use, and keep throwing for everything else.Marvel's Wolverine (PPSA03671) links geometry programs with
VGT_SHADER_STAGES_EN=0x482030(GS_EN, ES_EN=2, PRIMGEN_EN, GS_W32_EN, GS_FAST_LAUNCH=1). The rest of its state, captured atsceAgcLinkShaderstime: primitive type 1 (point list),GE_CNTL=0x201(one vertex and one primitive per group),GE_NGG_SUBGRP_CNTL=0x40(PRIM_AMP_FACTOR 64),GE_MAX_OUTPUT_PER_SUBGROUP=0x20,VGT_GS_MAX_VERT_OUT=0x20,GE_USER_VGPR_EN=0,SPI_SHADER_PGM_RSRC1_GS=0x022c0245,RSRC2_GS=0x9002a. Its draws areDRAW_INDIRECT(0x24) with no base vertex or start instance location.This matches how RADV drives mesh shaders on gfx10.3 (
mesh_fast_launch_2off): a point-list draw ofx * y * zvertices, one subgroup per point, and the shader takes its workgroup index from the vertex id of its first thread (ac_nir_lower_ngg.c, "the HW doesn't support a proper workgroup index for vertex processing stages, so we use the vertex ID"). Wolverine's program does the same: thread 0 readsv5, looks up its work in a buffer and shares it through LDS. The subgroup size followsac_compute_ngg_workgroup_size: the larger of the vertex limit andPRIM_AMP_FACTORprimitives.The mesh prologue already gives
v5the point's vertex id when a subgroup holds one point, so the change is in the decode:DecodeShaderStagesaccepts GS_FAST_LAUNCH = 1 only with a point list andGE_CNTLgroups of one vertex and one primitive. It takes the primitive limit fromGE_NGG_SUBGRP_CNTL.PRIM_AMP_FACTORinstead ofVGT_GS_MAX_VERT_OUT - 2, and does not require full GS and ES VGPR counts (the program gets a superset of its inputs).prepareDrawInputs). Non-indexed indirect draws on the mesh path are already resolved by the driver into direct draws.Tested
Windows 11, RTX 3070, GCC 15.2.0 UCRT, Release, on main
d53960612.agc_driver_graphics: Wolverine's register values decode to one point per subgroup, 32 vertices, 64 primitives, 64 threads, wave32, 128 LDS dwords. Fast launch 2, a group of two, a triangle list and a zero amplification factor throw. Fails on main withVGT_SHADER_STAGES_EN=0x482030: unsupported geometry routing, fast launch or wave-ID state.agc_driver_mesh(GPU): a hand-encoded wave32 fast-launch program reads its workgroup index fromv5withv_readfirstlane, loads one triangle per subgroup and exports it. A direct draw of 40 points draws all 40 triangles; a draw of 20 points starting at vertex 10 draws exactly triangles 10 to 29; an indexed fast-launch draw is refused.tools/check_conventions.pypasses.a11c8f7f7plus #757, #3588, #3633, #3846, #3867 and #3831 (current main does not reach this point without #757): without this change it stops at link time with the error above. With it, the four fast-launch draws decode and the title continues until a separate wave64 vertex program fails withconditional block 5 has no structured merge, before those draws reach the GPU. So the fast-launch draws themselves are covered by the GPU test, not yet by the title.DecodeShaderStages.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🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-12T23:24:44Z.
Windows test (MinGW GCC 15.2, Release, Windows 10, RTX 4080 SUPER). Built in a batch with five other open GPU PRs cherry-picked onto main
44ab0c39e(not current main, which needs a submodule that isn't checked out here), so only the tests that belong to this PR say anything about it:tests/Mesh.cpp(agc_driver_mesh): 3 of 3 runs passed.tests/Graphics.cpp(agc_driver_graphics, this PR's change is in that file too): see below.agc_driver_graphicsover the batch: 9 of 10 runs passed. The one failure is the known address-layout flake from #4660 as far as I can tell: I kept only the first lines of that run's log (thehost import ... vkAllocateMemory (-2)lines, which appear in passing runs as well), not its final error message, so I can't confirm the cause for that one run. Plainmainfailed 2 of 10 on the same machine earlier.Not tested: no game run; the batch was not rebuilt per PR, so a failure would have needed a bisect (there was none besides the flake).
AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-13T02:43:12Z.
Please add a
docs/dev/debt/libSceAgcDriver.mdentry for the fast-launch decode: one point per subgroup with the primitive limit fromGE_NGG_SUBGRP_CNTL.PRIM_AMP_FACTORfollows RADV's gfx10.3 mesh path, it isn't measured on the console, and PPSA03671's fast-launch draws don't reach the GPU yet.Both runs so far are on Windows; a Linux run of
agc_driver_meshandagc_driver_graphicson this head would cover the rest.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-13T15:05:39Z.
Rebased onto current main and added one commit: the
docs/dev/debt/libSceAgcDriver.mdentry @oneandonlydean asked for (follows RADV's gfx10.3 mesh path, not measured on the console, PPSA03671's fast-launch draws don't reach the GPU yet).Checked on Linux (rebased tree, libSceAgcDriver scope, 538 tests):
agc_driver_graphicsandagc_driver_meshpass, and both fail with the Draw.cpp/State.cpp changes reverted. The only failing test,agc_driver_tessellation(SEGFAULT), fails the same on main. Merging once the full Build is green.Imported from boykopovar/AnyPS5. Originally posted by fdfawef324 on 2026-10-13T19:04:53Z.
Tested #4702 with Resident Evil 4 (PPSA07411) on Windows Server 2025 build 26100, GCC 15.2.0 UCRT, and NVIDIA GeForce RTX 3060 12 GB, driver 591.86 (32.0.15.9186), Vulkan 1.4.325.
Both PR commits,
7370aaf6dand1a2a4265c, cherry-pick cleanly onto main61b8742b6and the local integration tree 716c9045c.agc_driver_graphicsandagc_driver_meshpass on main plus this PR (10.6 s and 2.6 s).RE4 prepares three wave64 fast-launch geometry programs. Their common state is
VGT_SHADER_STAGES_EN=0x82030, point-list input, andGE_CNTL=0x201. The subgroup amplification factors are 64, 128, and 128. This matches the PR's supported one-point-per-subgroup case.On the same integration base and input schedule:
VGT_SHADER_STAGES_EN=0x82030: unsupported geometry routing, fast launch or wave-ID state.VGT_SHADER_STAGES_EN=0x200210d: only triangle and quad domains with fractional-odd partitioning and triangle output are supported by the reference path.The title's fast-launch draws have not reached the GPU before that next stop. All 17 captured frames are entirely black, matching the earlier integration run, so this establishes preparation progress only.
A temporary wave64 variant of the PR's GPU test rendered 40/40 triangles and exactly triangles 10–29 when given a nonzero start vertex. Its negative control failed as expected. That check exercised the wave64 path with an explicit mesh configuration; it did not test the state decoder. The temporary test was reverted and is not included in a new PR.
AI-assisted: yes.
GPUs tested: NVIDIA GeForce RTX 3060 12 GB, driver 591.86 (32.0.15.9186), Vulkan 1.4.325, Windows Server 2025 10.0.26100.
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-13T22:26:12Z.
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)docs/dev/debt/libSceAgcDriver.mdL7-8core/libs/prx/libSceAgcDriver/Graphics/src/State.cppL651