fix(agc): draw geometry programs with the last provoking vertex #7374
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7374"
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 thuanquang on 2026-10-18T03:20:51Z.
What
TEKKEN DARK RESURRECTION (PPSA31371) still stops on
mainafter #7251 and #7252. @cavazzatommaso's capture on #7118 shows the refused draw: a geometry program on the mesh path (ShaderPath::Geometry) in last provoking vertex mode, with two smooth per-vertex pixel inputs.ValidateProvokingVertexrefuses every mesh-path draw in that mode:@MarcZX100 asked on #7118 which topology the capture's
LINE_LISTis, and what decides the values thePerVertexKHRinputs read.state.topologyandmesh.inputPrimitiveboth come from the draw's primitive type (register 0x242), soLINE_LISTis the geometry program's input.VGT_GS_OUT_PRIM_TYPE2 givesoutputPrimitiveSize3 andOutputTrianglesEXT.exp prim, in the guest's order. The emulator does not assemble the output primitives.For primitives a mesh shader emits, Vulkan reads
PerVertexKHRinputs as if the primitives were drawn as lists, and the list rows of the vertex order table are the same in both modes (Barycentric Interpolation). So the two smooth inputs read the same vertices in last mode as in first mode. Flat inputs take the last index of each primitive, because Vulkan picks the provoking vertex from the mesh output topology and the pipeline's mode (Flat Shading).VkPipelineRasterizationProvokingVertexStateCreateInfoEXTis already chained into mesh pipelines too.The one value the emulator picks itself is the per-primitive layer, which
MeshConfiguration::provokingVertextook from vertex 0 in both modes.DecodeShaderStagesnow sets that field to the last vertex of the output primitive whenPA_SU_SC_MODE_CNTL.PROVOKING_VTX_LASTis set. The field is already part of every mesh cache key.ValidateProvokingVertexnow lets a mesh-path geometry draw through in last mode. These still throw:Assumption, not measured: under bit 19 the console takes the last index of an exported primitive as its provoking vertex, as it does for native primitives. The debt entry says so.
A program the driver prepared at registration was prepared with no rasterizer state, so with provoking vertex 0. A last-mode draw of it compiles its own variant at the draw, with the usual "no artifact prepared at registration" line. On
mainthat draw threw.Overlap: #6612 moves the
MeshConfigurationconstruction inDecodeShaderStagesinto a helper that still passes 0, so whichever of the two lands second has to carry the bit-19 read into it. #6741 and #7332 edit the same debt line ("throws for generated mesh or tessellation primitives").Tested
Windows 11 26200, AMD Radeon RX 6700 XT (gfx1031), driver 32.0.21045.5002, WinLibs GCC 15.2.0 r7, Release,
BUILD_TESTING=ON,ANYPS5_REQUIRE_VULKAN=1:agc_driver_mesh_provoking_vertex, a full PM4 draw through the guest NGG geometry program fromMeshGeometryFixture.hpp. The triangle's vertices are red, green and blue.v_interp_mov_f32P0 must draw red in first mode and blue in last mode (first, last, first).v_interp_p1_f32/v_interp_p2_f32, compiled to per-vertex values as the title's inputs are) must draw the same pixels, bit for bit, in both modes.mainit fails with the title's message. With this change it passes.agc_driver_graphics:DecodeStateandDecodeShaderStagesgive provoking vertex 0 without bit 19, and with it 2 for triangle-strip output and 1 for line-strip output.ValidateProvokingVertexaccepts mesh draws with point, line and triangle-list input and refuses strip or fan input, tessellation and flat per-vertex inputs.mainit fails withlast provoking vertex is unsupported for generated primitive pipelines.ctest --parallel 4 --timeout 120onmain2626e5ee7with this change: 1462 tests. The only failures are three known on this GPU and unrelated to this change:agc_driver_lds_mixed_width_atomics(#6976),agc_driver_lds_lock_budget(#7344) andagc_driver_layered_volume_vertex_no_gpl(#4768, which passed in the same run on0bb238b4a).python tools/check_conventions.py --base origin/mainwith this title and body passes.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)main; what comes after it is not known)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-18T03:32:33Z.
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.cppL949docs/dev/debt/libSceAgcDriver.mdL109core/libs/prx/libSceAgcDriver/tests/Graphics.cppL889core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppL113docs/dev/debt/libSceAgcDriver.mdL109Some 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/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/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/Graphics/src/Pipeline.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.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/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/Pipeline.cppcore/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/Graphics/src/Pipeline.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/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/Graphics/src/Pipeline.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.mdcore/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppdocs/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.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.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/Graphics/src/Pipeline.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdImported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T05:49:47Z.
Code review location:
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp; line 948Non-blocking coverage suggestion: this value also feeds the
Layerselection inSpirvModuleEmitter.cpp(the emitted mesh primitive selectsvertex[provokingVertex]), but the new execution fixture only checks flat and smooth fragment inputs. A focused fixture with distinct guest layer values on the vertices of an emitted primitive could verify that the first/last modes select the intended per-primitive layer in this translation. This would validate the new layer-mapping path; it would not establish the separately documented console-semantic assumption.Imported from boykopovar/AnyPS5. Originally posted by cavazzatommaso on 2026-10-18T11:07:24Z.
@thuanquang @MarcZX100 I tested this branch for #7118; here is the result and full runtime log.
Test result for PR #7374 at
8f03282f5eaa50ec1a8f39f9c530961487fe9c49(TEKKEN DARK RESURRECTION, PPSA31371): the run gets beyond the previous generic generated-primitive refusal, but then aborts at the PR's explicitly retained triangle-strip/fan guard.The diagnostic source changes were stashed before checkout,
git diff --exit-codewas empty, andrelinkerpluslibsbuilt successfully in the existingbuild-main-fixedMinGW build. The newly built runtime libraries were copied into the game directory. The existing converted executable, app0 and shader cache were retained. No global provoking-bit override or validation bypass was applied.The earlier captured shader
0x14079b100is prepared at use, followed by further graphics/game activity. Later, the log reports preparation of shader0x140793500(stage 7), immediately followed by:Both CMD and PowerShell runs reach this same final refusal and SIGABRT. The screen remains black; the Bandai Namco logo is not visible in these runs. This establishes the next guard encountered, not rendering correctness of the earlier draw. We have not captured the new draw's decoded state, so cannot yet distinguish strip from fan or establish its fragment-input semantics. The test does not validate the later Videodec2 path.
A separate Windows Bad Image dialog (
0xc000012f) was observed during the CMD test for/app0/ULUS10139#v1.00/aot/ULUS10139_v1_00_aotv1.prx; both logs nevertheless continue past the AOT loading message to the graphics refusal above. No causal attribution is claimed.Same environment as #7118: Windows 11 Pro 25H2, Ryzen 7 2700X, RX 7800 XT, AMD Windows driver
32.0.31041.1004, WinLibs GCC 15.2.0 r7, Release.Full PowerShell runtime log below (the more readable of the two runs). Local installation paths and executable name are redacted; diagnostic addresses and guest virtual paths are retained. Report prepared with AI assistance; test and runtime logs supplied by the reporter.
Full runtime log — PR #7374 test (redacted)
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-18T11:21:52Z.
Thanks, this is merged. One follow-up, not blocking, and a separate small PR is fine: under last-provoking-vertex mode the per-primitive Layer is still untested. Could you add a fixture where each vertex of a primitive writes a distinct layer, render to a 2-layer target, and check that last mode lands on the last vertex's layer? It's reachable only by mesh programs that write different layers per vertex of one primitive, but that is exactly the case the provoking-vertex selection decides.