[webkit-changes] [WebKit/WebKit] 7ba090: [WGSL] Initial constant resolution implementation

Tadeu Zagallo noreply at github.com
Mon May 29 02:11:06 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7ba090e99148d4ffea4f8c4ceb7cbf0dd60a5f37
      https://github.com/WebKit/WebKit/commit/7ba090e99148d4ffea4f8c4ceb7cbf0dd60a5f37
  Author: Tadeu Zagallo <tzagallo at apple.com>
  Date:   2023-05-29 (Mon, 29 May 2023)

  Changed paths:
    A Source/WebGPU/WGSL/ConstantRewriter.cpp
    A Source/WebGPU/WGSL/ConstantRewriter.h
    M Source/WebGPU/WGSL/GlobalVariableRewriter.cpp
    M Source/WebGPU/WGSL/WGSL.cpp
    A Source/WebGPU/WGSL/tests/valid/constants.wgsl
    M Source/WebGPU/WebGPU.xcodeproj/project.pbxproj

  Log Message:
  -----------
  [WGSL] Initial constant resolution implementation
https://bugs.webkit.org/show_bug.cgi?id=257381
rdar://109888410

Reviewed by Mike Wyrzykowski.

Add a simple constant resolution phase. For now, it can only handle literals,
but it will be expanded soon to handle other types of data and expressions.

* Source/WebGPU/WGSL/ConstantRewriter.cpp: Added.
(WGSL::ConstantValue::dump const):
(WGSL::ConstantRewriter::ConstantRewriter):
(WGSL::ConstantRewriter::rewrite):
(WGSL::ConstantRewriter::visit):
(WGSL::ConstantRewriter::evaluate):
(WGSL::ConstantRewriter::materialize):
(WGSL::ConstantRewriter::error):
(WGSL::rewriteConstants):
* Source/WebGPU/WGSL/ConstantRewriter.h: Added.
* Source/WebGPU/WGSL/GlobalVariableRewriter.cpp:
(WGSL::RewriteGlobalVariables::determineUsedGlobals):
* Source/WebGPU/WGSL/WGSL.cpp:
(WGSL::staticCheck):
* Source/WebGPU/WGSL/tests/valid/constants.wgsl: Added.
* Source/WebGPU/WebGPU.xcodeproj/project.pbxproj:

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




More information about the webkit-changes mailing list