-
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] Empty programs should be valid
https://bugs.webkit.org/show_bug.cgi?id=259655 rdar://113153864 Reviewed by Dan Glastonbury. This fixes two bugs related to evaluating an empty program: 1) The wgslc executable uses FileSystem::readEntireFile to read the input file, which returns nullopt if the file is empty, which is indistinguishable from when it fails to open the file. To fix that we check if the file exists first and then treat nullopt as an empty file. 2) The ASTBuilder assumed that we would always have had an allocation when saving and restoring its state. This caused a crash with empty programs, since no nodes are allocated. The fix is simply to check if we actually have an arena before trying to read it. * Source/WebGPU/WGSL/AST/ASTBuilder.cpp: (WGSL::AST::Builder::saveCurrentState): (WGSL::AST::Builder::restore): * Source/WebGPU/WGSL/tests/valid/empty.wgsl: Added. * Source/WebGPU/WGSL/wgslc.cpp: (runWGSL): Canonical link: https://commits.webkit.org/266469@main
- Loading branch information
1 parent
95275b6
commit 119aaa4
Showing
3 changed files
with
20 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// RUN: %wgslc |
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