[webkit-changes] [WebKit/WebKit] cf77c5: [WGSL] Serialize variables without type declarations

Tadeu Zagallo noreply at github.com
Mon Apr 3 13:33:29 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: cf77c5fc66ee77ed1ae01584fb410b2445fd5a31
      https://github.com/WebKit/WebKit/commit/cf77c5fc66ee77ed1ae01584fb410b2445fd5a31
  Author: Tadeu Zagallo <tzagallo at apple.com>
  Date:   2023-04-03 (Mon, 03 Apr 2023)

  Changed paths:
    M Source/WebGPU/WGSL/AST/ASTTypeName.h
    M Source/WebGPU/WGSL/EntryPointRewriter.cpp
    M Source/WebGPU/WGSL/GlobalVariableRewriter.cpp
    M Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp
    M Source/WebGPU/WGSL/TypeCheck.cpp
    M Tools/TestWebKitAPI/Tests/WGSL/MetalGenerationTests.cpp

  Log Message:
  -----------
  [WGSL] Serialize variables without type declarations
https://bugs.webkit.org/show_bug.cgi?id=254808
rdar://107469795

Reviewed by Myles C. Maxfield.

So far, the compiler just rejected programs that contained variables without
explicit type annotations (e.g. let x = 1), since at first we didn't have a
type checker, and consequently couldn't infer the type. Refactor the codegen
to use the inferred types instead of the AST types in most scenarios. The only
exceptions are references, which still aren't supported in the type checker.
This also requires adding type information for some of the nodes created at
runtime. For now, I'm manually adding this information to the nodes when creating
them, but later this could be done through a nicer API.

* Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp:
(WGSL::Metal::FunctionDefinitionWriter::visit):
* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::visit):

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




More information about the webkit-changes mailing list