WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
283576
REGRESSION: WebGL shader linking error with Metal backend when mixing scalar with vector
https://bugs.webkit.org/show_bug.cgi?id=283576
Summary
REGRESSION: WebGL shader linking error with Metal backend when mixing scalar ...
edmund
Reported
2024-11-22 10:07:00 PST
Created
attachment 473341
[details]
A webpage that reproduces the issue When subtracting a vector from a scalar in a GLSL shader, the Metal backend throws the following error during the linking stage: WebGL: INVALID_OPERATION: Error: 0x00000502, in /AppleInternal/Library/BuildRoots/f00160a0-8d47-11ef-b394-4a83e32a47e1/Library/Caches/com.apple.xbs/Sources/ANGLE/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/ProgramExecutableMtl.mm, CreateMslShaderLib:381. Internal error compiling shader with Metal backend. program_source:36:12: error: as_type cast from vector 'metal::make_unsigned_t<int __attribute__((ext_vector_type(4)))>' (aka 'metal::_make_unsigned_impl<int __attribute__((ext_vector_type(4)))>::type') to scalar 'int' of different size return as_type<X>(as_type<metal::make_unsigned_t<X>>(x) - as_type<metal::make_unsigned_t<Y>>(y)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ program_source:128:24: note: in instantiation of function template specialization 'ANGLE_isub<int, int __attribute__((ext_vector_type(4)))>' requested here metal::int4 _uorig = ANGLE_isub(1, _usource); This error was triggered by the following GLSL code: ivec4 source = ivec4(0); ivec4 orig = 1 - source; In GLSL, it is allowed for addition/subtraction to apply between a scalar and a vector. However, it seems that when it converts the GLSL code into Metal, it doesn't automatically convert the scalar into a vector which causes the above error in Metal. This error is reproducible on Safari 18.1 on both iOS and macOS, and did not happen in older versions of Safari (such as Safari 17.x). However, it's unclear which version of Safari this issue was first introduced. The issue also doesn't happen on other browsers (such as Chrome). Please see the attachment for an HTML file that reproduces the error. To reproduce: 1. Open the HTML file in Safari 18.1 on macOS or iOS 2. Open the developer console to see the shader compilation result. It should trigger the above error.
Attachments
A webpage that reproduces the issue
(1.71 KB, text/html)
2024-11-22 10:07 PST
,
edmund
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2024-11-25 10:06:08 PST
<
rdar://problem/140546518
>
Kimmo Kinnunen
Comment 2
2024-11-26 04:20:10 PST
Thanks for the report, I can reproduce the issue. Until we ship a fix, you should be able to workaround the issue by using "ivec4(1) - source"
Tadeu Zagallo
Comment 3
2024-12-09 15:33:13 PST
Pull request:
https://github.com/WebKit/WebKit/pull/37668
EWS
Comment 4
2024-12-09 22:25:22 PST
Committed
287588@main
(11b5279aec61): <
https://commits.webkit.org/287588@main
> Reviewed commits have been landed. Closing PR #37668 and removing active labels.
EWS
Comment 5
2024-12-11 13:14:32 PST
Committed
283286.583@safari-7620-branch
(f936712e6292): <
https://commits.webkit.org/283286.583@safari-7620-branch
> Reviewed commits have been landed. Closing PR #2399 and removing active labels.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug