Resolver: Enforce vector constructor type rules

Added enforcement for vector constructor type rules according to the
table in https://gpuweb.github.io/gpuweb/wgsl.html#type-constructor-expr.

This surfaced a number of existing tests that violated some of these
rules or had a type-declaration related bug, so this CL fixes those as
well (these tests either passed the incorrect number of arguments to a
vector constructor or relied on implicit conversions between numeric
types).

Fixed: tint:632
Fixed: tint:476
Change-Id: I8279be3eeae50b64db486ee7a91a43bd94fdff62
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/44480
Commit-Queue: Arman Uguray <armansito@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
Arman Uguray
2021-03-15 21:21:33 +00:00
committed by Commit Bot service account
parent 2f9ced0341
commit 3549e2ea8c
9 changed files with 1173 additions and 38 deletions

View File

@@ -108,7 +108,7 @@ struct Uniforms {
[[stage(vertex)]]
fn main() -> void {
const transform : mat2x2<f32> = ubo.transform;
var coord : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
var coord : vec2<f32> = array<vec2<f32>, 3>(
vec2<f32>(-1.0, 1.0),
vec2<f32>( 1.0, 1.0),
vec2<f32>(-1.0, -1.0)
@@ -133,7 +133,7 @@ struct Uniforms {
fn main() -> void {
const transform : mat2x2<f32> = ubo.transform;
const tint_symbol_1 : array<vec2<f32>, 3> = array<vec2<f32>, 3>(vec2<f32>(-1.0, 1.0), vec2<f32>(1.0, 1.0), vec2<f32>(-1.0, -1.0));
var coord : array<vec2<f32>, 3> = tint_symbol_1[vertex_index];
var coord : vec2<f32> = tint_symbol_1[vertex_index];
position = vec4<f32>((transform * coord), 0.0, 1.0);
}
)";