Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 30a16f3e2486b1627e6249729e8e837b584cac19
https://github.com/WebKit/WebKit/commit/30a16f3e2486b1627e6249729e8e837b584cac19
Author: Tadeu Zagallo <[email protected]>
Date: 2024-02-15 (Thu, 15 Feb 2024)
Changed paths:
M Source/WebGPU/WGSL/GlobalVariableRewriter.cpp
M Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp
M Source/WebGPU/WGSL/PointerRewriter.cpp
Log Message:
-----------
[WGSL] Fix arrayLength when using pointer variables
https://bugs.webkit.org/show_bug.cgi?id=269371
rdar://122293523
Reviewed by Mike Wyrzykowski.
We eliminate pointer variables by replacing references to the variables with the
variable initializer expression. This caused a few issues with the global
variable
rewriter:
- since we see multiple pointers to the same ast node, we can end up replacing
it
multiple times. In order to fix that we wrap the initializer in an identity
expression
and handle that nin the rewriter.
- avoid rewriting the array when we encounter an arrayLength call, since that
is unnecessary
- finally, we assert that we should never encounter calls to arrayLength in the
final
program. All of those should have been rewritten, and the code it generated
was not correct
* Source/WebGPU/WGSL/GlobalVariableRewriter.cpp:
(WGSL::RewriteGlobalVariables::pack):
(WGSL::RewriteGlobalVariables::getPacking):
(WGSL::RewriteGlobalVariables::readVariable const):
(WGSL::RewriteGlobalVariables::readVariable): Deleted.
* Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp:
(WGSL::Metal::emitArrayLength):
* Source/WebGPU/WGSL/PointerRewriter.cpp:
(WGSL::PointerRewriter::visit):
Canonical link: https://commits.webkit.org/274712@main
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes