Skip to content

Commit ca30742

Browse files
authored
Fix browser.test_sdl2_canvas_proxy on Firefox (#25439)
SDL2 renderer init attempts to compile a shader with GLES external image content. This causes Firefox to report a shader compilation error, which would cause WebGL proxying to assert(). Demote the assert() into a warning print to let Firefox pass through. Also because async proxied code cannot get the shader info log, print the info log to the browser console when compile status is queried. This way developers will see all shader compile errors automatically in proxied GL mode.
1 parent 672c442 commit ca30742

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/webGLClient.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,12 @@ function WebGLClient() {
229229
40: { name: 'texImage2D', func: func9 },
230230
41: { name: 'compressedTexImage2D', func: func7 },
231231
42: { name: 'activeTexture', func: activeTexture },
232-
43: { name: 'getShaderParameter', func: () => assert(ctx.getShaderParameter(objects[buffer[i++]], buffer[i++]), 'we cannot handle errors, we are async proxied WebGL') },
232+
43: { name: 'getShaderParameter', func: () => {
233+
// Log shader compilation errors as warnings in the console log, since we cannot get the compilation logs back to the proxied Worker in any other way.
234+
var object = objects[buffer[i++]];
235+
var param = buffer[i++];
236+
if (!ctx.getShaderParameter(object, param) && param == ctx.COMPILE_STATUS) console.warn(`Shader compilation failed: ${ctx.getShaderInfoLog(object)}`);
237+
} },
233238
44: { name: 'clearDepth', func: func1 },
234239
45: { name: 'depthFunc', func: func1 },
235240
46: { name: 'frontFace', func: func1 },

0 commit comments

Comments
 (0)