Bug 242297

Summary: Shader fails to link due to Metal internal error
Product: WebKit Reporter: Pedro J. Estébanez <pedrojrulez>
Component: WebGLAssignee: Nobody <webkit-unassigned>
Status: RESOLVED CONFIGURATION CHANGED    
Severity: Normal CC: dino, kbr, kkinnunen, morem, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari 15   
Hardware: iPhone / iPad   
OS: iOS 15   
Bug Depends on: 237658    
Bug Blocks: 231180    
Attachments:
Description Flags
Shader GLSL source code none

Description Pedro J. Estébanez 2022-07-03 11:46:03 PDT
Created attachment 460642 [details]
Shader GLSL source code

A shader that the Godot game engine generates, which compiles and links succesfully on every other platform supporting OpenGL ES 3 or WebGL 2, on Safari running on an iPhone fails to be linked, and the following is logged: 
[Error] Internal error compiling shader with Metal backend.
[Error] Please submit this shader, or website as a bug to https://bugs.webkit.org
Comment 1 Pedro J. Estébanez 2022-07-03 13:19:18 PDT
I've been able to isolate the code line that causes the error:
float fog_far = fog_depth_end > 0.0 ? fog_depth_end : z_far;

If that line is replaced by the equivalent if-else construct, it works.
Comment 2 Pedro J. Estébanez 2022-07-04 01:50:06 PDT
The aforementioned fix hasn't worked for some user, though.
Comment 3 Radar WebKit Bug Importer 2022-07-10 11:47:16 PDT
<rdar://problem/96800041>
Comment 4 Kimmo Kinnunen 2022-08-01 00:20:03 PDT
I think this has been fixed now with
https://bugs.chromium.org/p/angleproject/issues/detail?id=7487
Comment 5 Pedro J. Estébanez 2022-08-01 01:18:46 PDT
Happy to know this is being addressed.

However, I wanted to stress that in my tests, even after replacing all the occurences of the ternary by their if-else equivalents, a new modality the issue happened: no errors reported neither at compile nor link, but the shader would still not render anything, as if there was a deeper internal issue that couldn't surface up to the user.
Comment 6 Kimmo Kinnunen 2022-08-01 03:51:22 PDT
Thanks. Similar observations are being discussed in bug 237658 but it's not yet clear if these are related.
Comment 7 Kimmo Kinnunen 2024-01-17 02:09:51 PST
This should now work. If not, please reopen and attach a runnable reproduction if only possible.