Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: adfd582f7f8453e44d10940ac7020a1dd5bdf83c
      
https://github.com/WebKit/WebKit/commit/adfd582f7f8453e44d10940ac7020a1dd5bdf83c
  Author: Kimmo Kinnunen <kkinnu...@apple.com>
  Date:   2025-06-27 (Fri, 27 Jun 2025)

  Changed paths:
    M Source/ThirdParty/ANGLE/src/compiler/translator/msl/ProgramPrelude.cpp
    M 
Source/ThirdParty/ANGLE/src/compiler/translator/tree_ops/msl/RewriteUnaddressableReferences.cpp
    M Source/ThirdParty/ANGLE/src/tests/compiler_tests/MSLOutput_test.cpp
    M Source/ThirdParty/ANGLE/src/tests/gl_tests/GLSLTest.cpp

  Log Message:
  -----------
  ANGLE: Failure to compile TensorFlow.js WebGL shaders
https://bugs.webkit.org/show_bug.cgi?id=294738
rdar://153836970

Reviewed by Mike Wyrzykowski.

Increment, decrement operators with swizzles would fail to compile for
integer vectors:
    ivec4 vec;
    vec.xyz++;

This would produce:
    metal::int4 _uii;
    ANGLE_postIncrementInt(ANGLE_swizzle_ref(_uii, 0u, 1u, 2u));

ANGLE_postIncrementInt(T &a) would not match because the argument was
rvalue ANGLE_SwizzleRef, and rvalues cannot bind to non-const lvalue
references. Even if this was worked around somehow, the template would
not work because T == ANGLE_SwizzleRef, when the original intention
was that the T would be metal int, int2, int3, int4.

Write the ANGLE_postIncrementInt and other functions without templates.
This way the overload resolution applies the
ANGLE_SwizzleRef::operator intX&() conversion operator. Since the
conversion operator is applied, the returned value is a lvalue reference
and can be bound to the arg.

Due to the use of temporaries changes ANGLE_preIncrementInt,
ANGLE_preDecrementInt functions to return the result by value instead
by reference. In GLSL, these operators are not specified to produce a
lvalue. As per the current code, the translator treats the result as
rvalue.

* Source/ThirdParty/ANGLE/src/compiler/translator/msl/ProgramPrelude.cpp:
* 
Source/ThirdParty/ANGLE/src/compiler/translator/tree_ops/msl/RewriteUnaddressableReferences.cpp:
(sh::ReturnsReference):
(sh::IsUnaryLValueOp):
* Source/ThirdParty/ANGLE/src/tests/compiler_tests/MSLOutput_test.cpp:
((MSLOutputTest, UintAssignmentOperators)):
((MSLOutputTest, UintSwizzleAssignmentOperators)):
* Source/ThirdParty/ANGLE/src/tests/gl_tests/GLSLTest.cpp:

Canonical link: https://commits.webkit.org/296744@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to