[webkit-changes] [WebKit/WebKit] 2030ce: [WGSL] Add support for arrayLength

Tadeu Zagallo noreply at github.com
Fri Sep 22 03:39:32 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 2030cec54f581d09fee9c6cbade9b8e84c87bca3
      https://github.com/WebKit/WebKit/commit/2030cec54f581d09fee9c6cbade9b8e84c87bca3
  Author: Tadeu Zagallo <tzagallo at apple.com>
  Date:   2023-09-22 (Fri, 22 Sep 2023)

  Changed paths:
    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

  Log Message:
  -----------
  [WGSL] Add support for arrayLength
https://bugs.webkit.org/show_bug.cgi?id=261835
<rdar://problem/115796109>

Reviewed by Dan Glastonbury.

Add support for the arrayLength built-in function according to the spec[1]. So far, our
DSL/overload resolution did not support nested abstract types, e.g. ptr<AS, array<T>>,
which is required by arrayLength, so it required changing the AbstractType represention
to allow nesting. Some minor tweaks were also required on the generator to correctly
serialized these nested types.

[1]: https://www.w3.org/TR/WGSL/#arrayLength-builtin

* Source/WebGPU/WGSL/Overload.cpp:
(WGSL::OverloadResolver::materialize const):
(WGSL::OverloadResolver::calculateRank):
(WGSL::OverloadResolver::unify):
(WTF::printInternal):
* Source/WebGPU/WGSL/Overload.h:
(WGSL::allocateAbstractType):
* Source/WebGPU/WGSL/TypeDeclarations.rb:
* Source/WebGPU/WGSL/generator/main.rb:
* Source/WebGPU/WGSL/tests/valid/overload.wgsl:

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




More information about the webkit-changes mailing list