graphics: tolerate mesh draws beyond host limits instead of aborting #1589
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
GPU
GUI
help wanted
question
Shaders
Video
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/KytyPS5--KytyPS5!1589
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1589/head"
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?
@theantipopau on GitHub · 2026-10-17 09:19 UTC · original
theantipopau:mesh-draw-clamp-host-limits→main· +80 −13 · 2 files · 3 commits · closed without mergingFixes #624, related #1447.
Astro's Playroom issues a 68734-group mesh dispatch that exceeds
maxMeshWorkGroupCount[0](65535 on most drivers). The emulator hitEXIT("mesh draw exceeds host workgroup limits")and aborted.This PR, in
ExecutePreparedDraw(src/graphics/host_gpu/renderer/renderDraw.cpp):And in
GetGraphicsPrograms(src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp):VK_EXT_mesh_shader(e.g. RDNA 1, issue #1447) warn once and return no programs instead ofEXIT_NOT_IMPLEMENTED;EXIT(unlike a dispatch count, a workgroup itself cannot be clamped).Dropped draws may mean missing geometry, but the game keeps running.
Verified:
git diff --checkclean. Full local build/ctest could not run here (CMake configure fails on the FFmpeg prebuilt download), so CI is the verification path.@coderabbitai[bot] on GitHub · 2026-10-17 09:27 UTC · original · edited 2026-10-17 09:31 UTC
📝 Walkthrough
Mesh pipeline setup now skips draws when mesh shaders are unsupported or mesh workgroup resource limits are exceeded. Mesh draw execution skips unsupported configurations, clamps dispatch group and instance counts to host limits, and skips dispatch when a clamped count is zero.
Suggested reviewers:
nmzikPriority: ➖ Normal
Change: Bug fix · Severity of issue fixed: Medium
Merge Risk: 🟡 Moderate · up to
1ea8cOn hosts that cannot build the mesh pipeline, the draw can still crash instead of being skipped. Move the empty-programs check into draw preparation, right after the shader refresh, before merging.
Pre-merge checks:
4 ·
1
#624requires avoiding the crash for mesh dispatches that exceed the host workgroup limit. InExecutePreparedDraw, the PR clamps mesh group and instance counts tomaxMeshWorkGroupCountand `…Full details: Linked Issues check
Explanation
Issue
#624requires avoiding the crash for mesh dispatches that exceed the host workgroup limit. InExecutePreparedDraw, the PR clamps mesh group and instance counts tomaxMeshWorkGroupCountandmaxMeshWorkGroupTotalCount, reports the condition once, and drops the tail. The code returns without submitting when clamping produces zero workgroups. This replaces the previous abort path. Issue#624defines no additional automated-test requirement.Full details: Out of Scope Changes check
Explanation
The changes remain within mesh-draw failure handling. The pipeline changes skip unsupported mesh shaders and mesh workgroups that exceed host limits. The draw changes skip unsupported fast-launch cases and invalid zero primitive-group sizes. These changes prevent related mesh-draw aborts and support the stated goal that the emulator continues running. No unrelated change is demonstrated.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share
Comment
@coderabbitai helpto get the list of available commands.@coderabbitai[bot] on GitHub · 2026-10-17 09:27 UTC · original · reviewed
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
66f03059-882e-4378-9c37-efebfe6458fa📥 Commits
Reviewing files that changed from the base of the PR and between
c2173801d4and1ea8c2e31a.📒 Files selected for processing: 2
src/graphics/host_gpu/renderer/pipeline/pipelineCache.cppsrc/graphics/host_gpu/renderer/renderDraw.cppIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
@ -1111,0 +1111,4 @@// GetGraphicsPrograms skips mesh pipelines the host cannot build (no mesh// shader support, or the workgroup exceeds host limits). Drop the draw.return;}@coderabbitai[bot] on GitHub · 2026-10-17 09:27 UTC · original
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 7400
Stop empty graphics programs before dereferencing shader state.
RefreshShaderscan leavestate.programs.vertex[0]empty while the shader-state pointers remain null.PrepareDrawRenderStatethen dereferencesstate.ps_input_info.stage.programwhenps_active, andExecutePreparedDrawdereferencesstate.vertex_info[0].stage.programat line 1109 before the guard at line 1110.DrawAutoalso dereferences the vertex program after preparation. Therefore, the guard at line 1110 cannot prevent these null dereferences.Return
falseimmediately afterRefreshShaderswhen the vertex program is unavailable. The existing callers handle a failed preparation by resetting bindings and returning.🐛 Suggested fix
Remove the later guard in
ExecutePreparedDraw; its condition dereferences the vertex program before it can run.@Nmzik on GitHub · 2026-10-17 10:25 UTC · original
@theantipopau These are hacks. Like real hacks
@theantipopau on GitHub · 2026-10-17 12:01 UTC · original
Addressed both findings in 1d6e5685:
Pull request closed