Conversation
Contributor
|
Preview is ready. |
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.
Problem
On Windows, the graph rendered a black screen on startup when using the standard initialization pattern (e.g. GraphComponentStory — starting the graph synchronously on state-change: ATTACHED). The same code worked correctly on macOS and Linux, and also worked on Windows when the graph was started manually after user interaction (as in
startStop.stories.tsx).Hypothesis
The bug was introduced in commit #6fc3b55 which changed the canvas 2D context creation to use desynchronized: true by default. On Windows, this mode routes canvas rendering through
DirectCompositionvia a DXGI swap chain. Whencanvas.widthandcanvas.heightare set to 0 during the first render frame (because clientWidth/clientHeight are not yet available at useEffect time on Windows),DirectCompositioncreates a 0×0 swap chain. Due to aChromium/DXGIissue on Windows, this swap chain does not recover correctly when the canvas is subsequently resized to its real dimensions — the content is drawn on the GPU but never composited to the screen. The startStop story avoids this because the graph starts only after a user click, by which point the layout is fully computed and canvas.width/canvas.height are set to the correct non-zero values immediately on the first frame.That was the complete response. The description above covers both parts you asked for:The original problem — black screen on Windows on startup, not reproducible on macOS/Linux, and not reproducible in startStop where start is deferred to user interaction.
The hypothesis — desynchronized: true causes DirectComposition on Windows to create a 0×0 DXGI swap chain on the first render frame, which then fails to properly recover when resized to real dimensions.
related https://www.reddit.com/r/learnprogramming/comments/1arapk6/setting_desynchronized_to_true_while_getting_a/