[webkit-changes] [WebKit/WebKit] b12e77: [WGSL] Fix how globals are passed to callees

Tadeu Zagallo noreply at github.com
Thu Oct 5 01:40:32 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b12e77a6e9e69bfe2332fcb32e28ee88c3002692
      https://github.com/WebKit/WebKit/commit/b12e77a6e9e69bfe2332fcb32e28ee88c3002692
  Author: Tadeu Zagallo <tzagallo at apple.com>
  Date:   2023-10-05 (Thu, 05 Oct 2023)

  Changed paths:
    M Source/WebGPU/WGSL/GlobalVariableRewriter.cpp
    M Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp
    M Source/WebGPU/WGSL/TypeCheck.cpp
    M Source/WebGPU/WGSL/tests/valid/global-used-by-callee.wgsl

  Log Message:
  -----------
  [WGSL] Fix how globals are passed to callees
https://bugs.webkit.org/show_bug.cgi?id=262627
rdar://116468140

Reviewed by Mike Wyrzykowski.

This patch fixes 3 issues on how globals are passed to callees:
- private variables were being passed by value, which effectively made them immutable
- for overrides without explicit type annotations, the inferred type of the initializer
  wasn't being updated with the concretized type
- the rewriter assumed that all globals would have type annotations, which is not
  necessarily true for overrides.

* Source/WebGPU/WGSL/GlobalVariableRewriter.cpp:
(WGSL::RewriteGlobalVariables::visitCallee):
* Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp:
(WGSL::Metal::FunctionDefinitionWriter::visit):
* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::visitVariable):
* Source/WebGPU/WGSL/tests/valid/global-used-by-callee.wgsl:

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




More information about the webkit-changes mailing list