Skip to content

Commit 9d9437f

Browse files
authored
Move useWebGL from Module to Browser. NFC (#22328)
I can't find any documentation about why this might be exposed on the Module object. It looks like it was first introduced just as a kind of global variable: 695e060
1 parent da3a1b6 commit 9d9437f

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

src/library_browser.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ var LibraryBrowser = {
104104
#endif
105105
}
106106
},
107+
useWebGL: false,
107108
isFullscreen: false,
108109
pointerLock: false,
109110
moduleContextCreatedCallbacks: [],
@@ -309,7 +310,7 @@ var LibraryBrowser = {
309310
#endif
310311
Module.ctx = ctx;
311312
if (useWebGL) GL.makeContextCurrent(contextHandle);
312-
Module.useWebGL = useWebGL;
313+
Browser.useWebGL = useWebGL;
313314
Browser.moduleContextCreatedCallbacks.forEach((callback) => callback());
314315
Browser.init();
315316
}

src/library_egl.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ var LibraryEGL = {
365365

366366
// Run callbacks so that GL emulation works
367367
GL.makeContextCurrent(EGL.context);
368-
Module.useWebGL = true;
368+
Browser.useWebGL = true;
369369
Browser.moduleContextCreatedCallbacks.forEach(function(callback) { callback() });
370370

371371
// Note: This function only creates a context, but it shall not make it active.

src/library_glemu.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2821,7 +2821,7 @@ var LibraryGLEmulation = {
28212821
err('WARNING: using emscripten GL immediate mode emulation. This is very limited in what it supports');
28222822
GLImmediate.initted = true;
28232823

2824-
if (!Module.useWebGL) return; // a 2D canvas may be currently used TODO: make sure we are actually called in that case
2824+
if (!Browser.useWebGL) return; // a 2D canvas may be currently used TODO: make sure we are actually called in that case
28252825

28262826
// User can override the maximum number of texture units that we emulate. Using fewer texture units increases runtime performance
28272827
// slightly, so it is advantageous to choose as small value as needed.

src/shell.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ var Module = moduleArg;
2727
var /** @type {{
2828
canvas: HTMLCanvasElement,
2929
ctx: Object,
30-
useWebGL: boolean,
3130
}}
3231
*/ Module;
3332
if (!Module) /** @suppress{checkTypes}*/Module = {"__EMSCRIPTEN_PRIVATE_MODULE_EXPORT_NAME_SUBSTITUTION__":1};

0 commit comments

Comments
 (0)