Skip to content

Commit da54ee3

Browse files
authored
Parameterize test_webgl_offscreen_framebuffer_state_restoration. NFC (#23064)
1 parent c35d60a commit da54ee3

File tree

2 files changed

+23
-17
lines changed

2 files changed

+23
-17
lines changed

test/browser/webgl_offscreen_framebuffer_swap_with_bad_state.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,14 @@ int main() {
2828
EMSCRIPTEN_WEBGL_CONTEXT_HANDLE ctx = emscripten_webgl_create_context("#canvas", &attr);
2929
emscripten_webgl_make_context_current(ctx);
3030

31-
#if !TEST_WEBGL2 && TEST_VAO
31+
#if !TEST_WEBGL2 && TEST_VERIFY_WEBGL1_VAO_SUPPORT
3232
// This test cannot run without browser support for OES_vertex_array_object.
33+
// This check is just to verify that the browser has support; otherwise, we
34+
// will end up testing the non-VAO path. Enabling it here does not actually do
35+
// anything, because offscreen framebuffer has already been initialized. Note
36+
// that if GL_SUPPORT_AUTOMATIC_ENABLE_EXTENSIONS=0, then offscreen
37+
// framebuffer will _never_ use VAOs on WebGL 1 (unless something enables
38+
// OES_vertex_array_object before createOffscreenFramebuffer runs).
3339
if (!emscripten_webgl_enable_extension(ctx, "OES_vertex_array_object")) {
3440
return 1;
3541
}

test/test_browser.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4322,22 +4322,22 @@ def test_webgl_vao_without_automatic_extensions(self):
43224322

43234323
# Tests that offscreen framebuffer state restoration works
43244324
@requires_graphics_hardware
4325-
def test_webgl_offscreen_framebuffer_state_restoration(self):
4326-
for args in [
4327-
# full state restoration path on WebGL 1.0
4328-
['-sMAX_WEBGL_VERSION', '-sOFFSCREEN_FRAMEBUFFER_FORBID_VAO_PATH'],
4329-
# VAO path on WebGL 1.0
4330-
['-sMAX_WEBGL_VERSION'],
4331-
['-sMAX_WEBGL_VERSION=2', '-DTEST_WEBGL2=0'],
4332-
# VAO path on WebGL 2.0
4333-
['-sMAX_WEBGL_VERSION=2', '-DTEST_WEBGL2=1', '-DTEST_ANTIALIAS=1', '-DTEST_REQUIRE_VAO=1'],
4334-
# full state restoration path on WebGL 2.0
4335-
['-sMAX_WEBGL_VERSION=2', '-DTEST_WEBGL2=1', '-DTEST_ANTIALIAS=1', '-sOFFSCREEN_FRAMEBUFFER_FORBID_VAO_PATH'],
4336-
# blitFramebuffer path on WebGL 2.0 (falls back to VAO on Firefox < 67)
4337-
['-sMAX_WEBGL_VERSION=2', '-DTEST_WEBGL2=1', '-DTEST_ANTIALIAS=0'],
4338-
]:
4339-
cmd = args + ['-lGL', '-sOFFSCREEN_FRAMEBUFFER', '-DEXPLICIT_SWAP=1']
4340-
self.btest_exit('webgl_offscreen_framebuffer_swap_with_bad_state.c', args=cmd)
4325+
@parameterized({
4326+
# full state restoration path on WebGL 1.0
4327+
'gl1_no_vao': (['-sMAX_WEBGL_VERSION=1', '-sOFFSCREEN_FRAMEBUFFER_FORBID_VAO_PATH'],),
4328+
# VAO path on WebGL 1.0
4329+
'gl1': (['-sMAX_WEBGL_VERSION=1', '-DTEST_VERIFY_WEBGL1_VAO_SUPPORT=1'],),
4330+
'gl1_max_gl2': (['-sMAX_WEBGL_VERSION=2'],),
4331+
# VAO path on WebGL 2.0
4332+
'gl2': (['-sMAX_WEBGL_VERSION=2', '-DTEST_WEBGL2=1', '-DTEST_ANTIALIAS=1'],),
4333+
# full state restoration path on WebGL 2.0
4334+
'gl2_no_vao': (['-sMAX_WEBGL_VERSION=2', '-DTEST_WEBGL2=1', '-DTEST_ANTIALIAS=1', '-sOFFSCREEN_FRAMEBUFFER_FORBID_VAO_PATH'],),
4335+
# blitFramebuffer path on WebGL 2.0 (falls back to VAO on Firefox < 67)
4336+
'gl2_no_aa': (['-sMAX_WEBGL_VERSION=2', '-DTEST_WEBGL2=1', '-DTEST_ANTIALIAS=0'],),
4337+
})
4338+
def test_webgl_offscreen_framebuffer_state_restoration(self, args, skip_vao=False):
4339+
cmd = args + ['-lGL', '-sOFFSCREEN_FRAMEBUFFER', '-DEXPLICIT_SWAP=1']
4340+
self.btest_exit('webgl_offscreen_framebuffer_swap_with_bad_state.c', args=cmd)
43414341

43424342
@parameterized({
43434343
'': ([],),

0 commit comments

Comments
 (0)