-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cleanup texture builtin WGSL validation tests
Also add in_fragment_only tests that tests these builtins only work in the fragment shader.
- Loading branch information
Showing
4 changed files
with
183 additions
and
13 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
64 changes: 64 additions & 0 deletions
64
src/webgpu/shader/validation/expression/call/builtin/shader_stage_utils.ts
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,64 @@ | ||
/** | ||
* Use to test that certain WGSL builtins are only available in the fragment stage. | ||
* Create WGSL that defines a function "foo" and its required variables that uses | ||
* the builtin being tested. Append it to these code strings then compile. It should | ||
* succeed or fail based on the value `expectSuccess`. | ||
* | ||
* See ./textureSample.spec.ts was one example | ||
*/ | ||
export const kEntryPointsToValidateFragmentOnlyBuiltins = { | ||
none: { | ||
expectSuccess: true, | ||
code: ``, | ||
}, | ||
fragment: { | ||
expectSuccess: true, | ||
code: ` | ||
@fragment | ||
fn main() { | ||
foo(); | ||
} | ||
`, | ||
}, | ||
vertex: { | ||
expectSuccess: false, | ||
code: ` | ||
@vertex | ||
fn main() -> @builtin(position) vec4f { | ||
foo(); | ||
return vec4f(); | ||
} | ||
`, | ||
}, | ||
compute: { | ||
expectSuccess: false, | ||
code: ` | ||
@compute @workgroup_size(1) | ||
fn main() { | ||
foo(); | ||
} | ||
`, | ||
}, | ||
fragment_and_compute: { | ||
expectSuccess: false, | ||
code: ` | ||
@fragment | ||
fn main1() { | ||
foo(); | ||
} | ||
@compute @workgroup_size(1) | ||
fn main2() { | ||
foo(); | ||
} | ||
`, | ||
}, | ||
compute_without_call: { | ||
expectSuccess: true, | ||
code: ` | ||
@compute @workgroup_size(1) | ||
fn main() { | ||
} | ||
`, | ||
}, | ||
}; |
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