Skip to content

Commit 74fdcac

Browse files
authored
[wasm64] Run all browser64 egl/gl/glfw/glew tests (#20598) (#20603)
Split out from #20516
1 parent 03b4eda commit 74fdcac

File tree

6 files changed

+55
-47
lines changed

6 files changed

+55
-47
lines changed

.circleci/config.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -781,11 +781,6 @@ jobs:
781781
browser64.test_idbstore
782782
browser64.test_idbstore_sync_asyncify
783783
browser64.test_idbstore_sync_jspi
784-
browser64.test_egl
785-
browser64.test_egl_width_height
786-
browser64.test_egl_createcontext_error
787-
browser64.test_glgears_animation
788-
browser64.test_glgears_deriv
789784
browser64.test_anisotropic
790785
browser64.test_webgpu_get_device
791786
browser64.test_fetch_*
@@ -794,6 +789,11 @@ jobs:
794789
browser64.test_emscripten_async_wget_*
795790
browser64.test_wasm_worker_*
796791
browser64.test_sdl_*
792+
browser64.test_egl*
793+
browser64.test_gl_*
794+
browser64.test_glgears*
795+
browser64.test_glfw*
796+
browser64.test_glew
797797
"
798798
test-browser-firefox:
799799
executor: bionic

src/library_glew.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ var LibraryGLEW = {
100100

101101
extensionIsSupported(name) {
102102
if (!GLEW.extensions) {
103-
GLEW.extensions = UTF8ToString(_glGetString(0x1F03)).split(' ');
103+
GLEW.extensions = GL.getExtensions();
104104
}
105105

106106
if (GLEW.extensions.includes(name))

src/library_glfw.js

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -62,23 +62,23 @@ var LibraryGLFW = {
6262
this.domKeys = new Array();
6363
this.shouldClose = 0;
6464
this.title = null;
65-
this.windowPosFunc = null; // GLFWwindowposfun
66-
this.windowSizeFunc = null; // GLFWwindowsizefun
67-
this.windowCloseFunc = null; // GLFWwindowclosefun
68-
this.windowRefreshFunc = null; // GLFWwindowrefreshfun
69-
this.windowFocusFunc = null; // GLFWwindowfocusfun
70-
this.windowIconifyFunc = null; // GLFWwindowiconifyfun
71-
this.windowMaximizeFunc = null; // GLFWwindowmaximizefun
72-
this.framebufferSizeFunc = null; // GLFWframebuffersizefun
73-
this.windowContentScaleFunc = null; // GLFWwindowcontentscalefun
74-
this.mouseButtonFunc = null; // GLFWmousebuttonfun
75-
this.cursorPosFunc = null; // GLFWcursorposfun
76-
this.cursorEnterFunc = null; // GLFWcursorenterfun
77-
this.scrollFunc = null; // GLFWscrollfun
78-
this.dropFunc = null; // GLFWdropfun
79-
this.keyFunc = null; // GLFWkeyfun
80-
this.charFunc = null; // GLFWcharfun
81-
this.userptr = null;
65+
this.windowPosFunc = 0; // GLFWwindowposfun
66+
this.windowSizeFunc = 0; // GLFWwindowsizefun
67+
this.windowCloseFunc = 0; // GLFWwindowclosefun
68+
this.windowRefreshFunc = 0; // GLFWwindowrefreshfun
69+
this.windowFocusFunc = 0; // GLFWwindowfocusfun
70+
this.windowIconifyFunc = 0; // GLFWwindowiconifyfun
71+
this.windowMaximizeFunc = 0; // GLFWwindowmaximizefun
72+
this.framebufferSizeFunc = 0; // GLFWframebuffersizefun
73+
this.windowContentScaleFunc = 0; // GLFWwindowcontentscalefun
74+
this.mouseButtonFunc = 0; // GLFWmousebuttonfun
75+
this.cursorPosFunc = 0; // GLFWcursorposfun
76+
this.cursorEnterFunc = 0; // GLFWcursorenterfun
77+
this.scrollFunc = 0; // GLFWscrollfun
78+
this.dropFunc = 0; // GLFWdropfun
79+
this.keyFunc = 0; // GLFWkeyfun
80+
this.charFunc = 0; // GLFWcharfun
81+
this.userptr = 0;
8282
},
8383

8484
$GLFW__deps: ['emscripten_get_now', '$GL', '$Browser', '$GLFW_Window',
@@ -94,9 +94,9 @@ var LibraryGLFW = {
9494
return GLFW.windows[id - 1];
9595
},
9696

97-
joystickFunc: null, // GLFWjoystickfun
98-
errorFunc: null, // GLFWerrorfun
99-
monitorFunc: null, // GLFWmonitorfun
97+
joystickFunc: 0, // GLFWjoystickfun
98+
errorFunc: 0, // GLFWerrorfun
99+
monitorFunc: 0, // GLFWmonitorfun
100100
active: null, // active window
101101
scale: null,
102102
windows: null,
@@ -372,7 +372,7 @@ var LibraryGLFW = {
372372
{{{ makeDynCall('vii', 'GLFW.active.charFunc') }}}(charCode, 1);
373373
#endif
374374
#if USE_GLFW == 3
375-
{{{ makeDynCall('vii', 'GLFW.active.charFunc') }}}(GLFW.active.id, charCode);
375+
{{{ makeDynCall('vpi', 'GLFW.active.charFunc') }}}(GLFW.active.id, charCode);
376376
#endif
377377
},
378378

@@ -394,7 +394,7 @@ var LibraryGLFW = {
394394
#endif
395395
#if USE_GLFW == 3
396396
if (repeat) status = 2; // GLFW_REPEAT
397-
{{{ makeDynCall('viiiii', 'GLFW.active.keyFunc') }}}(GLFW.active.id, key, keyCode, status, GLFW.getModBits(GLFW.active));
397+
{{{ makeDynCall('vpiiii', 'GLFW.active.keyFunc') }}}(GLFW.active.id, key, keyCode, status, GLFW.getModBits(GLFW.active));
398398
#endif
399399
}
400400
},
@@ -510,7 +510,7 @@ var LibraryGLFW = {
510510
{{{ makeDynCall('vii', 'GLFW.active.mouseButtonFunc') }}}(eventButton, status);
511511
#endif
512512
#if USE_GLFW == 3
513-
{{{ makeDynCall('viiii', 'GLFW.active.mouseButtonFunc') }}}(GLFW.active.id, eventButton, status, GLFW.getModBits(GLFW.active));
513+
{{{ makeDynCall('vpiii', 'GLFW.active.mouseButtonFunc') }}}(GLFW.active.id, eventButton, status, GLFW.getModBits(GLFW.active));
514514
#endif
515515
}
516516
},
@@ -601,7 +601,7 @@ var LibraryGLFW = {
601601
{{{ makeDynCall('vii', 'GLFW.active.windowSizeFunc') }}}(GLFW.active.width, GLFW.active.height);
602602
#endif
603603
#if USE_GLFW == 3
604-
{{{ makeDynCall('viii', 'GLFW.active.windowSizeFunc') }}}(GLFW.active.id, GLFW.active.width, GLFW.active.height);
604+
{{{ makeDynCall('vpii', 'GLFW.active.windowSizeFunc') }}}(GLFW.active.id, GLFW.active.width, GLFW.active.height);
605605
#endif
606606
}
607607
},
@@ -611,7 +611,7 @@ var LibraryGLFW = {
611611

612612
#if USE_GLFW == 3
613613
if (GLFW.active.framebufferSizeFunc) {
614-
{{{ makeDynCall('viii', 'GLFW.active.framebufferSizeFunc') }}}(GLFW.active.id, GLFW.active.width, GLFW.active.height);
614+
{{{ makeDynCall('vpii', 'GLFW.active.framebufferSizeFunc') }}}(GLFW.active.id, GLFW.active.width, GLFW.active.height);
615615
}
616616
#endif
617617
},
@@ -642,8 +642,10 @@ var LibraryGLFW = {
642642
},
643643

644644
setJoystickCallback: (cbfun) => {
645+
var prevcbfun = GLFW.joystickFunc;
645646
GLFW.joystickFunc = cbfun;
646647
GLFW.refreshJoysticks();
648+
return prevcbfun;
647649
},
648650

649651
joys: {}, // glfw joystick data
@@ -780,7 +782,7 @@ var LibraryGLFW = {
780782
var data = e.target.result;
781783
FS.writeFile(path, new Uint8Array(data));
782784
if (++written === count) {
783-
{{{ makeDynCall('viii', 'GLFW.active.dropFunc') }}}(GLFW.active.id, count, filenames);
785+
{{{ makeDynCall('vpii', 'GLFW.active.dropFunc') }}}(GLFW.active.id, count, filenames);
784786

785787
for (var i = 0; i < filenamesArray.length; ++i) {
786788
_free(filenamesArray[i]);
@@ -994,7 +996,7 @@ var LibraryGLFW = {
994996
{{{ makeDynCall('vii', 'win.windowSizeFunc') }}}(width, height);
995997
#endif
996998
#if USE_GLFW == 3
997-
{{{ makeDynCall('viii', 'win.windowSizeFunc') }}}(win.id, width, height);
999+
{{{ makeDynCall('vpii', 'win.windowSizeFunc') }}}(win.id, width, height);
9981000
#endif
9991001
}
10001002
},
@@ -1064,7 +1066,7 @@ var LibraryGLFW = {
10641066

10651067
#if USE_GLFW == 3
10661068
if (win.windowCloseFunc) {
1067-
{{{ makeDynCall('vi', 'win.windowCloseFunc') }}}(win.id);
1069+
{{{ makeDynCall('vp', 'win.windowCloseFunc') }}}(win.id);
10681070
}
10691071
#endif
10701072

@@ -1220,7 +1222,7 @@ var LibraryGLFW = {
12201222
glfwExtensionSupported__deps: ['glGetString'],
12211223
glfwExtensionSupported: (extension) => {
12221224
if (!GLFW.extensions) {
1223-
GLFW.extensions = UTF8ToString(_glGetString(0x1F03)).split(' ');
1225+
GLFW.extensions = GL.getExtensions();
12241226
}
12251227

12261228
if (GLFW.extensions.includes(extension)) return 1;
@@ -1758,7 +1760,7 @@ var LibraryGLFW = {
17581760
},
17591761

17601762
glfwCreateThread: (fun, arg) => {
1761-
{{{ makeDynCall('vi', 'fun') }}}(arg);
1763+
{{{ makeDynCall('vp', 'fun') }}}(arg);
17621764
// One single thread
17631765
return 0;
17641766
},

src/library_webgl.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,6 +1126,14 @@ var LibraryGL = {
11261126
});
11271127
},
11281128
#endif
1129+
1130+
getExtensions() {
1131+
var exts = GLctx.getSupportedExtensions() || []; // .getSupportedExtensions() can return null if context is lost, so coerce to empty array.
1132+
#if GL_EXTENSIONS_IN_PREFIXED_FORMAT
1133+
exts = exts.concat(exts.map((e) => "GL_" + e));
1134+
#endif
1135+
return exts;
1136+
},
11291137
},
11301138

11311139
glPixelStorei: (pname, param) => {
@@ -1141,11 +1149,7 @@ var LibraryGL = {
11411149
if (!ret) {
11421150
switch (name_) {
11431151
case 0x1F03 /* GL_EXTENSIONS */:
1144-
var exts = GLctx.getSupportedExtensions() || []; // .getSupportedExtensions() can return null if context is lost, so coerce to empty array.
1145-
#if GL_EXTENSIONS_IN_PREFIXED_FORMAT
1146-
exts = exts.concat(exts.map((e) => "GL_" + e));
1147-
#endif
1148-
ret = stringToNewUTF8(exts.join(' '));
1152+
ret = stringToNewUTF8(GL.getExtensions().join(' '));
11491153
break;
11501154
case 0x1F00 /* GL_VENDOR */:
11511155
case 0x1F01 /* GL_RENDERER */:

src/library_webgl2.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,7 @@ var LibraryWebGL2 = {
2424
}
2525
switch (name) {
2626
case 0x1F03 /* GL_EXTENSIONS */:
27-
var exts = GLctx.getSupportedExtensions() || []; // .getSupportedExtensions() can return null if context is lost, so coerce to empty array.
28-
#if GL_EXTENSIONS_IN_PREFIXED_FORMAT
29-
exts = exts.concat(exts.map(function(e) { return "GL_" + e; }));
30-
#endif
31-
exts = exts.map(function(e) { return stringToNewUTF8(e); });
32-
27+
var exts = GL.getExtensions().map((e) => stringToNewUTF8(e));
3328
stringiCache = GL.stringiCache[name] = exts;
3429
if (index < 0 || index >= stringiCache.length) {
3530
GL.recordError(0x501/*GL_INVALID_VALUE*/);

test/test_browser.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1640,6 +1640,7 @@ def _test_egl_base(self, *args):
16401640
def test_egl(self):
16411641
self._test_egl_base()
16421642

1643+
@no_wasm64('TODO: wasm64 + OFB')
16431644
@requires_threads
16441645
@requires_graphics_hardware
16451646
def test_egl_with_proxy_to_pthread(self):
@@ -2017,26 +2018,32 @@ def test_gl_glteximage(self):
20172018
@requires_graphics_hardware
20182019
@requires_threads
20192020
def test_gl_textures(self, args):
2021+
if args and self.is_wasm64():
2022+
self.skipTest('TODO: wasm64 + OFB')
20202023
self.btest_exit('gl_textures.cpp', args=['-lGL'] + args)
20212024

20222025
@requires_graphics_hardware
2026+
@no_wasm64('TODO: wasm64 + LEGACY_GL_EMULATION')
20232027
def test_gl_ps(self):
20242028
# pointers and a shader
20252029
shutil.copyfile(test_file('screenshot.png'), 'screenshot.png')
20262030
self.btest('gl_ps.c', reference='gl_ps.png', args=['--preload-file', 'screenshot.png', '-sLEGACY_GL_EMULATION', '-lGL', '-lSDL', '--use-preload-plugins'], reference_slack=1)
20272031

20282032
@requires_graphics_hardware
2033+
@no_wasm64('TODO: wasm64 + LEGACY_GL_EMULATION')
20292034
def test_gl_ps_packed(self):
20302035
# packed data that needs to be strided
20312036
shutil.copyfile(test_file('screenshot.png'), 'screenshot.png')
20322037
self.btest('gl_ps_packed.c', reference='gl_ps.png', args=['--preload-file', 'screenshot.png', '-sLEGACY_GL_EMULATION', '-lGL', '-lSDL', '--use-preload-plugins'], reference_slack=1)
20332038

20342039
@requires_graphics_hardware
2040+
@no_wasm64('TODO: wasm64 + LEGACY_GL_EMULATION')
20352041
def test_gl_ps_strides(self):
20362042
shutil.copyfile(test_file('screenshot.png'), 'screenshot.png')
20372043
self.btest('gl_ps_strides.c', reference='gl_ps_strides.png', args=['--preload-file', 'screenshot.png', '-sLEGACY_GL_EMULATION', '-lGL', '-lSDL', '--use-preload-plugins'])
20382044

20392045
@requires_graphics_hardware
2046+
@no_wasm64('TODO: wasm64 + LEGACY_GL_EMULATION')
20402047
def test_gl_ps_worker(self):
20412048
shutil.copyfile(test_file('screenshot.png'), 'screenshot.png')
20422049
self.btest('gl_ps_worker.c', reference='gl_ps.png', args=['--preload-file', 'screenshot.png', '-sLEGACY_GL_EMULATION', '-lGL', '-lSDL', '--use-preload-plugins'], reference_slack=1, also_proxied=True)

0 commit comments

Comments
 (0)