Keep mesh shader barriers in their branch context #76
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
library
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/omonkeyz--xbox-emulator!76
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/76/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?
@thatirishguyyy on GitHub · 2026-11-21 23:31 UTC · original
thatirishguyyy:preserve-mesh-barrier-control-flow→main· +0 −5 · 1 files · 1 commits · closed without mergingThe forward-branch emitter closes its branch guard immediately before a mesh s_barrier. This stops mesh_barrier from seeing that the barrier was conditional.
Keep the guard in place so the existing policy can omit a conditional barrier in memory-free shaders and refuse the case when LDS or memory writes are present. The existing unconditional barrier path still runs outside branch guards.
Verification on Windows: 60 passed across the library, mesh and opcode suites, with three fixture-dependent tests ignored. The three previously failing mesh barrier cases now pass, including the triangle rendering test.
@QuentinDanblon on GitHub · 2026-11-21 23:42 UTC · original
Ran this on Windows, head
35bad0a,cargo test -p tombox-xshader --release --test mesh:TOMBOX_EXEC_HW=1)8491769,tombox-xshaderunchanged since)It merges cleanly with #58 and #73.
One thing for @omonkeyz to decide, since I reported the same three tests in #70 and left them alone: the five lines removed here were added in
8491769, the commit that made the tests fail, and the tests are older. So either the rule or the tests are stale.A data point for that choice. I kept the rule as it is on main and only changed the expected barrier count from 3 to 4 locally:
gpu_mesh_divergent_barrier_without_memory_writesthen passes on WARP and on the 5090, with the expected[2 * 128 + 64, 1, 0x77, 0x88]. So for a shader without LDS or memory writes, both behaviours draw the same thing. They differ only when the shader writes LDS or memory: main translates it with the barrier moved out of the branch guard (every thread syncs, and the guard reopens on the samejflags), this PR goes back to the refusal. I have no title shader that hits that case, so I can't say which one a real game needs.@thatirishguyyy on GitHub · 2026-11-22 02:06 UTC · original
Thanks for verifying this on WARP and the RTX 5090, @QuentinDanblon. Upstream commit
59e5ed75c3already removes the same barrier hoist. I checked that this PR produces an identical tree when merged into current main. The mesh suite passed on main, including the three cases discussed here. Closing as already addressed.Pull request closed