mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-08-04 03:05:42 +00:00
Fixed: tint:1697 Change-Id: I6de9ea520e8e8fcba281c8cf68ad77021eb3dd22 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/104825 Reviewed-by: David Neto <dneto@google.com> Commit-Queue: Ben Clayton <bclayton@google.com> Kokoro: Kokoro <noreply+kokoro@google.com>
19 lines
747 B
WebGPU Shading Language
19 lines
747 B
WebGPU Shading Language
// flags: --transform substitute_override
|
|
|
|
override O = 0; // Try switching to 'const'
|
|
|
|
fn f() {
|
|
const smaller_than_any_f32 = 1e-50;
|
|
// When O is an override, the outer index value is not constant, so the
|
|
// value is not calculated at shader-creation time, and does not error.
|
|
//
|
|
// When O is a const, and 'smaller_than_any_f32' *is not* materialized, the
|
|
// outer index value will evaluate to 10000, resulting in an out-of-bounds
|
|
// error.
|
|
//
|
|
// When O is a const, and 'smaller_than_any_f32' *is* materialized,
|
|
// the materialization of 'smaller_than_any_f32' to f32 will evaluate to zero,
|
|
// and so the outer index value will be zero, and we get no error.
|
|
var v = vec2(0)[i32(vec2(smaller_than_any_f32)[O]*1e27*1e27)];
|
|
}
|