Skip to content

Commit c3d33aa

Browse files
authored
Limit isCurrentContextWebGL2 usage. NFC (#21444)
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.
1 parent 07010b9 commit c3d33aa

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/library_webgl.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010

1111
{{{
1212
globalThis.isCurrentContextWebGL2 = () => {
13+
// This function should only be called inside of `#if MAX_WEBGL_VERSION >= 2` blocks
14+
assert(MAX_WEBGL_VERSION >= 2, 'isCurrentContextWebGL2 called without webgl2 support');
1315
if (MIN_WEBGL_VERSION >= 2) return 'true';
14-
if (MAX_WEBGL_VERSION <= 1) return 'false';
1516
return 'GL.currentContext.version >= 2';
1617
}
1718
null;

0 commit comments

Comments
 (0)