Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 353252b02ec1e00a79bc45466ae67bc8c619077c
      
https://github.com/WebKit/WebKit/commit/353252b02ec1e00a79bc45466ae67bc8c619077c
  Author: Tadeu Zagallo <[email protected]>
  Date:   2023-05-31 (Wed, 31 May 2023)

  Changed paths:
    M Source/WebGPU/WGSL/AST/ASTVariable.h
    M Source/WebGPU/WGSL/GlobalVariableRewriter.cpp
    M Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp
    A Source/WebGPU/WGSL/tests/valid/local-constant-trivial.wgsl

  Log Message:
  -----------
  [WGSL] Don't serialize unused constants
https://bugs.webkit.org/show_bug.cgi?id=257494
rdar://110009934

Reviewed by Dan Glastonbury.

If all references to a constant are replaced with its value, we should no 
longer serialize
the constant declaration in the generated code. In order to do that, while 
looking at
variable uses and definitions to rewrite globals, we changen all consts which 
still
have uses into lets, and later in the code generation we simply skip over 
consts.

* Source/WebGPU/WGSL/AST/ASTVariable.h:
* Source/WebGPU/WGSL/GlobalVariableRewriter.cpp:
(WGSL::RewriteGlobalVariables::visit):
(WGSL::RewriteGlobalVariables::def):
(WGSL::RewriteGlobalVariables::read):
* Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp:
(WGSL::Metal::FunctionDefinitionWriter::serializeVariable):
* Source/WebGPU/WGSL/tests/valid/local-constant-trivial.wgsl: Added.

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


_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to