Skip to content

Commit

Permalink
Limit isCurrentContextWebGL2 usage. NFC (#21444)
Browse files Browse the repository at this point in the history
I observed that this helper macro is only needed when webgl2 is
supported.

In fact, it would be a bug if it was used when webgl2 was not supported.
  • Loading branch information
sbc100 committed Feb 28, 2024
1 parent 07010b9 commit c3d33aa
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/library_webgl.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@

{{{
globalThis.isCurrentContextWebGL2 = () => {
// This function should only be called inside of `#if MAX_WEBGL_VERSION >= 2` blocks
assert(MAX_WEBGL_VERSION >= 2, 'isCurrentContextWebGL2 called without webgl2 support');
if (MIN_WEBGL_VERSION >= 2) return 'true';
if (MAX_WEBGL_VERSION <= 1) return 'false';
return 'GL.currentContext.version >= 2';
}
null;
Expand Down

0 comments on commit c3d33aa

Please sign in to comment.