-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Description
Debugging the failure of browser.test_sdl2_canvas_proxy
in Firefox, it turns out that Chrome is behaving in a nonstandard manner in its WebGL2 implementation, which hides a SDL2 Emscripten port bug, and causes the test to accidentally pass.
In Firefox the test fails as is correct, unmasking the SDL2 bug.
Reported the Chrome bug in https://issues.chromium.org/issues/448407149
What is happening is that SDL2 attempts to compile the following fragment shader:
#extension GL_OES_EGL_image_external : require
#define mediump
#define highp
#define lowp
#define SDL_TEXCOORD_PRECISION
uniform samplerExternalOES u_texture;
varying mediump vec4 v_color;
varying SDL_TEXCOORD_PRECISION vec2 v_texCoord;
void main()
{
gl_FragColor = texture2D(u_texture, v_texCoord);
gl_FragColor *= v_color;
}
but GL_OES_EGL_image_external
is not a ratified WebGL extension, and samplerExternalOES
is not a valid keyword in WebGL. I.e. SDL2 is leaking a native EGL+OpenGLES2/3 extension shader into WebGL.
Still, Chrome happily compiles and links the above shader. That shader doesn't do anything in the browser.test_sdl2_canvas_proxy
, it just is getting compiled in by SDL2, but never activated (it is not part of the test)
Firefox croaks on the above unrecognized shader, and because browser.test_sdl2_canvas_proxy
is testing the ancient asynchronously proxied WebGL support, then there is this code in the proxying implementation:
43: { name: 'getShaderParameter', func: () => {assert(ctx.getShaderParameter(objects[buffer[i++]], buffer[i++]), 'we cannot handle errors, we are async proxied WebGL') },
which assert-fails in Firefox, as it should. Chrome is silently passing past since it compiled the shader.