Workaround Safari WebGL issue: After successfully acquiring WebGL con… - #13659
Merged
Conversation
…text on a canvas, calling .getContext() will always return that context independent of which 'webgl' or 'webgl2' context version was passed. See https://bugs.webkit.org/show_bug.cgi?id=222758. Fixes emscripten-core#13295
juj
force-pushed
the
workaround_safari_getcontext_bug
branch
from
March 15, 2021 10:40
92471c3 to
7d9e154
Compare
kenrussell
reviewed
Mar 15, 2021
| canvas.getContextSafariWebGL2Fixed = canvas.getContext; | ||
| canvas.getContext = function(ver, attrs) { | ||
| var gl = canvas.getContextSafariWebGL2Fixed(ver, attrs); | ||
| return ((ver == 'webgl') == (gl instanceof WebGLRenderingContext)) && gl; |
Collaborator
There was a problem hiding this comment.
Will this end up returning "false" for getContext if this fails, rather than null? I'd suggest writing this more clearly with if-statements.
Collaborator
Author
There was a problem hiding this comment.
Surprised if that matters, but sure, adjusted to return null.
kripken
approved these changes
Mar 17, 2021
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.
…text on a canvas, calling .getContext() will always return that context independent of which 'webgl' or 'webgl2' context version was passed. See https://bugs.webkit.org/show_bug.cgi?id=222758. Fixes #13295