Skip to content

Fix cropped rendering - #824

Merged
fuzzie360 merged 1 commit into
gpujs:developfrom
christianh104:develop
Jul 22, 2026
Merged

Fix cropped rendering#824
fuzzie360 merged 1 commit into
gpujs:developfrom
christianh104:develop

Conversation

@christianh104

Copy link
Copy Markdown
Contributor

Resolves cropped rendering when WebGL drawing buffer is smaller than canvas due to hardware constraints by scaling viewport to drawing buffer rather than canvas size. See:
https://stackoverflow.com/questions/29710696/webgl-drawing-buffer-size-does-not-equal-canvas-size https://registry.khronos.org/webgl/specs/latest/1.0/#2.2

Resolves cropped rendering when WebGL drawing buffer is smaller than canvas due to hardware constraints by scaling viewport to drawing buffer rather than canvas size.
See:
https://stackoverflow.com/questions/29710696/webgl-drawing-buffer-size-does-not-equal-canvas-size
https://registry.khronos.org/webgl/specs/latest/1.0/#2.2
@fuzzie360
fuzzie360 merged commit 0945f3e into gpujs:develop Jul 22, 2026
fuzzie360 added a commit that referenced this pull request Jul 22, 2026
This reverts commit 0945f3e, reversing
changes made to a42c9e4.
@fuzzie360

Copy link
Copy Markdown
Member

Thanks for this and for the spec references — we merged it today, and I have to report it didn't survive contact with the test suite: clamping the viewport to gl.drawingBufferWidth/Height breaks rendering to framebuffer-attached textures, which don't go through the drawing buffer at all. On headless-gl (where the drawing buffer is fixed at context-creation size) 500+ tests failed, and the same logic would affect any FBO pass whose texture exceeds the initial buffer. It's reverted in 2.19.1.

The underlying clamped-canvas bug you describe is real — but the fix needs to distinguish the canvas-output path (where clamping to the drawing buffer is right) from FBO passes (where the viewport must match the texture size). If you're still around and want to rework it along those lines, we'd gladly take it; CI now runs on every PR so it'll get validated automatically.

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.

2 participants