mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-09 21:47:47 +00:00
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:
@@ -7,7 +7,7 @@ struct Inner {
|
||||
f : f32;
|
||||
g : mat2x3<f32>;
|
||||
h : mat3x2<f32>;
|
||||
i : @stride(16) array<vec4<i32>, 4>;
|
||||
i : array<vec4<i32>, 4>;
|
||||
};
|
||||
|
||||
struct S {
|
||||
|
||||
@@ -7,7 +7,7 @@ struct Inner {
|
||||
f : f32;
|
||||
g : mat2x3<f32>;
|
||||
h : mat3x2<f32>;
|
||||
i : @stride(16) array<vec4<i32>, 4>;
|
||||
i : array<vec4<i32>, 4>;
|
||||
}
|
||||
|
||||
struct S {
|
||||
|
||||
@@ -7,7 +7,7 @@ struct Inner {
|
||||
f : f32;
|
||||
g : mat2x3<f32>;
|
||||
h : mat3x2<f32>;
|
||||
i : @stride(16) array<vec4<i32>, 4>;
|
||||
i : array<vec4<i32>, 4>;
|
||||
};
|
||||
|
||||
struct S {
|
||||
@@ -26,5 +26,5 @@ fn main(@builtin(local_invocation_index) idx : u32) {
|
||||
s.arr[idx].f = f32();
|
||||
s.arr[idx].g = mat2x3<f32>();
|
||||
s.arr[idx].h = mat3x2<f32>();
|
||||
s.arr[idx].i = @stride(16) array<vec4<i32>, 4>();
|
||||
s.arr[idx].i = array<vec4<i32>, 4>();
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ struct Inner {
|
||||
f : f32;
|
||||
g : mat2x3<f32>;
|
||||
h : mat3x2<f32>;
|
||||
i : @stride(16) array<vec4<i32>, 4>;
|
||||
i : array<vec4<i32>, 4>;
|
||||
}
|
||||
|
||||
struct S {
|
||||
@@ -26,5 +26,5 @@ fn main(@builtin(local_invocation_index) idx : u32) {
|
||||
s.arr[idx].f = f32();
|
||||
s.arr[idx].g = mat2x3<f32>();
|
||||
s.arr[idx].h = mat3x2<f32>();
|
||||
s.arr[idx].i = @stride(16) array<vec4<i32>, 4>();
|
||||
s.arr[idx].i = array<vec4<i32>, 4>();
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ struct S {
|
||||
g : mat2x3<f32>;
|
||||
h : mat3x2<f32>;
|
||||
i : Inner;
|
||||
j : @stride(16) array<Inner, 4>;
|
||||
j : array<Inner, 4>;
|
||||
};
|
||||
|
||||
@binding(0) @group(0) var<storage, read> s : S;
|
||||
|
||||
@@ -4,9 +4,6 @@ precision mediump float;
|
||||
struct Inner {
|
||||
int x;
|
||||
};
|
||||
struct tint_padded_array_element {
|
||||
Inner el;
|
||||
};
|
||||
struct S {
|
||||
ivec3 a;
|
||||
int b;
|
||||
@@ -17,7 +14,7 @@ struct S {
|
||||
mat2x3 g;
|
||||
mat3x2 h;
|
||||
Inner i;
|
||||
tint_padded_array_element j[4];
|
||||
Inner j[4];
|
||||
};
|
||||
|
||||
layout (binding = 0) buffer S_1 {
|
||||
@@ -30,7 +27,7 @@ layout (binding = 0) buffer S_1 {
|
||||
mat2x3 g;
|
||||
mat3x2 h;
|
||||
Inner i;
|
||||
tint_padded_array_element j[4];
|
||||
Inner j[4];
|
||||
} s;
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
@@ -44,7 +41,7 @@ void tint_symbol() {
|
||||
mat2x3 g = s.g;
|
||||
mat3x2 h = s.h;
|
||||
Inner i = s.i;
|
||||
tint_padded_array_element j[4] = s.j;
|
||||
Inner j[4] = s.j;
|
||||
return;
|
||||
}
|
||||
void main() {
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
struct Inner {
|
||||
int x;
|
||||
};
|
||||
struct tint_padded_array_element {
|
||||
Inner el;
|
||||
};
|
||||
|
||||
ByteAddressBuffer s : register(t0, space0);
|
||||
|
||||
@@ -20,12 +17,12 @@ Inner tint_symbol_9(ByteAddressBuffer buffer, uint offset) {
|
||||
return tint_symbol_11;
|
||||
}
|
||||
|
||||
typedef tint_padded_array_element tint_symbol_10_ret[4];
|
||||
typedef Inner tint_symbol_10_ret[4];
|
||||
tint_symbol_10_ret tint_symbol_10(ByteAddressBuffer buffer, 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_9(buffer, (offset + (i_1 * 16u)));
|
||||
arr[i_1] = tint_symbol_9(buffer, (offset + (i_1 * 4u)));
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
@@ -42,6 +39,6 @@ void main() {
|
||||
const float2x3 g = tint_symbol_6(s, 48u);
|
||||
const float3x2 h = tint_symbol_7(s, 80u);
|
||||
const Inner i = tint_symbol_9(s, 104u);
|
||||
const tint_padded_array_element j[4] = tint_symbol_10(s, 108u);
|
||||
const Inner j[4] = tint_symbol_10(s, 108u);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -15,12 +15,8 @@ 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;
|
||||
@@ -33,7 +29,7 @@ struct S {
|
||||
/* 0x0050 */ float3x2 h;
|
||||
/* 0x0068 */ Inner i;
|
||||
/* 0x006c */ tint_array_wrapper j;
|
||||
/* 0x00ac */ int8_t tint_pad_1[4];
|
||||
/* 0x007c */ int8_t tint_pad[4];
|
||||
};
|
||||
|
||||
kernel void tint_symbol(const device S* tint_symbol_1 [[buffer(0)]]) {
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
OpMemberDecorate %S 8 Offset 104
|
||||
OpMemberDecorate %Inner 0 Offset 0
|
||||
OpMemberDecorate %S 9 Offset 108
|
||||
OpDecorate %_arr_Inner_uint_4 ArrayStride 16
|
||||
OpDecorate %_arr_Inner_uint_4 ArrayStride 4
|
||||
OpDecorate %s NonWritable
|
||||
OpDecorate %s Binding 0
|
||||
OpDecorate %s DescriptorSet 0
|
||||
|
||||
@@ -12,7 +12,7 @@ struct S {
|
||||
g : mat2x3<f32>;
|
||||
h : mat3x2<f32>;
|
||||
i : Inner;
|
||||
j : @stride(16) array<Inner, 4>;
|
||||
j : array<Inner, 4>;
|
||||
}
|
||||
|
||||
@binding(0) @group(0) var<storage, read> s : S;
|
||||
|
||||
@@ -12,7 +12,7 @@ struct S {
|
||||
g : mat2x3<f32>;
|
||||
h : mat3x2<f32>;
|
||||
i : Inner;
|
||||
j : @stride(16) array<Inner, 4>;
|
||||
j : array<Inner, 4>;
|
||||
};
|
||||
|
||||
@binding(0) @group(0) var<storage, write> s : S;
|
||||
@@ -28,5 +28,5 @@ fn main() {
|
||||
s.g = mat2x3<f32>();
|
||||
s.h = mat3x2<f32>();
|
||||
s.i = Inner();
|
||||
s.j = @stride(16) array<Inner, 4>();
|
||||
s.j = array<Inner, 4>();
|
||||
}
|
||||
|
||||
@@ -4,9 +4,6 @@ precision mediump float;
|
||||
struct Inner {
|
||||
int x;
|
||||
};
|
||||
struct tint_padded_array_element {
|
||||
Inner el;
|
||||
};
|
||||
struct S {
|
||||
ivec3 a;
|
||||
int b;
|
||||
@@ -17,7 +14,7 @@ struct S {
|
||||
mat2x3 g;
|
||||
mat3x2 h;
|
||||
Inner i;
|
||||
tint_padded_array_element j[4];
|
||||
Inner j[4];
|
||||
};
|
||||
|
||||
layout (binding = 0) buffer S_1 {
|
||||
@@ -30,7 +27,7 @@ layout (binding = 0) buffer S_1 {
|
||||
mat2x3 g;
|
||||
mat3x2 h;
|
||||
Inner i;
|
||||
tint_padded_array_element j[4];
|
||||
Inner j[4];
|
||||
} s;
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
@@ -45,7 +42,7 @@ void tint_symbol() {
|
||||
s.h = mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
|
||||
Inner tint_symbol_1 = Inner(0);
|
||||
s.i = tint_symbol_1;
|
||||
tint_padded_array_element tint_symbol_2[4] = tint_padded_array_element[4](tint_padded_array_element(Inner(0)), tint_padded_array_element(Inner(0)), tint_padded_array_element(Inner(0)), tint_padded_array_element(Inner(0)));
|
||||
Inner tint_symbol_2[4] = Inner[4](Inner(0), Inner(0), Inner(0), Inner(0));
|
||||
s.j = tint_symbol_2;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
struct Inner {
|
||||
int x;
|
||||
};
|
||||
struct tint_padded_array_element {
|
||||
Inner el;
|
||||
};
|
||||
|
||||
RWByteAddressBuffer s : register(u0, space0);
|
||||
|
||||
@@ -22,11 +19,11 @@ void tint_symbol_9(RWByteAddressBuffer buffer, uint offset, Inner value) {
|
||||
buffer.Store((offset + 0u), asuint(value.x));
|
||||
}
|
||||
|
||||
void tint_symbol_10(RWByteAddressBuffer buffer, uint offset, tint_padded_array_element value[4]) {
|
||||
tint_padded_array_element array[4] = value;
|
||||
void tint_symbol_10(RWByteAddressBuffer buffer, uint offset, Inner value[4]) {
|
||||
Inner array[4] = value;
|
||||
{
|
||||
[loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
|
||||
tint_symbol_9(buffer, (offset + (i_1 * 16u)), array[i_1].el);
|
||||
tint_symbol_9(buffer, (offset + (i_1 * 4u)), array[i_1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -43,7 +40,7 @@ void main() {
|
||||
tint_symbol_7(s, 80u, float3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f));
|
||||
const Inner tint_symbol_11 = (Inner)0;
|
||||
tint_symbol_9(s, 104u, tint_symbol_11);
|
||||
const tint_padded_array_element tint_symbol_12[4] = (tint_padded_array_element[4])0;
|
||||
const Inner tint_symbol_12[4] = (Inner[4])0;
|
||||
tint_symbol_10(s, 108u, tint_symbol_12);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -15,12 +15,8 @@ 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;
|
||||
@@ -33,7 +29,7 @@ struct S {
|
||||
/* 0x0050 */ float3x2 h;
|
||||
/* 0x0068 */ Inner i;
|
||||
/* 0x006c */ tint_array_wrapper j;
|
||||
/* 0x00ac */ int8_t tint_pad_1[4];
|
||||
/* 0x007c */ int8_t tint_pad[4];
|
||||
};
|
||||
|
||||
kernel void tint_symbol(device S* tint_symbol_3 [[buffer(0)]]) {
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
OpMemberDecorate %S 8 Offset 104
|
||||
OpMemberDecorate %Inner 0 Offset 0
|
||||
OpMemberDecorate %S 9 Offset 108
|
||||
OpDecorate %_arr_Inner_uint_4 ArrayStride 16
|
||||
OpDecorate %_arr_Inner_uint_4 ArrayStride 4
|
||||
OpDecorate %s NonReadable
|
||||
OpDecorate %s Binding 0
|
||||
OpDecorate %s DescriptorSet 0
|
||||
|
||||
@@ -12,7 +12,7 @@ struct S {
|
||||
g : mat2x3<f32>;
|
||||
h : mat3x2<f32>;
|
||||
i : Inner;
|
||||
j : @stride(16) array<Inner, 4>;
|
||||
j : array<Inner, 4>;
|
||||
}
|
||||
|
||||
@binding(0) @group(0) var<storage, write> s : S;
|
||||
@@ -28,5 +28,5 @@ fn main() {
|
||||
s.g = mat2x3<f32>();
|
||||
s.h = mat3x2<f32>();
|
||||
s.i = Inner();
|
||||
s.j = @stride(16) array<Inner, 4>();
|
||||
s.j = array<Inner, 4>();
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user