New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Meshlet remove per-cluster data upload #13125
Meshlet remove per-cluster data upload #13125
Conversation
…er, but this time from a shader
…instance-only-data-upload-squashed
…instance-only-data-upload-squashed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't fully understand everything, but the code works, doesn't affect anything unrelated and is way faster than main. So LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is quite ingenious, it took me a bit to understand how this worked
Objective
Solution
meshlet_instance_meshlet_counts_prefix_sum
- An exclusive prefix sum over the count of how many clusters each instance has.meshlet_instance_meshlet_slice_starts
- The starting index of the meshlets for each instance within themeshlets
buffer.fill_cluster_buffers
pass once at the start of the frame has a thread per cluster, and finds its instance ID and meshlet ID via a binary search ofmeshlet_instance_meshlet_counts_prefix_sum
to find what instance it belongs to, and then uses that plusmeshlet_instance_meshlet_slice_starts
to find what number meshlet within the instance it is. The shader then writes out the per-cluster instance/meshlet ID buffers for later passes to quickly read from.