Skip to content

Commit 585924b

Browse files
authored
Use GLctx in library_egl.js and library_glut.js. NFC (#22875)
I'm trying to reduce/remove the usage of `Module.ctx` with a view to possibly removing it from the `Module` object. These usages should be using `GLctx` anyway I believe.
1 parent 47b9540 commit 585924b

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/library_egl.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,7 @@ var LibraryEGL = {
634634
eglGetCurrentDisplay: () => EGL.currentContext ? {{{ eglDefaultDisplay }}} : 0,
635635

636636
// EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers(EGLDisplay dpy, EGLSurface surface);
637+
eglSwapBuffers__deps: ['$GLctx'],
637638
eglSwapBuffers__proxy: 'sync',
638639
eglSwapBuffers: (dpy, surface) => {
639640
#if PROXY_TO_WORKER
@@ -642,9 +643,9 @@ var LibraryEGL = {
642643

643644
if (!EGL.defaultDisplayInitialized) {
644645
EGL.setErrorCode(0x3001 /* EGL_NOT_INITIALIZED */);
645-
} else if (!Module.ctx) {
646+
} else if (!GLctx) {
646647
EGL.setErrorCode(0x3002 /* EGL_BAD_ACCESS */);
647-
} else if (Module.ctx.isContextLost()) {
648+
} else if (GLctx.isContextLost()) {
648649
EGL.setErrorCode(0x300E /* EGL_CONTEXT_LOST */);
649650
} else {
650651
// According to documentation this does an implicit flush.

src/library_glut.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -399,13 +399,13 @@ var LibraryGLUT = {
399399
var now = Date.now();
400400
return now - GLUT.initTime;
401401
case 0x0069: /* GLUT_WINDOW_STENCIL_SIZE */
402-
return Module.ctx.getContextAttributes().stencil ? 8 : 0;
402+
return GLctx.getContextAttributes().stencil ? 8 : 0;
403403
case 0x006A: /* GLUT_WINDOW_DEPTH_SIZE */
404-
return Module.ctx.getContextAttributes().depth ? 8 : 0;
404+
return GLctx.getContextAttributes().depth ? 8 : 0;
405405
case 0x006E: /* GLUT_WINDOW_ALPHA_SIZE */
406-
return Module.ctx.getContextAttributes().alpha ? 8 : 0;
406+
return GLctx.getContextAttributes().alpha ? 8 : 0;
407407
case 0x0078: /* GLUT_WINDOW_NUM_SAMPLES */
408-
return Module.ctx.getContextAttributes().antialias ? 1 : 0;
408+
return GLctx.getContextAttributes().antialias ? 1 : 0;
409409

410410
default:
411411
throw "glutGet(" + type + ") not implemented yet";

0 commit comments

Comments
 (0)