[webkit-changes] [WebKit/WebKit] 4239b6: [WGSL] Implement constant function for subtraction
Tadeu Zagallo
noreply at github.com
Mon Oct 2 23:45:51 PDT 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 4239b6239ca6e22e94255f22781077ca0fd720b6
https://github.com/WebKit/WebKit/commit/4239b6239ca6e22e94255f22781077ca0fd720b6
Author: Tadeu Zagallo <tzagallo at apple.com>
Date: 2023-10-02 (Mon, 02 Oct 2023)
Changed paths:
M Source/WebGPU/WGSL/ConstantFunctions.h
M Source/WebGPU/WGSL/ConstantValue.h
M Source/WebGPU/WGSL/TypeCheck.cpp
M Source/WebGPU/WGSL/tests/valid/reordering.wgsl
Log Message:
-----------
[WGSL] Implement constant function for subtraction
https://bugs.webkit.org/show_bug.cgi?id=262507
rdar://116368320
Reviewed by Dan Glastonbury.
On 268726 at main we made the constant rewriter stricter, which can cause the compilation
to fail if we can't evaluate a constant. This broke the imageBlur sample, since it has
constants with negative numbers, and we didn't yet support the unary minus operator
(or binary for that matter), but this patch adds support for both and fixes the sample.
* Source/WebGPU/WGSL/ConstantFunctions.h:
(WGSL::scalarOrVector):
(WGSL::constantPow):
(WGSL::constantMinus):
(WGSL::constantVector):
(WGSL::constantVector2):
(WGSL::constantVector3):
(WGSL::constantVector4):
* Source/WebGPU/WGSL/ConstantValue.h:
(WGSL::ConstantValue::isInt const):
(WGSL::ConstantValue::isNumber const):
* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::TypeChecker):
(WGSL::TypeChecker::visitVariable):
(WGSL::TypeChecker::visit):
(WGSL::TypeChecker::chooseOverload):
* Source/WebGPU/WGSL/tests/valid/reordering.wgsl:
Canonical link: https://commits.webkit.org/268764@main
More information about the webkit-changes
mailing list