Skip to content

Parameterize test_webgl_offscreen_framebuffer_state_restoration. NFC #23064

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
32 changes: 16 additions & 16 deletions test/test_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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({
'': ([],),
Expand Down
Loading