[Webkit-unassigned] [Bug 227723] New: WebGL shader link error in iOS 15 beta: "Internal error compiling shader with Metal backend"

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Jul 6 15:01:26 PDT 2021


https://bugs.webkit.org/show_bug.cgi?id=227723

            Bug ID: 227723
           Summary: WebGL shader link error in iOS 15 beta: "Internal
                    error compiling shader with Metal backend"
           Product: WebKit
           Version: Safari Technology Preview
          Hardware: iPhone / iPad
                OS: Other
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: WebGL
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: mturitzin at figma.com
                CC: dino at apple.com, kbr at google.com, kkinnunen at apple.com

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.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20210706/d2510def/attachment-0001.htm>


More information about the webkit-unassigned mailing list