Skip to content

fix(agc): let mesh-path list draws with primitive restart skip the list-restart emulation - #17976

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
Gonic0:fix/agc-mesh-list-restart-without-extension
Nov 15, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
Gonic0:fix/agc-mesh-list-restart-without-extension

Conversation

@Gonic0

@Gonic0 Gonic0 commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

What

Draw.cpp emulates primitive restart in point, line and triangle lists on devices without VK_EXT_primitive_topology_list_restart by compacting the index buffer that the input assembler reads (#12180). That branch also stopped every mesh-path list draw with restart at a requirement for the extension. A mesh draw has no input assembler: its entry fetches the indices itself, so the compaction does not apply to it.

A mesh-path list draw with primitive restart now skips the emulation and takes the same path as on a device with the extension: skipRestart is set for it, so the index range is read with the restart index left out. The requirement is removed.

The fix and its diagnosis are imellag's (comment on #9356), and the commit carries their authorship. It is opened on its own at the request of the author of #17611 (comment): #17611 is what lets mesh-path draws reach devices without VK_EXT_mesh_shader, such as MoltenVK, and there the requirement stops PPSA21564 shortly after launch.

Not changed: the mesh entry handles the restart index only in triangle strips and fans. In a list it is fetched as an ordinary index, as it already was on devices with the extension.

Tested

macOS 27.3, Apple M5 Pro, Apple clang, x86-64 Release under Rosetta 2. Tree: main 81eb4e1935 with #17611 (7957c8eb77; its only conflict, FormatVersion in ShaderDiskCache.hpp, set to 69), and #16591, #17425, #17532 and #17767, which macOS needs to build. The game binary was relinked from the same tree.

PPSA21564 on MoltenVK 1.4.2 (which lists VK_EXT_primitive_topology_list_restart but reports primitiveTopologyListRestart as false), same save, cold shader cache, 150 s limit:

tree result
main stops 38 s after launch: AGC graphics: device does not support mesh shaders
main + #17611 stops 39 s after launch: primitive restart in a mesh list draw needs VK_EXT_primitive_topology_list_restart
main + #17611 + this change no error; reaches the world map at 72 s and is still rendering at the 150 s limit

ctest -R '^(agc_driver_(graphics|layered_[a-z_]+|mesh[a-z_]*|pass_break_reasons|pass_input_hazard)|agc_mesh_output_budget)$' on MoltenVK 1.4.2 and KosmicKrisp (Mesa main), on the same pull requests over main 6c03f737f0 (Draw.cpp is unchanged since), with and without this change: 10 run and pass, 8 skip. The 8 are the mesh execution tests, which skip on both drivers because neither has VK_EXT_mesh_shader, so no existing test reaches this path.

Linux, Windows, AMD and NVIDIA: not run. On a device that supports primitiveTopologyListRestart the change does nothing: skipRestart was already set for these draws.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none; it applies to main on its own, and feat(agc): emulate mesh pipeline draws with a compute pass when VK_EXT_mesh_shader is unavailable #17611 is what makes the path reachable on devices without VK_EXT_mesh_shader
  • Fixes: none
  • Unblocks: none
  • GPUs tested: Apple M5 Pro with MoltenVK 1.4.2 and KosmicKrisp, macOS 27.3
  • AI-assisted: yes

🤖 Generated with Claude Code

…st-restart emulation

The list-restart emulation compacts the index buffer that the input
assembler reads. A mesh draw has no input assembler: its entry fetches
the indices itself, so the emulation does not apply to it. On a device
without VK_EXT_primitive_topology_list_restart, a mesh-path list draw
with primitive restart stopped at the requirement for that extension
instead of drawing. It now takes the same path as on a device with the
extension.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JJenkx

JJenkx commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

Windows CPU check of head 3e6e3f9976 (it already contains main 81eb4e1935, so no merge was needed).

Setup: Windows 11 Enterprise 22621, WinLibs GCC 15.2.0 UCRT r7, Release, with Vulkan hidden.

  • agc_process_sampler_stack and agc_run_report_shader_failure pass in 3 of 3 runs each.
  • The six agc_driver_fill_completion_labels_* tests report Skipped in every run, because they need a Vulkan device.
  • agc_compute_pipeline_inspection is only registered with ANYPS5_ENABLE_SPIRV_TOOLS=ON, which this build doesn't use.

I'll run the fill-completion-labels tests and the inspection test on this machine's AMD GPU, with SPIRV-Tools on, and post the result here.

AI-assisted: yes.

@JJenkx

JJenkx commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

GPU follow-up for head 3e6e3f9976 (it already contains main 81eb4e1935), built with ANYPS5_ENABLE_SPIRV_TOOLS=ON. Run through the Windows FIFO, job a429fb76780548d0b30edfa2a18dcb75, exit 0 with cleanup verified.

Setup: Windows 11 Enterprise 22621, AMD Radeon RX 6700 XT (driver 32.0.21045.16010), WinLibs GCC 15.2 UCRT, Release, ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1.

These seven tests pass in 3 of 3 runs each, 21 of 21, none skipped:

  • agc_compute_pipeline_inspection
  • the six agc_driver_fill_completion_labels_* tests

All 411 hashes matched the prepared build when the job started. They cover the test and .prx files plus the two replay executables. With the earlier CPU result, every test in this PR's gate has now run on Windows.

AI-assisted: yes.

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Some 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.

Pull request Shared files not compared
PR 1368 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 1395 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 5609 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 5925 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 6188 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 7002 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 7256 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 7275 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 7642 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 8246 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 9356 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 9387 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 9508 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 9712 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 10193 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 10442 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 10678 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 11452 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 11825 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 13148 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 13809 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 13863 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 13920 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 13928 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 13929 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 14032 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 14944 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 15343 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 15456 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 15570 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 16753 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 17611 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 17915 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 17943 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 17956 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 18029 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 18390 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 18515 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 19100 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 19119 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 20315 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp

@oneandonlydean
oneandonlydean merged commit ac70e3d into boykopovar:main Nov 15, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc*

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants