From bd67eb9311678398e71961f4196131d305872b7e Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Fri, 26 Jan 2024 14:26:01 -0800 Subject: [PATCH] [wasm64] Fix reading/writing of gl attributes See #21177 --- src/library_html5_webgl.js | 2 -- src/library_webgl.js | 2 ++ test/test_browser.py | 13 +++++++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/library_html5_webgl.js b/src/library_html5_webgl.js index 1cf2dedbc2d9e..160ae644aa197 100644 --- a/src/library_html5_webgl.js +++ b/src/library_html5_webgl.js @@ -218,10 +218,8 @@ var LibraryHtml5WebGL = { }, emscripten_webgl_do_commit_frame: () => { -#if TRACE_WEBGL_CALLS var threadId = (typeof _pthread_self != 'undefined') ? _pthread_self : () => 1; err(`[Thread ${threadId()}, GL ctx: ${GL.currentContext.handle}]: emscripten_webgl_do_commit_frame()`); -#endif if (!GL.currentContext || !GL.currentContext.GLctx) { #if GL_DEBUG dbg('emscripten_webgl_commit_frame() failed: no GL context set current via emscripten_webgl_make_context_current()!'); diff --git a/src/library_webgl.js b/src/library_webgl.js index a7452d5b08496..dd1842cfb4060 100644 --- a/src/library_webgl.js +++ b/src/library_webgl.js @@ -1614,6 +1614,7 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}}; #endif ], glTexImage2D: (target, level, internalFormat, width, height, border, format, type, pixels) => { + err("glTexImage2D", pixels); #if MAX_WEBGL_VERSION >= 2 #if WEBGL2_BACKWARDS_COMPATIBILITY_EMULATION if ({{{ isCurrentContextWebGL2() }}}) { @@ -3107,6 +3108,7 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}}; #if GL_ASSERTIONS GL.validateGLObjectID(GL.shaders, shader, 'glShaderSource', 'shader'); #endif + out('glShaderSource', shader, count, string, length); var source = GL.getSource(shader, count, string, length); #if WEBGL2_BACKWARDS_COMPATIBILITY_EMULATION diff --git a/test/test_browser.py b/test/test_browser.py index ccf1ebd51c6d7..09c09d55c5694 100644 --- a/test/test_browser.py +++ b/test/test_browser.py @@ -1812,6 +1812,7 @@ def test_glgears_animation(self): self.run_browser('something.html', '/report_gl_result?true') @requires_graphics_hardware + @no_4gb('assertion fails') def test_fulles2_sdlproc(self): self.btest_exit('full_es2_sdlproc.c', assert_returncode=1, args=['-sGL_TESTING', '-DHAVE_BUILTIN_SINCOS', '-sFULL_ES2', '-lGL', '-lSDL', '-lglut', '-sGL_ENABLE_GET_PROC_ADDRESS']) @@ -1822,6 +1823,7 @@ def test_glgears_deriv(self): assert 'gl-matrix' not in read_file('test.html'), 'Should not include glMatrix when not needed' @requires_graphics_hardware + @no_4gb('fails to render') def test_glbook(self): self.emcc_args.append('-Wno-int-conversion') self.emcc_args.append('-Wno-pointer-sign') @@ -2013,6 +2015,7 @@ def test_gl_glteximage(self): }) @requires_graphics_hardware @requires_threads + @no_4gb('assertion failure') def test_gl_textures(self, args): self.btest_exit('gl_textures.cpp', args=['-lGL', '-g', '-sSTACK_SIZE=1MB'] + args) @@ -2047,14 +2050,17 @@ def test_gl_renderers(self): self.btest('gl_renderers.c', reference='gl_renderers.png', args=['-sGL_UNSAFE_OPTS=0', '-sLEGACY_GL_EMULATION', '-lGL', '-lSDL']) @requires_graphics_hardware + @no_4gb('render fails') def test_gl_stride(self): self.btest('gl_stride.c', reference='gl_stride.png', args=['-sGL_UNSAFE_OPTS=0', '-sLEGACY_GL_EMULATION', '-lGL', '-lSDL']) @requires_graphics_hardware + @no_4gb('assertion failure') def test_gl_vertex_buffer_pre(self): self.btest('gl_vertex_buffer_pre.c', reference='gl_vertex_buffer_pre.png', args=['-sGL_UNSAFE_OPTS=0', '-sLEGACY_GL_EMULATION', '-lGL', '-lSDL']) @requires_graphics_hardware + @no_4gb('assertion failure') def test_gl_vertex_buffer(self): self.btest('gl_vertex_buffer.c', reference='gl_vertex_buffer.png', args=['-sGL_UNSAFE_OPTS=0', '-sLEGACY_GL_EMULATION', '-lGL', '-lSDL'], reference_slack=1) @@ -2337,6 +2343,7 @@ def test_tex_nonbyte(self): self.btest('tex_nonbyte.c', reference='tex_nonbyte.png', args=['-sLEGACY_GL_EMULATION', '-lGL', '-lSDL']) @requires_graphics_hardware + @no_4gb('fails to render') def test_float_tex(self): self.btest('float_tex.cpp', reference='float_tex.png', args=['-lGL', '-lglut']) @@ -5587,6 +5594,7 @@ def test_4gb(self): # Tests that emmalloc supports up to 4GB Wasm heaps. @no_firefox('no 4GB support yet') + @no_4gb('depends on specific memory limits') def test_emmalloc_4gb(self): # For now, keep this in browser as this suite runs serially, which # means we don't compete for memory with anything else (and run it @@ -5597,6 +5605,7 @@ def test_emmalloc_4gb(self): # Test that it is possible to malloc() a huge 3GB memory block in 4GB mode using emmalloc. # Also test emmalloc-memvalidate and emmalloc-memvalidate-verbose build configurations. @no_firefox('no 4GB support yet') + @no_4gb('depends on specific memory limits') @parameterized({ '': (['-sMALLOC=emmalloc'],), 'debug': (['-sMALLOC=emmalloc-debug'],), @@ -5609,6 +5618,7 @@ def test_emmalloc_3gb(self, args): # Test that it is possible to malloc() a huge 3GB memory block in 4GB mode using dlmalloc. @no_firefox('no 4GB support yet') + @no_4gb('depends on specific memory limits') def test_dlmalloc_3gb(self): self.btest_exit('alloc_3gb.c', args=['-sMALLOC=dlmalloc', '-sMAXIMUM_MEMORY=4GB', '-sALLOW_MEMORY_GROWTH=1']) @@ -5664,6 +5674,7 @@ def test_wasmfs_opfs_errors(self): self.btest(test, args=args, expected="0") @no_firefox('no 4GB support yet') + @no_4gb('depends on specific memory limits') def test_emmalloc_memgrowth(self, *args): self.btest('emmalloc_memgrowth.cpp', expected='0', args=['-sMALLOC=emmalloc', '-sALLOW_MEMORY_GROWTH=1', '-sABORTING_MALLOC=0', '-sASSERTIONS=2', '-sMINIMAL_RUNTIME=1', '-sMAXIMUM_MEMORY=4GB']) @@ -5916,4 +5927,6 @@ def setUp(self): self.set_setting('INITIAL_MEMORY', '4200mb') self.set_setting('GLOBAL_BASE', '4gb') self.emcc_args.append('-Wno-experimental') + # Without this we get a warning about GLOBAL_BASE being ignored when used with SIDE_MODULE + self.emcc_args.append('-Wno-unused-command-line-argument') self.require_wasm64()