From c3d33aa0492648f9baf30115b7b3bd7115602e70 Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Tue, 27 Feb 2024 17:32:48 -0800 Subject: [PATCH] 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. --- src/library_webgl.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/library_webgl.js b/src/library_webgl.js index 94d6f0709e72..94de71eac200 100644 --- a/src/library_webgl.js +++ b/src/library_webgl.js @@ -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;