Skip to content

Conversation

@ArtemVetik
Copy link
Contributor

Fix AS dispatch logic in D3D12DynamicLOD sample

Previously, the CPU logic for dispatching the Amplification Shader incorrectly calculated the number of dispatches, as well as the instance offset and count when dispatchCount was greater than 1.
In particular, it did not take into account that each AS group processes AS_GROUP_SIZE (32) instances, which could result in some thread groups being dispatched unnecessarily.

This change introduces instancesPerDispatch and correctly computes offset, count, and groupCount for each dispatch, ensuring each AS group processes exactly AS_GROUP_SIZE instances.

To verify, you can temporarily reduce c_maxGroupDispatchCount (for example, to 16 or 32), add more instances, and observe the results. In the previous implementation, instances were displayed incorrectly.

@jenatali jenatali merged commit 1c57270 into microsoft:master Jan 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants