diff --git a/test/browser/webgl_offscreen_framebuffer_swap_with_bad_state.c b/test/browser/webgl_offscreen_framebuffer_swap_with_bad_state.c index 562841f24f3e9..759fb353485e0 100644 --- a/test/browser/webgl_offscreen_framebuffer_swap_with_bad_state.c +++ b/test/browser/webgl_offscreen_framebuffer_swap_with_bad_state.c @@ -28,8 +28,14 @@ int main() { EMSCRIPTEN_WEBGL_CONTEXT_HANDLE ctx = emscripten_webgl_create_context("#canvas", &attr); emscripten_webgl_make_context_current(ctx); -#if !TEST_WEBGL2 && TEST_VAO +#if !TEST_WEBGL2 && TEST_VERIFY_WEBGL1_VAO_SUPPORT // This test cannot run without browser support for OES_vertex_array_object. + // This check is just to verify that the browser has support; otherwise, we + // will end up testing the non-VAO path. Enabling it here does not actually do + // anything, because offscreen framebuffer has already been initialized. Note + // that if GL_SUPPORT_AUTOMATIC_ENABLE_EXTENSIONS=0, then offscreen + // framebuffer will _never_ use VAOs on WebGL 1 (unless something enables + // OES_vertex_array_object before createOffscreenFramebuffer runs). if (!emscripten_webgl_enable_extension(ctx, "OES_vertex_array_object")) { return 1; } diff --git a/test/test_browser.py b/test/test_browser.py index 3d6f309d6a121..89b7edbaa6740 100644 --- a/test/test_browser.py +++ b/test/test_browser.py @@ -4322,22 +4322,22 @@ def test_webgl_vao_without_automatic_extensions(self): # Tests that offscreen framebuffer state restoration works @requires_graphics_hardware - def test_webgl_offscreen_framebuffer_state_restoration(self): - for args in [ - # full state restoration path on WebGL 1.0 - ['-sMAX_WEBGL_VERSION', '-sOFFSCREEN_FRAMEBUFFER_FORBID_VAO_PATH'], - # VAO path on WebGL 1.0 - ['-sMAX_WEBGL_VERSION'], - ['-sMAX_WEBGL_VERSION=2', '-DTEST_WEBGL2=0'], - # VAO path on WebGL 2.0 - ['-sMAX_WEBGL_VERSION=2', '-DTEST_WEBGL2=1', '-DTEST_ANTIALIAS=1', '-DTEST_REQUIRE_VAO=1'], - # full state restoration path on WebGL 2.0 - ['-sMAX_WEBGL_VERSION=2', '-DTEST_WEBGL2=1', '-DTEST_ANTIALIAS=1', '-sOFFSCREEN_FRAMEBUFFER_FORBID_VAO_PATH'], - # blitFramebuffer path on WebGL 2.0 (falls back to VAO on Firefox < 67) - ['-sMAX_WEBGL_VERSION=2', '-DTEST_WEBGL2=1', '-DTEST_ANTIALIAS=0'], - ]: - cmd = args + ['-lGL', '-sOFFSCREEN_FRAMEBUFFER', '-DEXPLICIT_SWAP=1'] - self.btest_exit('webgl_offscreen_framebuffer_swap_with_bad_state.c', args=cmd) + @parameterized({ + # full state restoration path on WebGL 1.0 + 'gl1_no_vao': (['-sMAX_WEBGL_VERSION=1', '-sOFFSCREEN_FRAMEBUFFER_FORBID_VAO_PATH'],), + # VAO path on WebGL 1.0 + 'gl1': (['-sMAX_WEBGL_VERSION=1', '-DTEST_VERIFY_WEBGL1_VAO_SUPPORT=1'],), + 'gl1_max_gl2': (['-sMAX_WEBGL_VERSION=2'],), + # VAO path on WebGL 2.0 + 'gl2': (['-sMAX_WEBGL_VERSION=2', '-DTEST_WEBGL2=1', '-DTEST_ANTIALIAS=1'],), + # full state restoration path on WebGL 2.0 + 'gl2_no_vao': (['-sMAX_WEBGL_VERSION=2', '-DTEST_WEBGL2=1', '-DTEST_ANTIALIAS=1', '-sOFFSCREEN_FRAMEBUFFER_FORBID_VAO_PATH'],), + # blitFramebuffer path on WebGL 2.0 (falls back to VAO on Firefox < 67) + 'gl2_no_aa': (['-sMAX_WEBGL_VERSION=2', '-DTEST_WEBGL2=1', '-DTEST_ANTIALIAS=0'],), + }) + def test_webgl_offscreen_framebuffer_state_restoration(self, args, skip_vao=False): + cmd = args + ['-lGL', '-sOFFSCREEN_FRAMEBUFFER', '-DEXPLICIT_SWAP=1'] + self.btest_exit('webgl_offscreen_framebuffer_swap_with_bad_state.c', args=cmd) @parameterized({ '': ([],),