Skip to content

fix: prevent grid truncation on ultrawide displays#196

Open
vllsystems wants to merge 1 commit into
opentibiabr:mainfrom
vllsystems:fix-ultrawide-grid-batch-overflow
Open

fix: prevent grid truncation on ultrawide displays#196
vllsystems wants to merge 1 commit into
opentibiabr:mainfrom
vllsystems:fix-ultrawide-grid-batch-overflow

Conversation

@vllsystems

Copy link
Copy Markdown

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

  • source/gl_renderer.cpp

HOW TO TEST

  1. On an ultrawide monitor, enable View -> Grid.
  2. Keep the viewport idle (no pan/zoom) and confirm the grid covers the full viewport.
  3. Hover around to trigger overlays and confirm the grid remains complete.
  4. Pan/zoom and stop again; confirm the grid does not truncate.

@coderabbitai

coderabbitai Bot commented Jun 7, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@vllsystems, we couldn't start this review because you've reached your PR review rate limit.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2f07c109-ce1d-4127-a49d-6c22f156c400

📥 Commits

Reviewing files that changed from the base of the PR and between e0761f7 and a9ec8e3.

📒 Files selected for processing (1)
  • source/gl_renderer.cpp
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sonarqubecloud

sonarqubecloud Bot commented Jun 7, 2026

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread source/gl_renderer.cpp
Comment on lines +834 to +838
batchFreeVerts = STREAM_VBO_CAPACITY - batch.size();
batchFreeIdx = STREAM_EBO_CAPACITY - indexBatch.size();
canTakeStepsVerts = batchFreeVerts / vertStep;
canTakeStepsIdx = batchFreeIdx / idxPerStep;
canTake = std::min(canTakeStepsVerts, canTakeStepsIdx) * vertStep;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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;

@vllsystems vllsystems added Priority: Low Minor impact. Status: Pending Test This PR or Issue requires more testing. Type: Bug Inconsistencies or issues which will cause a problem for users. Area: Rendering Changes to the OpenGL rendering pipeline. labels Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: Rendering Changes to the OpenGL rendering pipeline. Priority: Low Minor impact. Status: Pending Test This PR or Issue requires more testing. Type: Bug Inconsistencies or issues which will cause a problem for users.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant