-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle WebGL context loss/restore events in WebGL renderer. #4075
Conversation
Note to maintainers: this was originally developed in the context of VS Code's embedded terminal, attempting to make it more robust. It's expected that context losses would be rare, but they can happen due to issues out of the browser's control. If this PR is accepted, I'd be interested in rolling forward VS Code's xterm.js reference and upstreaming the needed patch there to respond to the new |
a27d32a
to
9857457
Compare
@Tyriar would you be able to review this? It improves robustness of the Terminal in the face of external graphics issues. |
9857457
to
23e0f3a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Idea looks good overall 👍. Also I didn't know about about:gpucrash
, pretty handy!
If the context is restored within a brief period of time (3 seconds), recreate members dependent on WebGL state, and fire onRequestRedraw to the renderer's listeners. Handle changes to the char atlas better in the demo client. Tested in Chrome Canary on macOS by running the demo in one window, and visiting the internal URL about:gpucrash in another window. The terminal now recovers and redraws properly.
23e0f3a
to
9459553
Compare
Thanks for your review! All feedback addressed. It's much simpler and completely self-contained now! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks!
If the context is restored within a brief period of time (3 seconds),
recreate members dependent on WebGL state, and fire onRequestRedraw to
the renderer's listeners.
Handle changes to the char atlas better in the demo client.
Tested in Chrome Canary on macOS by running the demo in one window,
and visiting the internal URL about:gpucrash in another window. The
terminal now recovers and redraws properly.