Repository navigation
fix: a view with no size draws nothing and logs nothing - #22
Merged
Merged
Conversation
A 0x0 view, which the vega editor's empty spec gives, still ran a whole frame. The context was configured and the MSAA, offscreen and swapchain textures were made at 0x0, and Chrome logged each failed texture and the invalid pass and submit after it, every frame. Canvas draws nothing there and logs nothing. - a frame on a canvas with no area ends before the device is made - a capture waiting on it resolves with the empty frame - zerosize.spec.ts takes canvas and webgpu from 0x0 to 200x100 and back, offscreen and onto the canvas, and holds both to no console output
This branch was previously deployed
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.
Symptom. A 0x0 view logs WebGPU validation errors in Chrome on every frame. The Vega editor starts on an empty spec, which compiles to a 0x0 scene, so anyone who picks WebGPU there sees them: "The texture size ... is empty", "Could not create a swapchain texture of size 0", then the invalid "MSAA Color Texture", texture view, render pass and command buffer on
Queue.Submit. The canvas renderer draws nothing there and logs nothing.Cause. The renderer ran a full frame whatever the canvas size. Every target a frame draws into is the size of the canvas (MSAA, offscreen, swapchain, mask and blend targets), and a texture cannot be empty. Configuring the context on a 0x0 canvas fails the same check, so it is not only the frame's textures.
Fix.
_frameends straight away when the canvas width or height is 0, before the device is made or the context is configured: no textures, no encoding, no submit. It goes through_finishFrame, so the render lock is released and a queued render still runs. A pendingcaptureFrame()resolves with the empty frame instead of timing out. Drawing resumes once the view has a size again.Test.
test/render/zerosize.spec.tstakes canvas and webgpu through the same steps: 0x0, 200x100, back to 0x0, then 0x0 onto the canvas (offscreen: false, the editor's path) with two renders back to back. It checks the frame size at each step, that the 200x100 frame is filled, and that neither renderer logs anything. Every device is wrapped before the page loads, so uncaptured GPU errors from the very first frame are reported too. A pixel comparison cannot hold this case, since both renders are empty and the suite's ink floor rejects a blank case, so it is a spec of its own rather than a corpus entry. It fails before the fix with all three of the editor's messages.npm run typecheck,npm run lintandnpm run buildpass.npm test: 257 passed, 9 skipped, 1 failed. The failure is thepath-commandsfixture at 72.0 on the worst-block measure against 70, which reads the same 72.0 on unchangedmainwith the local Chrome this machine runs the suite in, so it is not from this change.