RESOLVED FIXED 227723
WebGL shader link error in iOS 15 beta: "Internal error compiling shader with Metal backend"
https://bugs.webkit.org/show_bug.cgi?id=227723
Summary WebGL shader link error in iOS 15 beta: "Internal error compiling shader with...
Mike Turitzin
Reported 2021-07-06 15:01:26 PDT
We are seeing this error (which is new in the iOS 15 beta) when linking some shader programs used by Figma's prototype viewer. I have personally repro'ed it on an iPad running iOS 15 (19A5281j). Shaders that previously compiled and linked without issue now fail when linking with this `getProgramInfoLog` message: "Internal error compiling shader with Metal backend. Please submit this shader, or website as a bug to https://bugs.webkit.org" I have put together a minimal repro that appears to demonstrate the issue is with usage of the comma operator (see repro steps below). (We have a shader minifier that in some cases replaces semicolons with commas.) I believe the usage below is valid GLSL syntax, and it does compile and link properly on prior versions of Safari and other browsers. Steps to Reproduce: 1. Run the following Javascript in Safari on iOS 15: (JSFiddle link: https://jsfiddle.net/9p1f3t5r/2/ ) ---------------------------------------------------------------------------------------- const VERTEX_SHADER_SOURCE = "void f(vec2 a) {} void main() { f(vec2(0.)), gl_Position = vec4(0.,0.,0.,1.); }"; // Vertex shader with comma (in main()) changed to semicolon. //const VERTEX_SHADER_SOURCE = "void f(vec2 a) {} void main() { f(vec2(0.)); gl_Position = vec4(0.,0.,0.,1.); }"; const FRAGMENT_SHADER_SOURCE = "void main() { gl_FragColor = vec4(0.); }"; const log = (msg) => { console.log(msg); document.body.innerHTML += "<p>" + msg + "</p>"; }; const canvas = document.createElement("canvas"); const gl = canvas.getContext("webgl"); const vertexShader = gl.createShader(gl.VERTEX_SHADER); gl.shaderSource(vertexShader, VERTEX_SHADER_SOURCE); gl.compileShader(vertexShader); if (!gl.getShaderParameter(vertexShader, gl.COMPILE_STATUS)) { log("error compiling vertex shader: " + gl.getShaderInfoLog(vertexShader)); } const fragmentShader = gl.createShader(gl.FRAGMENT_SHADER); gl.shaderSource(fragmentShader, FRAGMENT_SHADER_SOURCE); gl.compileShader(fragmentShader); if (!gl.getShaderParameter(fragmentShader, gl.COMPILE_STATUS)) { log("error compiling fragment shader: " + gl.getShaderInfoLog(fragmentShader)); } const program = gl.createProgram(); gl.attachShader(program, vertexShader); gl.attachShader(program, fragmentShader); gl.linkProgram(program); if (!gl.getProgramParameter(program, gl.LINK_STATUS)) { log("error linking program: " + gl.getProgramInfoLog(program)); } log("DONE"); ---------------------------------------------------------------------------------------- Expected Results: The shader program compiles/links without error. Actual Results: This error is logged when linking the program: "Internal error compiling shader with Metal backend. Please submit this shader, or website as a bug to https://bugs.webkit.org". An alternate version of the vertex shader with the usage of the comma operator in `main` replaced with a semicolon is included (commented out) in the repro code above. This change to the vertex shader causes the shader to compile/link without error.
Attachments
Patch (1.79 KB, patch)
2021-07-06 16:19 PDT, Kyle Piddington
no flags
Patch for landing (6.23 KB, patch)
2021-07-07 12:03 PDT, Kyle Piddington
no flags
Radar WebKit Bug Importer
Comment 1 2021-07-06 15:13:10 PDT
Kyle Piddington
Comment 2 2021-07-06 16:19:40 PDT
EWS Watchlist
Comment 3 2021-07-06 16:20:54 PDT
Note that there are important steps to take when updating ANGLE. See https://trac.webkit.org/wiki/UpdatingANGLE
Dean Jackson
Comment 4 2021-07-06 18:14:27 PDT
Comment on attachment 432985 [details] Patch Can we include a test?
Kyle Piddington
Comment 5 2021-07-07 12:03:30 PDT
Created attachment 433058 [details] Patch for landing
EWS
Comment 6 2021-07-07 12:35:49 PDT
Committed r279656 (239469@main): <https://commits.webkit.org/239469@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 433058 [details].
Kenneth Russell
Comment 7 2021-07-09 14:25:00 PDT
Note: filed https://github.com/KhronosGroup/WebGL/issues/3299 about upstreaming this test case to the WebGL conformance suite.
Note You need to log in before you can comment on or make changes to this bug.