[webkit-changes] [WebKit/WebKit] c5cb96: [WGSL] Unify enums between AST and TypeChecker

Tadeu Zagallo noreply at github.com
Thu Sep 28 02:25:08 PDT 2023


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

  Changed paths:
    M Source/WebGPU/WGSL/AST/ASTForward.h
    M Source/WebGPU/WGSL/AST/ASTStringDumper.cpp
    M Source/WebGPU/WGSL/AST/ASTVariableQualifier.h
    M Source/WebGPU/WGSL/Parser.cpp
    M Source/WebGPU/WGSL/ParserPrivate.h
    M Source/WebGPU/WGSL/TypeCheck.cpp
    M Source/WebGPU/WGSL/Types.cpp
    M Source/WebGPU/WGSL/Types.h
    A Source/WebGPU/WGSL/WGSLEnums.cpp
    A Source/WebGPU/WGSL/WGSLEnums.h
    M Source/WebGPU/WebGPU.xcodeproj/project.pbxproj
    M Tools/TestWebKitAPI/Tests/WGSL/ParserTests.cpp

  Log Message:
  -----------
  [WGSL] Unify enums between AST and TypeChecker
https://bugs.webkit.org/show_bug.cgi?id=262201
rdar://116132922

Reviewed by Mike Wyrzykowski.

We had a couple enums, AccessMode and AddressSpace, defined twice: once in the
AST and once in the TypeChecker-related code. While unifying them, I also added
a few macros to simplify defining new enums, since there are a lot of enums in WGSL
and we always have to write the code to serialize and parse enums.

* Source/WebGPU/WGSL/AST/ASTForward.h:
* Source/WebGPU/WGSL/AST/ASTStringDumper.cpp:
(WGSL::AST::StringDumper::visit):
* Source/WebGPU/WGSL/AST/ASTVariableQualifier.h:
* Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp:
(WGSL::Metal::FunctionDefinitionWriter::visit):
* Source/WebGPU/WGSL/Parser.cpp:
(WGSL::Parser<Lexer>::parseVariableQualifier):
(WGSL::Parser<Lexer>::parseAddressSpace):
(WGSL::Parser<Lexer>::parseAccessMode):
(WGSL::Parser<Lexer>::parseStorageClass): Deleted.
* Source/WebGPU/WGSL/ParserPrivate.h:
* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::visitVariable):
(WGSL::TypeChecker::texelFormat):
(WGSL::TypeChecker::accessMode):
(WGSL::TypeChecker::addressSpace):
* Source/WebGPU/WGSL/Types.cpp:
(WGSL::Type::dump const):
(WTF::printInternal): Deleted.
* Source/WebGPU/WGSL/Types.h:
* Source/WebGPU/WGSL/WGSLEnums.cpp: Added.
* Source/WebGPU/WGSL/WGSLEnums.h: Added.
* Source/WebGPU/WebGPU.xcodeproj/project.pbxproj:

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




More information about the webkit-changes mailing list