Repository navigation
Mesh shaders: seed v5 as groupIndex * NumThreads + lane - #2
Open
TheAirborneCoder wants to merge 10000 commits into
Open
TheAirborneCoder wants to merge 10000 commits into
TheAirborneCoder wants to merge 10000 commits into
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
The mesh prologue in
tools/rdna2spirv.pywrote the linear workgroup index straight into v5, identical and unshifted for every invocation. The game's mesh entry reads v5 from the first active lane and shifts it right by 7 before using it as the meshlet/group index (lane-0v5 >> 7goes into an LDS broadcast to both waves, then is compared against the meshlet count in the header). That only works if v5 holds the first launch vertex ID,groupIndex * 128 + lane.With the old seeding the shader computes
groupIndex >> 7: every group below 128 resolves to meshlet 0, and each block of 128 groups shares one meshlet, so most geometry is drawn as duplicates of a few meshlets.Fix: seed v5 per invocation as
linearGroupIndex * NumThreads + LocalInvocationIndex, with NumThreads from PSV0 (128 in this corpus). The s3 seeding already matches. Comments and the Mesh shaders row indocs/design.mdare updated.Evidence:
>> 7is in the game's native mesh entry sequence, before the meshlet header read.v5 = gid.x * numThreads + gi(crates/tombox-xshader/src/hlsl/mesh.rs, ~line 227).Tested
python -m py_compile tools/rdna2spirv.pypasses.ms_triGPU test.ms_trihas no>> 7step, so it would not catch this regression either way.Checklist
docs/design.md, with how it was confirmed.(The existing mesh row is updated. Leave this unchecked unless you want to add a confirmation note.)