fix: prevent grid truncation on ultrawide displays#196
Conversation
|
Warning Review limit reached
More reviews will be available in 2 minutes and 48 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
There was a problem hiding this comment.
Code Review
This pull request updates the batching logic in GLRenderer::flushCommands to account for both vertex buffer capacity (STREAM_VBO_CAPACITY) and index buffer capacity (STREAM_EBO_CAPACITY) when determining how many vertices can be batched. The reviewer pointed out an opportunity to simplify the calculation after flushBatch() by directly using the capacity constants, as the batch sizes are guaranteed to be zero at that point.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| batchFreeVerts = STREAM_VBO_CAPACITY - batch.size(); | ||
| batchFreeIdx = STREAM_EBO_CAPACITY - indexBatch.size(); | ||
| canTakeStepsVerts = batchFreeVerts / vertStep; | ||
| canTakeStepsIdx = batchFreeIdx / idxPerStep; | ||
| canTake = std::min(canTakeStepsVerts, canTakeStepsIdx) * vertStep; |
There was a problem hiding this comment.
Since flushBatch() clears the current batch and index batch, both batch.size() and indexBatch.size() are guaranteed to be 0 at this point. We can simplify this block by directly using STREAM_VBO_CAPACITY and STREAM_EBO_CAPACITY instead of performing redundant subtractions and size queries.
canTakeStepsVerts = STREAM_VBO_CAPACITY / vertStep;
canTakeStepsIdx = STREAM_EBO_CAPACITY / idxPerStep;
canTake = std::min(canTakeStepsVerts, canTakeStepsIdx) * vertStep;


Summary
Fix intermittent grid truncation on ultrawide monitors when the viewport is idle. The renderer could exceed the index (EBO) capacity while slicing large frames, causing batches (including the grid) to be dropped. The flush logic now accounts for both vertex and index capacity when chunking commands, preventing partial overlays.
Files changed
HOW TO TEST
View -> Grid.