Skip to content

fix(graphics-3d): skip render on zero-size canvas - #536

Merged
Tchips46 merged 2 commits into
mainfrom
fix/graphics-3d/skip-render-empty-canvas
Dec 3, 2026
Merged

Tchips46 merged 2 commits into
mainfrom
fix/graphics-3d/skip-render-empty-canvas

Conversation

@Tchips46

@Tchips46 Tchips46 commented Dec 3, 2026

Copy link
Copy Markdown
Member

What does this PR do?

Stops graphics-3d from rendering while the canvas has no area. A hidden game (another editor tab, collapsed container) gives a 0×0 canvas, and WebGPU rejects the zero-size swapchain, so every tick threw and flooded the console with errors.

  • _draw() returns false without drawing when the canvas width or height is 0. Ticks, viewport changes and editor captures all go through it.
  • graphics-capture answers with an empty string in that case, as it already does with no renderer, so the editor does not wait.
  • Docs: the render loop section and the editor protocol table describe the new behavior.

Resolves #535

How do you test this PR?

  • New spec: no render while the canvas is 0×0, and rendering resumes once the viewport has an area.
  • New spec: graphics-capture answers "" while the canvas has no area.
  • The fake renderer in the spec now sizes its drawing buffer from CSS size × pixel ratio, like three does, so the zero-size case is exercised.
  • Run the modules/graphics-3d tests
  • Open a game in a hidden editor tab and check the console has no WebGPU errors

@Tchips46 Tchips46 self-assigned this Dec 3, 2026
@Tchips46
Tchips46 requested a review from Exeloo as a code owner December 3, 2026 13:20
@Tchips46
Tchips46 merged commit 618032b into main Dec 3, 2026
7 of 8 checks passed
@Tchips46
Tchips46 deleted the fix/graphics-3d/skip-render-empty-canvas branch December 3, 2026 13:32
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.

Graphics-3d renders a 0×0 canvas every tick when the game is hidden

2 participants