Fix instancing/draw-commands mismatch skipping indirect draws - #9159
Merged
Conversation
When draw commands (indirect / multi-draw) are bound, they are the source of truth for the number of draws and per-draw instance counts. The zero-instance skip guard in the forward and shadow renderers gated the whole draw on instancingData.count, so a mesh instance with instancing set up but count 0 was dropped even when a valid draw command existed. Only skip when no draw commands are bound, and document the precedence on MeshInstance.
Build size reportThis PR changes the size of the minified bundles.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Fixes #9153.
After draw commands (indirect / multi-draw) were added, there were two independent "instance count" mechanisms that were only partially reconciled: hardware instancing (
MeshInstance.instancingCount) and draw commands (setIndirect/setMultiDraw). The zero-instance skip guard in the forward and shadow renderers gated the entire draw oninstancingData.count, so a mesh instance that had instancing set up with count 0 (or unset) but a valid draw command was dropped before it ever reacheddevice.draw— the model would not render at all.Changes:
!drawCall.getDrawCommands(camera)).MeshInstance: added a Precedence section to the class docs making the expected behavior explicit — when draw commands are bound they are the source of truth for the draw count and per-draw instance counts,instancingCountis ignored, andinstancingCount = 0does not skip rendering.instancingCountonly applies to plain hardware instancing when no draw commands are bound.This matches the behavior already implemented in the graphics backends, where the indirect draw path derives instance counts entirely from the draw commands and ignores the
numInstancesargument.