-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WGSL] Concretize variable initializers
https://bugs.webkit.org/show_bug.cgi?id=261759 rdar://115735821 Reviewed by Mike Wyrzykowski. When initializing any non-const declaration (i.e. let, override or var), if the type of the declaration is inferred from the initial value, then the value must be concretized (as defined in the spec[1]). The implementation is built on top of the existing constraint function `satisfyOrPromote`, which is applied to primitive types and components of composite types. [1]: https://www.w3.org/TR/WGSL/#var-and-value * Source/WebGPU/WGSL/Constraints.cpp: (WGSL::concretize): * Source/WebGPU/WGSL/Constraints.h: * Source/WebGPU/WGSL/TypeCheck.cpp: (WGSL::TypeChecker::visitVariable): * Source/WebGPU/WGSL/tests/invalid/for.wgsl: * Source/WebGPU/WGSL/tests/valid/concretization.wgsl: Canonical link: https://commits.webkit.org/268199@main
- Loading branch information
1 parent
24d1408
commit ed75500
Showing
5 changed files
with
51 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
// RUN: %not %wgslc | %check | ||
|
||
fn testForStatement() { | ||
// CHECK-L: for-loop condition must be bool, got ref<function, <AbstractInt>, read_write> | ||
// CHECK-L: for-loop condition must be bool, got ref<function, i32, read_write> | ||
for (var i = 0; i; i++) { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters