NEW 244152
use of gl_VertexId causes error compiling shader with Metal backend
https://bugs.webkit.org/show_bug.cgi?id=244152
Summary use of gl_VertexId causes error compiling shader with Metal backend
morem
Reported 2022-08-19 23:37:15 PDT
Hi, I get an error checking the link status of a WebGL2 shader program "Internal error compiling shader with Metal backend" Or if I call `gl.validateProgram` before checking the link status "Program has not been successfully linked." I don't have a minimal reproduction but tracked it down to the use of `gl_VertexId` and found a workaround. If I use it as is I get the above error but if I do `int(gl_VertexId)` everything works fine. I don't see this issue with Firefox or Chrome on Mac or Win. I see the issue in Safari 16.0, 15.6 and earlier. You can trigger the error in Mol* here: https://molstar.org/viewer/?debug-mode=1&emdb=EMD-14403 Best Alexander
Attachments
Kenneth Russell
Comment 2 2022-08-22 14:11:06 PDT
The new repro link fails in Chrome with ANGLE's Metal backend as well. These are the reported compilation errors: --- [.WebGL-0x118015ca100] GL_INVALID_OPERATION: Error: 0x00000502, in ../../third_party/angle/src/libANGLE/renderer/metal/ProgramMtl.mm, createMslShaderLib:768. Internal error compiling shader with Metal backend. program_source:409:28: error: call to '_ureadFromTexture' is ambiguous metal::float4 ANGLE_55 = _ureadFromTexture(ANGLE_textureEnvs._utGroup, ANGLE_invocationVertexGlobals.gl_VertexID, ANGLE_userUniforms._uuGeoTexDim); ^~~~~~~~~~~~~~~~~ program_source:377:15: note: candidate function metal::float4 _ureadFromTexture(ANGLE_TextureEnv<metal::texture2d<float>> _utex, float _ui, metal::float2 _udim) ^ program_source:389:15: note: candidate function metal::float4 _ureadFromTexture(ANGLE_TextureEnv<metal::texture2d<float>> _utex, int _ui, metal::float2 _udim) ^ program_source:418:28: error: call to '_ureadFromTexture' is ambiguous metal::float4 ANGLE_63 = _ureadFromTexture(ANGLE_textureEnvs._utPosition, ANGLE_invocationVertexGlobals.gl_VertexID, ANGLE_userUniforms._uuGeoTexDim); ^~~~~~~~~~~~~~~~~ program_source:377:15: note: candidate function metal::float4 _ureadFromTexture(ANGLE_TextureEnv<metal::texture2d<float>> _utex, float _ui, metal::float2 _udim) ^ program_source:389:15: note: candidate function metal::float4 _ureadFromTexture(ANGLE_TextureEnv<metal::texture2d<float>> _utex, int _ui, metal::float2 _udim) ^ program_source:426:28: error: call to '_ureadFromTexture' is ambiguous metal::float4 ANGLE_68 = _ureadFromTexture(ANGLE_textureEnvs._utNormal, ANGLE_invocationVertexGlobals.gl_VertexID, ANGLE_userUniforms._uuGeoTexDim); ^~~~~~~~~~~~~~~~~ program_source:377:15: note: candidate function metal::float4 _ureadFromTexture(ANGLE_TextureEnv<metal::texture2d<float>> _utex, float _ui, metal::float2 _udim) ^ program_source:389:15: note: candidate function metal::float4 _ureadFromTexture(ANGLE_TextureEnv<metal::texture2d<float>> _utex, int _ui, metal::float2 _udim) --- It makes sense that `int(gl_VertexId)` works around the bug because that disambiguates the internal function call. Surprising this didn't show up in the conformance tests.
Radar WebKit Bug Importer
Comment 3 2022-08-26 23:38:15 PDT
Note You need to log in before you can comment on or make changes to this bug.