Deprecate the @stride attribute

Update validation error for invalid uniform array element alignment.

Update tests to either remove the @stride attribute or use a different
element type.

Bug: tint:1381
Change-Id: I50b52cd78a34d9cd162fa5f2171a5fd35dcf3b79
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/77560
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
James Price
2022-01-20 22:11:07 +00:00
parent e04d0f40de
commit f6e5cc03bf
71 changed files with 575 additions and 512 deletions

View File

@@ -9,7 +9,7 @@ struct Inner {
h : vec2<i32>;
i : mat2x3<f32>;
@align(16) j : mat3x2<f32>;
@align(16) k : @stride(16) array<vec4<i32>, 4>;
@align(16) k : array<vec4<i32>, 4>;
};
struct S {

View File

@@ -11,7 +11,7 @@ struct Inner {
@align(16)
j : mat3x2<f32>;
@align(16)
k : @stride(16) array<vec4<i32>, 4>;
k : array<vec4<i32>, 4>;
}
struct S {

View File

@@ -1,5 +1,5 @@
struct Inner {
x : i32;
@size(16) x : i32;
};
struct S {
@@ -14,7 +14,7 @@ struct S {
i : mat2x3<f32>;
j : mat3x2<f32>;
@align(16) k : Inner;
@align(16) l : @stride(16) array<Inner, 4>;
@align(16) l : array<Inner, 4>;
};
@binding(0) @group(0) var<uniform> s : S;

View File

@@ -4,9 +4,6 @@ precision mediump float;
struct Inner {
int x;
};
struct tint_padded_array_element {
Inner el;
};
struct S {
ivec3 a;
int b;
@@ -19,7 +16,7 @@ struct S {
mat2x3 i;
mat3x2 j;
Inner k;
tint_padded_array_element l[4];
Inner l[4];
};
layout (binding = 0) uniform S_1 {
@@ -34,7 +31,7 @@ layout (binding = 0) uniform S_1 {
mat2x3 i;
mat3x2 j;
Inner k;
tint_padded_array_element l[4];
Inner l[4];
} s;
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -50,7 +47,7 @@ void tint_symbol() {
mat2x3 i = s.i;
mat3x2 j = s.j;
Inner k = s.k;
tint_padded_array_element l[4] = s.l;
Inner l[4] = s.l;
return;
}
void main() {

View File

@@ -1,9 +1,6 @@
struct Inner {
int x;
};
struct tint_padded_array_element {
Inner el;
};
cbuffer cbuffer_s : register(b0, space0) {
uint4 s[13];
@@ -31,12 +28,12 @@ Inner tint_symbol_10(uint4 buffer[13], uint offset) {
return tint_symbol_12;
}
typedef tint_padded_array_element tint_symbol_11_ret[4];
typedef Inner tint_symbol_11_ret[4];
tint_symbol_11_ret tint_symbol_11(uint4 buffer[13], uint offset) {
tint_padded_array_element arr[4] = (tint_padded_array_element[4])0;
Inner arr[4] = (Inner[4])0;
{
[loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
arr[i_1].el = tint_symbol_10(buffer, (offset + (i_1 * 16u)));
arr[i_1] = tint_symbol_10(buffer, (offset + (i_1 * 16u)));
}
}
return arr;
@@ -55,6 +52,6 @@ void main() {
const float2x3 i = tint_symbol_7(s, 64u);
const float3x2 j = tint_symbol_8(s, 96u);
const Inner k = tint_symbol_10(s, 128u);
const tint_padded_array_element l[4] = tint_symbol_11(s, 144u);
const Inner l[4] = tint_symbol_11(s, 144u);
return;
}

View File

@@ -14,13 +14,10 @@ inline vec<T, N> operator*(packed_vec<T, M> lhs, matrix<T, N, M> rhs) {
struct Inner {
/* 0x0000 */ int x;
};
struct tint_padded_array_element {
/* 0x0000 */ Inner el;
/* 0x0004 */ int8_t tint_pad[12];
};
struct tint_array_wrapper {
/* 0x0000 */ tint_padded_array_element arr[4];
/* 0x0000 */ Inner arr[4];
};
struct S {
/* 0x0000 */ packed_int3 a;
@@ -35,7 +32,6 @@ struct S {
/* 0x0060 */ float3x2 j;
/* 0x0078 */ int8_t tint_pad_1[8];
/* 0x0080 */ Inner k;
/* 0x0084 */ int8_t tint_pad_2[12];
/* 0x0090 */ tint_array_wrapper l;
};

View File

@@ -1,4 +1,5 @@
struct Inner {
@size(16)
x : i32;
}
@@ -16,7 +17,7 @@ struct S {
@align(16)
k : Inner;
@align(16)
l : @stride(16) array<Inner, 4>;
l : array<Inner, 4>;
}
@binding(0) @group(0) var<uniform> s : S;