[webkit-changes] [WebKit/WebKit] ed7550: [WGSL] Concretize variable initializers

Tadeu Zagallo noreply at github.com
Wed Sep 20 07:58:59 PDT 2023


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

  Changed paths:
    M Source/WebGPU/WGSL/Constraints.cpp
    M Source/WebGPU/WGSL/Constraints.h
    M Source/WebGPU/WGSL/TypeCheck.cpp
    M Source/WebGPU/WGSL/tests/invalid/for.wgsl
    M Source/WebGPU/WGSL/tests/valid/concretization.wgsl

  Log Message:
  -----------
  [WGSL] Concretize variable initializers
https://bugs.webkit.org/show_bug.cgi?id=261759
rdar://115735821

Reviewed by Mike Wyrzykowski.

When initializing any non-const declaration (i.e. let, override or var), if the
type of the declaration is inferred from the initial value, then the value must
be concretized (as defined in the spec[1]). The implementation is built on top
of the existing constraint function `satisfyOrPromote`, which is applied to
primitive types and components of composite types.

[1]: https://www.w3.org/TR/WGSL/#var-and-value

* Source/WebGPU/WGSL/Constraints.cpp:
(WGSL::concretize):
* Source/WebGPU/WGSL/Constraints.h:
* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::visitVariable):
* Source/WebGPU/WGSL/tests/invalid/for.wgsl:
* Source/WebGPU/WGSL/tests/valid/concretization.wgsl:

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




More information about the webkit-changes mailing list