Repository navigation
Fix the reuse check of the 32-bit quad indexes - #1385
Merged
Merged
Conversation
getQuadIndexes compared the existing buffer's index count with the vertex count instead of the index count it needs (nquads, 6 per quad). After a buffer grew from 65536 to 131072 vertices, the indexes built for the smaller one (21845 quads) were kept, and quads beyond them weren't drawn. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
MemoryManager.getQuadIndexesdecides whether the existing 32-bit quad indexes are large enough by comparing their index count with the vertex count:but a quad needs 6 indexes for 4 vertices, and the number of indexes needed is already computed as
nquads. So the check passes when it shouldn't. For example:sz = 131072indexes, i.e. 21845 quads.131072 < 131072is false, so those indexes are kept.renderQuadBufferwith more than 21845 quads then reads past the index data, and the quads beyond it aren't drawn, without any error.The fix compares with
nquads. Triangle indexes (getTriIndexes) use one index per vertex, so their check is correct.Tested with DirectX 11: drawing 15000, then 22000, then 40000 quads from one growing
Dynamicbuffer throughrenderQuadBuffer; without the fix the last quads of the 22000 aren't drawn, with it all are.🤖 Generated with Claude Code