Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: c6450e38b6cede6d68c39146c196fd1f24438426
https://github.com/WebKit/WebKit/commit/c6450e38b6cede6d68c39146c196fd1f24438426
Author: Tadeu Zagallo <[email protected]>
Date: 2023-03-21 (Tue, 21 Mar 2023)
Changed paths:
M Source/WebGPU/WGSL/AST/ASTCompoundStatement.h
M Source/WebGPU/WGSL/AST/ASTFunction.h
M Source/WebGPU/WGSL/AST/ASTParameter.h
M Source/WebGPU/WGSL/EntryPointRewriter.cpp
M Source/WebGPU/WGSL/GlobalVariableRewriter.cpp
M Source/WebGPU/WGSL/Parser.cpp
M Source/WebGPU/WGSL/ParserPrivate.h
M Source/WebGPU/WGSL/WGSLShaderModule.h
Log Message:
-----------
[WGSL] Don't modify the AST directly when rewriting entry points
https://bugs.webkit.org/show_bug.cgi?id=254022
rdar://106807949
Reviewed by Myles C. Maxfield.
This is part of the refactoring to stop modifying the AST directly, in order to
be
able to reuse the AST across multiple compilations. Instead of directly
modifying
the entry point function in `EntryPointRewriter` we add 3 new helpers to the
shader
module to keep track of modifications made to vectors of nodes. The unfortunate
constraint is that nodes must be copyable in order to manipulated, so we change
parameters to be Refs instead of UniqueRefs (since the latter can't by
definition
be copied).
* Source/WebGPU/WGSL/AST/ASTCompoundStatement.h:
* Source/WebGPU/WGSL/AST/ASTFunction.h:
* Source/WebGPU/WGSL/AST/ASTParameter.h:
* Source/WebGPU/WGSL/EntryPointRewriter.cpp:
(WGSL::EntryPointRewriter::EntryPointRewriter):
(WGSL::EntryPointRewriter::rewrite):
(WGSL::EntryPointRewriter::collectParameters):
(WGSL::EntryPointRewriter::constructInputStruct):
(WGSL::EntryPointRewriter::appendBuiltins):
* Source/WebGPU/WGSL/GlobalVariableRewriter.cpp:
(WGSL::RewriteGlobalVariables::insertParameters):
* Source/WebGPU/WGSL/Parser.cpp:
(WGSL::Parser<Lexer>::parseFunction):
(WGSL::Parser<Lexer>::parseParameter):
* Source/WebGPU/WGSL/ParserPrivate.h:
* Source/WebGPU/WGSL/WGSLShaderModule.h:
(WGSL::ShaderModule::replace):
(WGSL::ShaderModule::takeLast):
(WGSL::ShaderModule::append):
(WGSL::ShaderModule::insert):
Canonical link: https://commits.webkit.org/261913@main
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes