diff --git a/.circleci/config.yml b/.circleci/config.yml index 61b2526b0c1b4..e1de4773ca4f0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -814,24 +814,12 @@ jobs: test_targets: "browser_2gb" test-browser-chrome-wasm64-4gb: executor: bionic + environment: + EMTEST_SKIP_NODE_CANARY: "1" steps: - run-tests-chrome: title: "browser64_4gb" - test_targets: " - browser64_4gb.test_TextDecoder* - browser64_4gb.test_async_* - browser64_4gb.test_audio_worklet* - browser64_4gb.test_emscripten_log - browser64_4gb.test_clientside_vertex_arrays_es3 - browser64_4gb.test_fetch* - browser64_4gb.test_emscripten_animate_canvas_element_size_manual_css - browser64_4gb.test_fulles2_sdlproc - browser64_4gb.test_html5_webgl_create_context* - browser64_4gb.test_sdl_image - browser64_4gb.test_wasm_worker* - browser64_4gb.test_cube_explosion - browser64_4gb.test_cubegeom_* - " + test_targets: "browser64_4gb" test-browser-firefox: executor: bionic steps: diff --git a/src/library_html5.js b/src/library_html5.js index eff2402afde4f..50c6877638390 100644 --- a/src/library_html5.js +++ b/src/library_html5.js @@ -2273,7 +2273,7 @@ var LibraryHTML5 = { } #if OFFSCREENCANVAS_SUPPORT } else if (canvas.canvasSharedPtr) { - var targetThread = {{{ makeGetValue('canvas.canvasSharedPtr', 8, 'i32') }}}; + var targetThread = {{{ makeGetValue('canvas.canvasSharedPtr', 8, '*') }}}; setOffscreenCanvasSizeOnTargetThread(targetThread, target, width, height); return {{{ cDefs.EMSCRIPTEN_RESULT_DEFERRED }}}; // This will have to be done asynchronously #endif diff --git a/src/library_idbstore.js b/src/library_idbstore.js index b2d806c35ad96..336fa259ffaac 100644 --- a/src/library_idbstore.js +++ b/src/library_idbstore.js @@ -103,7 +103,7 @@ var LibraryIDBStore = { } var buffer = _malloc(byteArray.length); // must be freed by the caller! HEAPU8.set(byteArray, buffer); - {{{ makeSetValue('pbuffer', 0, 'buffer', 'i32') }}}; + {{{ makeSetValue('pbuffer', 0, 'buffer', '*') }}}; {{{ makeSetValue('pnum', 0, 'byteArray.length', 'i32') }}}; {{{ makeSetValue('perror', 0, '0', 'i32') }}}; wakeUp(); diff --git a/src/library_pthread.js b/src/library_pthread.js index 1034d54051e78..eebbc2b5d4613 100644 --- a/src/library_pthread.js +++ b/src/library_pthread.js @@ -875,7 +875,7 @@ var LibraryPThread = { // owns the OffscreenCanvas. for (var canvas of Object.values(offscreenCanvases)) { // pthread ptr to the thread that owns this canvas. - {{{ makeSetValue('canvas.canvasSharedPtr', 8, 'pthread_ptr', 'i32') }}}; + {{{ makeSetValue('canvas.canvasSharedPtr', 8, 'pthread_ptr', '*') }}}; } #endif diff --git a/src/library_webgl.js b/src/library_webgl.js index c8571f41ecf9a..53936386f1601 100644 --- a/src/library_webgl.js +++ b/src/library_webgl.js @@ -1731,7 +1731,8 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}}; GLctx.readPixels(x, y, width, height, format, type, pixels); } else { var heap = heapObjectForWebGLType(type); - GLctx.readPixels(x, y, width, height, format, type, heap, toTypedArrayIndex(pixels, heap)); + var target = toTypedArrayIndex(pixels, heap); + GLctx.readPixels(x, y, width, height, format, type, heap, target); } return; } @@ -3310,7 +3311,7 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}}; if (length) {{{ makeSetValue('length', '0', 'numBytesWrittenExclNull', 'i32') }}}; }, - glGetShaderiv : (shader, pname, p) => { + glGetShaderiv: (shader, pname, p) => { if (!p) { // GLES2 specification does not specify how to behave if p is a null // pointer. Since calling this function does not make sense if p == null, diff --git a/test/browser/webgl2_garbage_free_entrypoints.cpp b/test/browser/webgl2_garbage_free_entrypoints.cpp index 17ce65e8cfc5a..c154a9be6f751 100644 --- a/test/browser/webgl2_garbage_free_entrypoints.cpp +++ b/test/browser/webgl2_garbage_free_entrypoints.cpp @@ -101,7 +101,7 @@ int main(int argc, char *argv[]) glDrawArrays(GL_TRIANGLES, 0, 6); unsigned char pixel[4]; - glReadPixels(1,1,1,1,GL_RGBA,GL_UNSIGNED_BYTE, pixel); + glReadPixels(1, 1, 1, 1, GL_RGBA,GL_UNSIGNED_BYTE, pixel); printf("%d,%d,%d,%d\n", pixel[0], pixel[1], pixel[2], pixel[3]); assert(pixel[0] == 255); assert(pixel[1] == 178); diff --git a/test/browser/webgl2_get_buffer_sub_data.cpp b/test/browser/webgl2_get_buffer_sub_data.cpp index 3856e50aa23ee..ceb325404b327 100644 --- a/test/browser/webgl2_get_buffer_sub_data.cpp +++ b/test/browser/webgl2_get_buffer_sub_data.cpp @@ -21,10 +21,19 @@ int main() glBindBuffer(GL_ARRAY_BUFFER, buffer); glBufferData(GL_ARRAY_BUFFER, sizeof(data), data, GL_STATIC_DRAW); - uint8_t data2[8] = {}; + uint8_t data2[8] = { 1, 1, 1, 1, 1, 1, 1, 1 }; // Test full buffer read glGetBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(data), data2); + printf("read data: %x %x %x %x %x %x %x %x\n", + data2[0], + data2[1], + data2[2], + data2[3], + data2[4], + data2[5], + data2[6], + data2[7]); assert(!memcmp(data, data2, sizeof(data))); // Test partial buffer read diff --git a/test/resize_offscreencanvas_from_main_thread.cpp b/test/resize_offscreencanvas_from_main_thread.cpp index e61795367ba7e..5b1d510149e21 100644 --- a/test/resize_offscreencanvas_from_main_thread.cpp +++ b/test/resize_offscreencanvas_from_main_thread.cpp @@ -14,8 +14,7 @@ // If not defined, the pthread that owns the OffscreenCanvas is using emscripten_set_main_loop() so periodically yields back to the event loop. // #define TEST_SYNC_BLOCKING_LOOP -void thread_local_main_loop() -{ +void thread_local_main_loop() { int w = 0, h = 0; emscripten_get_canvas_element_size("#canvas", &w, &h); if (w == 699 && h == 299) { @@ -27,11 +26,10 @@ void thread_local_main_loop() emscripten_force_exit(0); } - printf("%dx%d\n", w, h); + printf("thread_local_main_loop: %dx%d\n", w, h); } -void *thread_main(void *arg) -{ +void *thread_main(void *arg) { EmscriptenWebGLContextAttributes attr; emscripten_webgl_init_context_attributes(&attr); attr.explicitSwapControl = EM_TRUE; @@ -57,14 +55,13 @@ void *thread_main(void *arg) return 0; } -void resize_canvas(void *) -{ +void resize_canvas(void* arg) { // Test that on the main thread, we can observe size changes to the canvas size. int w, h; emscripten_get_canvas_element_size("#canvas", &w, &h); + printf("Main thread saw canvas to get resized to %dx%d.\n", w, h); assert(w == 355 && "We did not observe the effect of pthread having resized OffscreenCanvas"); assert(h == 233); - printf("Main thread saw canvas to get resized to %dx%d.\n", w, h); // Test that on the main thread, we can also change the size. (pthread listens to see this) printf("Main thread resizing OffscreenCanvas to size 699x299.\n"); @@ -72,16 +69,14 @@ void resize_canvas(void *) } //should be able to do this regardless of offscreen canvas support -void get_canvas_size() -{ +void get_canvas_size() { int w, h; emscripten_get_canvas_element_size("#canvas", &w, &h); assert(h == 150); assert(w == 300); } -int main() -{ +int main() { get_canvas_size(); if (!emscripten_supports_offscreencanvas()) { printf("Current browser does not support OffscreenCanvas. Skipping the rest of the tests.\n"); diff --git a/test/runtime_misuse.cpp b/test/runtime_misuse.cpp index 72aeaaa9cbe9b..28c6bd090771d 100644 --- a/test/runtime_misuse.cpp +++ b/test/runtime_misuse.cpp @@ -11,7 +11,7 @@ extern "C" { int noted = 0; char* EMSCRIPTEN_KEEPALIVE note(int n) { - EM_ASM({ Module.noted = Number($0); out("set noted " + Module.noted) }, (long)¬ed); + EM_ASM({ Module.noted = Number($0); out("set noted " + Module.noted) }, ¬ed); EM_ASM({ out([$0, $1]) }, n, noted); noted += n; EM_ASM({ out(['noted is now', $0]) }, noted); diff --git a/test/runtime_misuse_2.cpp b/test/runtime_misuse_2.cpp index 839917c9b0a57..047ba9db394ae 100644 --- a/test/runtime_misuse_2.cpp +++ b/test/runtime_misuse_2.cpp @@ -11,7 +11,7 @@ extern "C" { int noted = 0; char* EMSCRIPTEN_KEEPALIVE note(int n) { - EM_ASM({ Module.noted = Number($0) }, (long)¬ed); + EM_ASM({ Module.noted = Number($0); out("set noted " + Module.noted) }, ¬ed); EM_ASM({ out([$0, $1]) }, n, noted); noted += n; EM_ASM({ out(['noted is now', $0]) }, noted); diff --git a/test/test_browser.py b/test/test_browser.py index d6a0fdbb540dc..fd93ea41fe987 100644 --- a/test/test_browser.py +++ b/test/test_browser.py @@ -1341,6 +1341,7 @@ def test_webgl_parallel_shader_compile(self): self.btest_exit('webgl_parallel_shader_compile.cpp') @requires_graphics_hardware + @no_4gb('readPixels fails: https://crbug.com/324992397') def test_webgl_explicit_uniform_location(self): self.btest_exit('webgl_explicit_uniform_location.c', args=['-sGL_EXPLICIT_UNIFORM_LOCATION', '-sMIN_WEBGL_VERSION=2']) @@ -1349,6 +1350,7 @@ def test_webgl_sampler_layout_binding(self): self.btest_exit('webgl_sampler_layout_binding.c', args=['-sGL_EXPLICIT_UNIFORM_BINDING']) @requires_graphics_hardware + @no_4gb('readPixels fails: https://crbug.com/324992397') def test_webgl2_ubo_layout_binding(self): self.btest_exit('webgl2_ubo_layout_binding.c', args=['-sGL_EXPLICIT_UNIFORM_BINDING', '-sMIN_WEBGL_VERSION=2']) @@ -1550,6 +1552,7 @@ def test_sdl_gl_read(self): self.btest_exit('test_sdl_gl_read.c', args=['-lSDL', '-lGL']) @requires_graphics_hardware + @no_4gb('readPixels fails: https://crbug.com/324992397') def test_sdl_gl_mapbuffers(self): self.btest_exit('test_sdl_gl_mapbuffers.c', args=['-sFULL_ES3', '-lSDL', '-lGL']) @@ -1685,6 +1688,9 @@ def test_worker(self): self.run_browser('main.html', '/report_result?hello from worker, and :' + ('data for w' if file_data else '') + ':') # code should run standalone too + # To great memories >4gb we need the canary version of node + if self.is_4gb(): + self.require_node_canary() self.assertContained('you should not see this text when in a worker!', self.run_js('worker.js')) @no_wasmfs('https://github.com/emscripten-core/emscripten/issues/19608') @@ -2520,7 +2526,7 @@ def test_runtime_misuse(self, mode): var xhr = new XMLHttpRequest(); out('done timeout noted = ' + Module.noted); assert(Module.noted); - xhr.open('GET', 'http://localhost:%s/report_result?' + HEAP32[Module.noted>>2]); + xhr.open('GET', 'http://localhost:%s/report_result?' + HEAP32[Module.noted/4]); xhr.send(); setTimeout(function() { window.close() }, 1000); }, 0); @@ -2766,6 +2772,7 @@ def test_webgl2(self, args): # Tests the WebGL 2 glGetBufferSubData() functionality. @requires_graphics_hardware + @no_4gb('getBufferSubData fails: https://crbug.com/325090165') def test_webgl2_get_buffer_sub_data(self): self.btest_exit('webgl2_get_buffer_sub_data.cpp', args=['-sMAX_WEBGL_VERSION=2', '-lGL']) @@ -2811,6 +2818,8 @@ def test_webgl2_ubos(self): 'webgl2': (['-sMAX_WEBGL_VERSION=2', '-DTEST_WEBGL2=1'],), }) def test_webgl2_garbage_free_entrypoints(self, args): + if args and self.is_4gb(): + self.skipTest('readPixels fails: https://crbug.com/324992397') self.btest_exit('webgl2_garbage_free_entrypoints.cpp', args=args) @requires_graphics_hardware @@ -2838,30 +2847,36 @@ def test_webgl2_packed_types(self): self.btest_exit('webgl2_draw_packed_triangle.c', args=['-lGL', '-sMAX_WEBGL_VERSION=2', '-sGL_ASSERTIONS']) @requires_graphics_hardware + @no_4gb('compressedTexSubImage2D fails: https://crbug.com/324562920') def test_webgl2_pbo(self): self.btest_exit('webgl2_pbo.cpp', args=['-sMAX_WEBGL_VERSION=2', '-lGL']) @no_firefox('fails on CI likely due to GPU drivers there') @requires_graphics_hardware + @no_4gb('fails to render') def test_webgl2_sokol_mipmap(self): self.btest('third_party/sokol/mipmap-emsc.c', args=['-sMAX_WEBGL_VERSION=2', '-lGL', '-O1'], reference='third_party/sokol/mipmap-emsc.png', reference_slack=2) @no_firefox('fails on CI likely due to GPU drivers there') + @no_4gb('fails to render') @requires_graphics_hardware def test_webgl2_sokol_mrt(self): self.btest('third_party/sokol/mrt-emcc.c', args=['-sMAX_WEBGL_VERSION=2', '-lGL'], reference='third_party/sokol/mrt-emcc.png') @requires_graphics_hardware + @no_4gb('fails to render') def test_webgl2_sokol_arraytex(self): self.btest('third_party/sokol/arraytex-emsc.c', args=['-sMAX_WEBGL_VERSION=2', '-lGL'], reference='third_party/sokol/arraytex-emsc.png') - def test_sdl_touch(self): - for opts in [[], ['-O2', '-g1', '--closure=1']]: - print(opts) - self.btest_exit('test_sdl_touch.c', args=opts + ['-DAUTOMATE_SUCCESS=1', '-lSDL', '-lGL']) + @parameterized({ + '': ([],), + 'closure': (['-O2', '-g1', '--closure=1'],), + }) + def test_sdl_touch(self, opts): + self.btest_exit('test_sdl_touch.c', args=opts + ['-DAUTOMATE_SUCCESS=1', '-lSDL', '-lGL']) def test_html5_mouse(self): for opts in [[], ['-O2', '-g1', '--closure=1']]: @@ -4688,9 +4703,9 @@ def test_webgl_draw_base_vertex_base_instance(self): '-DWEBGL_CONTEXT_VERSION=2']) @requires_graphics_hardware + @no_4gb('fails to render') def test_webgl_sample_query(self): - cmd = ['-sMAX_WEBGL_VERSION=2', '-lGL'] - self.btest_exit('webgl_sample_query.cpp', args=cmd) + self.btest_exit('webgl_sample_query.cpp', args=['-sMAX_WEBGL_VERSION=2', '-lGL']) @requires_graphics_hardware @parameterized({ @@ -4746,6 +4761,7 @@ def test_webgl_offscreen_framebuffer_state_restoration(self): # Tests that using an array of structs in GL uniforms works. @requires_graphics_hardware + @no_4gb('fails to render') def test_webgl_array_of_structs_uniform(self): self.btest('webgl_array_of_structs_uniform.c', args=['-lGL', '-sMAX_WEBGL_VERSION=2'], reference='browser/webgl_array_of_structs_uniform.png')