Bug 244152
Summary: | use of gl_VertexId causes error compiling shader with Metal backend | ||
---|---|---|---|
Product: | WebKit | Reporter: | morem |
Component: | WebGL | Assignee: | Nobody <webkit-unassigned> |
Status: | NEW | ||
Severity: | Normal | CC: | dino, geofflang, gman, jonahr, kbr, kkinnunen, kpiddington, morem, webkit-bug-importer |
Priority: | P2 | Keywords: | InRadar |
Version: | Safari Technology Preview | ||
Hardware: | Mac (Intel) | ||
OS: | macOS 12 |
morem
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 | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
morem
New repro link: https://molstar.org/dev/safari-debug/viewer/?debug-mode=1&disable-wboit=1&emdb=EMD-14403
Kenneth Russell
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
<rdar://problem/99218768>