[webkit-changes] [WebKit/WebKit] 9d82f9: [WGSL] Add API to revert AST modifications

Tadeu Zagallo noreply at github.com
Wed Mar 15 09:12:31 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9d82f930b0a0f102551e47b3d13876fae3ce9929
      https://github.com/WebKit/WebKit/commit/9d82f930b0a0f102551e47b3d13876fae3ce9929
  Author: Tadeu Zagallo <tzagallo at apple.com>
  Date:   2023-03-15 (Wed, 15 Mar 2023)

  Changed paths:
    M Source/WebGPU/WGSL/GlobalVariableRewriter.cpp
    M Source/WebGPU/WGSL/MangleNames.cpp
    M Source/WebGPU/WGSL/WGSL.cpp
    M Source/WebGPU/WGSL/WGSLShaderModule.h

  Log Message:
  -----------
  [WGSL] Add API to revert AST modifications
https://bugs.webkit.org/show_bug.cgi?id=253699
rdar://106548133

Reviewed by Myles C. Maxfield.

Since we might use the same AST for compiling multiple times (and potentially with
different layouts), we can't leave our modifications to the AST to be visible by
the next compilation. Instead of directly modifying the AST this patch adds an API
for replacing nodes which records all the nodes that have been replaced so we can
undo it once we are done compiling.

* Source/WebGPU/WGSL/MangleNames.cpp:
(WGSL::NameManglerVisitor::introduceVariable):
(WGSL::NameManglerVisitor::readVariable const):
* Source/WebGPU/WGSL/WGSL.cpp:
(WGSL::prepareImpl):
* Source/WebGPU/WGSL/WGSLShaderModule.h:
(WGSL::ShaderModule::replace):
(WGSL::ShaderModule::revertReplacements):

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




More information about the webkit-changes mailing list