[webkit-changes] [WebKit/WebKit] 3d505c: [WGSL] Add support for address-of and indirection ...

Tadeu Zagallo noreply at github.com
Thu Sep 21 03:20:44 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 3d505c75ee55d8c58313680465defe3e9a145d8d
      https://github.com/WebKit/WebKit/commit/3d505c75ee55d8c58313680465defe3e9a145d8d
  Author: Tadeu Zagallo <tzagallo at apple.com>
  Date:   2023-09-21 (Thu, 21 Sep 2023)

  Changed paths:
    M Source/WebGPU/WGSL/Constraints.cpp
    M Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp
    M Source/WebGPU/WGSL/Overload.cpp
    M Source/WebGPU/WGSL/Overload.h
    M Source/WebGPU/WGSL/TypeDeclarations.rb
    M Source/WebGPU/WGSL/generator/main.rb
    M Source/WebGPU/WGSL/tests/valid/overload.wgsl
    M Source/WebGPU/WGSL/tests/valid/pointers.wgsl

  Log Message:
  -----------
  [WGSL] Add support for address-of and indirection operators
https://bugs.webkit.org/show_bug.cgi?id=261833
<rdar://problem/115795658>

Reviewed by Dan Glastonbury.

Add the type declarations for address-of (&x, spec[1]) and indirection (*x, spec[2])
operators. This required introducing AbstractReference and AbstractPointer to the
overload resolution algorithm and exposing them to the ruby DSL, as well as exposing
address space and access mode, which was done by generalizing NumericVariables to
use the underlying enum type.

[1]: https://www.w3.org/TR/WGSL/#address-of-expr
[2]: https://www.w3.org/TR/WGSL/#indirection-expr

* Source/WebGPU/WGSL/Constraints.cpp:
(WGSL::satisfies):
(WGSL::satisfyOrPromote):
* Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp:
(WGSL::Metal::FunctionDefinitionWriter::visit):
* Source/WebGPU/WGSL/Overload.cpp:
(WGSL::OverloadResolver::OverloadResolver):
(WGSL::OverloadResolver::materialize const):
(WGSL::OverloadResolver::considerCandidate):
(WGSL::OverloadResolver::calculateRank):
(WGSL::OverloadResolver::unify):
(WGSL::OverloadResolver::assign):
(WGSL::OverloadResolver::resolve const):
(WGSL::resolveOverloads):
(WTF::printInternal):
* Source/WebGPU/WGSL/Overload.h:
* Source/WebGPU/WGSL/TypeDeclarations.rb:
* Source/WebGPU/WGSL/generator/main.rb:
* Source/WebGPU/WGSL/tests/valid/overload.wgsl:
* Source/WebGPU/WGSL/tests/valid/pointers.wgsl:

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




More information about the webkit-changes mailing list