Skip to content

Commit

Permalink
Remove OFFSCREEN_FRAMEBUFFER_FORBID_VAO_PATH. NFC (#23056)
Browse files Browse the repository at this point in the history
This was the only remaining test-only setting. The same effect can be
achieved instead using some EM_ASM.
  • Loading branch information
sbc100 authored Dec 10, 2024
1 parent 0e87f3d commit 102fe54
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 17 deletions.
7 changes: 1 addition & 6 deletions src/library_webgl.js
Original file line number Diff line number Diff line change
Expand Up @@ -940,7 +940,6 @@ for (/**@suppress{duplicate}*/var i = 0; i <= {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
gl.uniform1i(gl.getUniformLocation(blitProgram, "sampler"), 0);
gl.useProgram(null);

context.defaultVao = undefined;
if (gl.createVertexArray) {
context.defaultVao = gl.createVertexArray();
gl.bindVertexArray(context.defaultVao);
Expand Down Expand Up @@ -1020,17 +1019,13 @@ for (/**@suppress{duplicate}*/var i = 0; i <= {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
gl.drawArrays(5/*GL_TRIANGLE_STRIP*/, 0, 4);
}

#if !OFFSCREEN_FRAMEBUFFER_FORBID_VAO_PATH
if (context.defaultVao) {
// WebGL 2 or OES_vertex_array_object
var prevVAO = gl.getParameter(0x85B5 /*GL_VERTEX_ARRAY_BINDING*/);
gl.bindVertexArray(context.defaultVao);
draw();
gl.bindVertexArray(prevVAO);
}
else
#endif
{
} else {
var prevVertexAttribPointer = {
buffer: gl.getVertexAttrib(context.blitPosLoc, 0x889F /*GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING*/),
size: gl.getVertexAttrib(context.blitPosLoc, 0x8623 /*GL_VERTEX_ATTRIB_ARRAY_SIZE*/),
Expand Down
8 changes: 0 additions & 8 deletions src/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -2186,14 +2186,6 @@ var LEGACY_RUNTIME = false;
// [link]
var SIGNATURE_CONVERSIONS = [];

//===========================================
// Internal, used for testing only, from here
//===========================================

// Internal (testing only): Disables the blitOffscreenFramebuffer VAO path.
// [link]
var OFFSCREEN_FRAMEBUFFER_FORBID_VAO_PATH = false;

// For renamed settings the format is:
// [OLD_NAME, NEW_NAME]
// For removed settings (which now effectively have a fixed value and can no
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ int main() {

EMSCRIPTEN_WEBGL_CONTEXT_HANDLE ctx = emscripten_webgl_create_context("#canvas", &attr);
emscripten_webgl_make_context_current(ctx);
#ifdef TEST_DISABLE_VAO
EM_ASM({
console.log(GL.currentContext.defaultVao);
assert(GL.currentContext.defaultVao);
GL.currentContext.defaultVao = undefined;
});
#endif

#if !TEST_WEBGL2 && TEST_VERIFY_WEBGL1_VAO_SUPPORT
// This test cannot run without browser support for OES_vertex_array_object.
Expand Down
4 changes: 2 additions & 2 deletions test/test_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -4321,14 +4321,14 @@ def test_webgl_vao_without_automatic_extensions(self):
@requires_graphics_hardware
@parameterized({
# full state restoration path on WebGL 1.0
'gl1_no_vao': (['-sMAX_WEBGL_VERSION=1', '-sOFFSCREEN_FRAMEBUFFER_FORBID_VAO_PATH'],),
'gl1_no_vao': (['-sMAX_WEBGL_VERSION=1', '-DTEST_DISABLE_VAO'],),
# 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'],),
'gl2_no_vao': (['-sMAX_WEBGL_VERSION=2', '-DTEST_WEBGL2=1', '-DTEST_ANTIALIAS=1', '-DTEST_DISABLE_VAO'],),
# 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'],),
})
Expand Down
2 changes: 1 addition & 1 deletion tools/maint/update_settings_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def write_file(f):
current_comment = []
current_tags = []
for line in read_file(path_from_root('src/settings.js')).splitlines():
if 'Internal, used for testing only, from here' in line:
if 'LEGACY_SETTINGS' in line:
break
if not line:
current_comment = []
Expand Down

0 comments on commit 102fe54

Please sign in to comment.