Bug 250169

Summary: Metal compile error when using element references as inout parameters
Product: WebKit Reporter: markus
Component: WebGLAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: dino, karlcow, kbr, kkinnunen, webkit-bug-importer
Priority: P2 Keywords: BrowserCompat, InRadar
Version: Safari 16   
Hardware: Mac (Apple Silicon)   
OS: macOS 13   
Attachments:
Description Flags
rendering in safari, firefox, chrome none

Description markus 2023-01-05 17:13:23 PST
Another shader not working on Safari (but working in Chrome just fine): https://www.shadertoy.com/view/7ldfzS
Comment 1 Alexey Proskuryakov 2023-01-05 17:46:50 PST
*** Bug 250168 has been marked as a duplicate of this bug. ***
Comment 2 Karl Dubost 2023-01-05 17:46:55 PST
Created attachment 464364 [details]
rendering in safari, firefox, chrome

working in Firefox Nightly 110, 111

Not Working in Chrome Canary 111 and Safari Technical Preview 160
Comment 3 Karl Dubost 2023-01-05 17:49:48 PST
The error message in Chrome is 

[.WebGL-0x1200324d500] GL_INVALID_OPERATION: Error: 0x00000502, in ../../third_party/angle/src/libANGLE/renderer/metal/ProgramMtl.mm, createMslShaderLib:673. Internal error compiling shader with Metal backend.
program_source:1771:16: error: no matching function for call to 'ANGLE_inout'
        _uswap(ANGLE_inout(ANGLE_elem_ref(_urnd3, 0)), ANGLE_inout(ANGLE_elem_ref(_urnd3, 1)));
               ^~~~~~~~~~~
program_source:301:36: note: candidate function [with T = ANGLE_VectorElemRef<float, 3>] not viable: expects an l-value for 1st argument
ANGLE_ALWAYS_INLINE ANGLE_InOut<T> ANGLE_inout(thread T &dest)
                                   ^
program_source:1771:56: error: no matching function for call to 'ANGLE_inout'
        _uswap(ANGLE_inout(ANGLE_elem_ref(_urnd3, 0)), ANGLE_inout(ANGLE_elem_ref(_urnd3, 1)));
                                                       ^~~~~~~~~~~
program_source:301:36: note: candidate function [with T = ANGLE_VectorElemRef<float, 3>] not viable: expects an l-value for 1st argument
ANGLE_ALWAYS_INLINE ANGLE_InOut<T> ANGLE_inout(thread T &dest)
                                   ^
program_source:1777:16: error: no matching function for call to 'ANGLE_inout'
        _uswap(ANGLE_inout(ANGLE_elem_ref(_urnd3, 0)), ANGLE_inout(ANGLE_elem_ref(_urnd3, 2)));
               ^~~~~~~~~~~
program_source:301:36: note: candidate function [with T = ANGLE_VectorElemRef<float, 3>] not viable: expects an l-value for 1st argument
ANGLE_ALWAYS_INLINE ANGLE_InOut<T> ANGLE_inout(thread T &dest)
                                   ^
program_source:1777:56: error: no matching function for call to 'ANGLE_inout'
        _uswap(ANGLE_inout(ANGLE_elem_ref(_urnd3, 0)), ANGLE_inout(ANGLE_elem_ref(_urnd3, 2)));
                                                       ^~~~~~~~~~~
program_source:301:36: note: candidate function [with T = ANGLE_VectorElemRef<float, 3>] not viable: expects an l-value for 1st argument
ANGLE_ALWAYS_INLINE ANGLE_InOut<T> ANGLE_inout(thread T &dest)
                                   ^
program_source:1783:16: error: no matching function for call to 'ANGLE_inout'
        _uswap(ANGLE_inout(ANGLE_elem_ref(_urnd3, 1)), ANGLE_inout(ANGLE_elem_ref(_urnd3, 2)));
               ^~~~~~~~~~~
program_source:301:36: note: candidate function [with T = ANGLE_VectorElemRef<float, 3>] not viable: expects an l-value for 1st argument
ANGLE_ALWAYS_INLINE ANGLE_InOut<T> ANGLE_inout(thread T &dest)
                                   ^

and … going on…


and in Safari

[Log] WebGL (2.0=true): Asynch Compile: yes, Textures: F32 [yes], F16 [yes], Depth [yes], LOD [yes], Aniso [yes], Units [16], Max Size [16384], Cube Max Size [16384], Targets: MRT [yes], F32 [yes], Max Size [16384] (7ldfzS, line 2574)
[Log] WARNING: This browser doesn't support ResizeObserver + device-pixel-content-box (1) (7ldfzS, line 19710)
Comment 4 Kimmo Kinnunen 2023-01-09 03:34:55 PST
This is ANGLE Metal backend failure, same failure for Safari as with Chrome.
Safari is slow to produce the error messages to the page, due to layout slowness.
Comment 6 Kenneth Russell 2023-01-10 17:23:24 PST
Being fixed upstream in ANGLE. Would prefer if WebKit waits for that fix to land and then rolls ANGLE forward.
Comment 7 Radar WebKit Bug Importer 2023-01-12 17:14:18 PST
<rdar://problem/104202537>