wgsl: Fixes for new validation failures
Values of array and matrix can now only be indexed by a constant value.
Dynamic indexing requires the value to be held in memory.
See: https://github.com/gpuweb/gpuweb/issues/1782
Bug: tint:867
Change-Id: I2b9ad6e40fc8121e7aca3a71c190639b39b0b862
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/54652
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Ben Clayton <bclayton@google.com>
diff --git a/src/tests/end2end/ClipSpaceTests.cpp b/src/tests/end2end/ClipSpaceTests.cpp
index 52cd95c..46160a7 100644
--- a/src/tests/end2end/ClipSpaceTests.cpp
+++ b/src/tests/end2end/ClipSpaceTests.cpp
@@ -26,16 +26,15 @@
// 1. The depth value of the top-left one is >= 0.5
// 2. The depth value of the bottom-right one is <= 0.5
pipelineDescriptor.vertex.module = utils::CreateShaderModule(device, R"(
- let pos : array<vec3<f32>, 6> = array<vec3<f32>, 6>(
- vec3<f32>(-1.0, 1.0, 1.0),
- vec3<f32>(-1.0, -1.0, 0.5),
- vec3<f32>( 1.0, 1.0, 0.5),
- vec3<f32>( 1.0, 1.0, 0.5),
- vec3<f32>(-1.0, -1.0, 0.5),
- vec3<f32>( 1.0, -1.0, 0.0));
-
[[stage(vertex)]]
fn main([[builtin(vertex_index)]] VertexIndex : u32) -> [[builtin(position)]] vec4<f32> {
+ var pos : array<vec3<f32>, 6> = array<vec3<f32>, 6>(
+ vec3<f32>(-1.0, 1.0, 1.0),
+ vec3<f32>(-1.0, -1.0, 0.5),
+ vec3<f32>( 1.0, 1.0, 0.5),
+ vec3<f32>( 1.0, 1.0, 0.5),
+ vec3<f32>(-1.0, -1.0, 0.5),
+ vec3<f32>( 1.0, -1.0, 0.0));
return vec4<f32>(pos[VertexIndex], 1.0);
})");