Skip to content

Verify that webgl2 is supported before using it #3435

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

Merged
merged 3 commits into from
Jan 24, 2019

Conversation

juancampa
Copy link
Contributor

@juancampa juancampa commented Jan 23, 2019

Some hardware/drivers seem to not support WebGL2 (now our default renderer) which completely breaks hyper.

Check that webgl2 is supported before using.

This seems to add ~10ms to my startup time, which I think it's acceptable. The alternative being catching an exception in Terminal.open and then falling back to canvas.

fixes #3433

@juancampa juancampa requested a review from chabou January 23, 2019 21:09
@juancampa juancampa added the v3 Issues specific to v3 label Jan 23, 2019
isSupported = gl instanceof window.WebGL2RenderingContext;
if (!isSupported) {
// eslint-disable-next-line no-console
console.warn(`WebGL2 is not supported on your machine. Falling back to canvas-based rendering.`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would move this warning in getTermOptions where fallback occurs. This is juste a test here.

We can warn if webGL is disabled due to a non-opaque backgroundColor too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, linting issues on push. One sec

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, now it's done. I need to set up eslint integration in vim.

Copy link
Contributor

@chabou chabou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you! 🙏

@juancampa juancampa merged commit fa2c9d6 into vercel:canary Jan 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v3 Issues specific to v3
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WebGL2 not supported
2 participants