wgsl: Separate struct members with commas
Use of semicolons is still supported, but deprecated. Also updates the parsing methods for structures to better match the WGSL grammar. Bug: tint:1475 Change-Id: I7675ba42c13f91080b0ac173c352e0092021f80b Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/84380 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Ben Clayton <bclayton@google.com> Commit-Queue: James Price <jrprice@google.com>
This commit is contained in:
parent
444e051faa
commit
3b671cb377
|
@ -8,6 +8,7 @@
|
|||
|
||||
### Breaking changes
|
||||
|
||||
* Struct members are now separated by commas. [tint:1475](crbug.com/tint/1475)
|
||||
* The `@block` attribute has been removed. [tint:1324](crbug.com/tint/1324)
|
||||
* The `@stride` attribute has been removed. [tint:1381](crbug.com/tint/1381)
|
||||
* Attributes using `[[attribute]]` syntax are no longer supported. [tint:1382](crbug.com/tint/1382)
|
||||
|
|
|
@ -28,14 +28,14 @@ TEST(ModuleCloneTest, Clone) {
|
|||
// See also fuzzers/tint_ast_clone_fuzzer.cc for further coverage of cloning.
|
||||
Source::File file("test.wgsl", R"(struct S0 {
|
||||
@size(4)
|
||||
m0 : u32;
|
||||
m1 : array<u32>;
|
||||
m0 : u32,
|
||||
m1 : array<u32>,
|
||||
};
|
||||
|
||||
struct S1 {
|
||||
@size(4)
|
||||
m0 : u32;
|
||||
m1 : array<u32, 6>;
|
||||
m0 : u32,
|
||||
m1 : array<u32, 6>,
|
||||
};
|
||||
|
||||
let c0 : i32 = 10;
|
||||
|
|
|
@ -953,8 +953,8 @@ TEST_F(SpvParserMemoryTest, RemapStorageBuffer_TypesAndVarDeclarations) {
|
|||
EXPECT_THAT(module_str, HasSubstr(R"(type RTArr = @stride(4) array<u32>;
|
||||
|
||||
struct S {
|
||||
field0 : u32;
|
||||
field1 : RTArr;
|
||||
field0 : u32,
|
||||
field1 : RTArr,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage, read_write> myvar : S;
|
||||
|
|
|
@ -125,7 +125,7 @@ OpFunctionEnd)";
|
|||
EXPECT_THAT(program_ast, HasSubstr(R"(
|
||||
struct main_out {
|
||||
@builtin(position)
|
||||
x_2_1 : vec4<f32>;
|
||||
x_2_1 : vec4<f32>,
|
||||
}
|
||||
)")) << program_ast;
|
||||
|
||||
|
|
|
@ -472,7 +472,7 @@ fn main_1() {
|
|||
|
||||
struct main_out {
|
||||
@builtin(position)
|
||||
gl_Position : vec4<f32>;
|
||||
gl_Position : vec4<f32>,
|
||||
}
|
||||
|
||||
@stage(vertex)
|
||||
|
@ -532,7 +532,7 @@ fn main_1() {
|
|||
|
||||
struct main_out {
|
||||
@builtin(position)
|
||||
gl_Position : vec4<f32>;
|
||||
gl_Position : vec4<f32>,
|
||||
}
|
||||
|
||||
@stage(vertex)
|
||||
|
@ -591,7 +591,7 @@ fn main_1() {
|
|||
|
||||
struct main_out {
|
||||
@builtin(position)
|
||||
gl_Position : vec4<f32>;
|
||||
gl_Position : vec4<f32>,
|
||||
}
|
||||
|
||||
@stage(vertex)
|
||||
|
@ -650,7 +650,7 @@ fn main_1() {
|
|||
|
||||
struct main_out {
|
||||
@builtin(position)
|
||||
x_2_1 : vec4<f32>;
|
||||
x_2_1 : vec4<f32>,
|
||||
}
|
||||
|
||||
@stage(vertex)
|
||||
|
@ -708,7 +708,7 @@ fn main_1() {
|
|||
|
||||
struct main_out {
|
||||
@builtin(position)
|
||||
x_2_1 : vec4<f32>;
|
||||
x_2_1 : vec4<f32>,
|
||||
}
|
||||
|
||||
@stage(vertex)
|
||||
|
@ -766,7 +766,7 @@ fn main_1() {
|
|||
|
||||
struct main_out {
|
||||
@builtin(position)
|
||||
x_2_1 : vec4<f32>;
|
||||
x_2_1 : vec4<f32>,
|
||||
}
|
||||
|
||||
@stage(vertex)
|
||||
|
@ -802,7 +802,7 @@ fn main_1() {
|
|||
|
||||
struct main_out {
|
||||
@builtin(position)
|
||||
x_2_1 : vec4<f32>;
|
||||
x_2_1 : vec4<f32>,
|
||||
}
|
||||
|
||||
@stage(vertex)
|
||||
|
@ -1402,9 +1402,9 @@ TEST_F(SpvModuleScopeVarParserTest,
|
|||
EXPECT_THAT(module_str, HasSubstr(R"(type Arr = @stride(4) array<u32, 2u>;
|
||||
|
||||
struct S {
|
||||
field0 : u32;
|
||||
field1 : f32;
|
||||
field2 : Arr;
|
||||
field0 : u32,
|
||||
field1 : f32,
|
||||
field2 : Arr,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage, read_write> x_1 : S;
|
||||
|
@ -1434,7 +1434,7 @@ TEST_F(SpvModuleScopeVarParserTest, ColMajorDecoration_Dropped) {
|
|||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str = test::ToString(p->program());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(struct S {
|
||||
field0 : mat3x2<f32>;
|
||||
field0 : mat3x2<f32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage, read_write> myvar : S;
|
||||
|
@ -1463,7 +1463,7 @@ TEST_F(SpvModuleScopeVarParserTest, MatrixStrideDecoration_Natural_Dropped) {
|
|||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str = test::ToString(p->program());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(struct S {
|
||||
field0 : mat3x2<f32>;
|
||||
field0 : mat3x2<f32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage, read_write> myvar : S;
|
||||
|
@ -1493,7 +1493,7 @@ TEST_F(SpvModuleScopeVarParserTest, MatrixStrideDecoration) {
|
|||
const auto module_str = test::ToString(p->program());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(struct S {
|
||||
@stride(64) @internal(disable_validation__ignore_stride)
|
||||
field0 : mat3x2<f32>;
|
||||
field0 : mat3x2<f32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage, read_write> myvar : S;
|
||||
|
@ -1545,8 +1545,8 @@ TEST_F(SpvModuleScopeVarParserTest, StorageBuffer_NonWritable_AllMembers) {
|
|||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str = test::ToString(p->program());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(struct S {
|
||||
field0 : f32;
|
||||
field1 : f32;
|
||||
field0 : f32,
|
||||
field1 : f32,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage, read> x_1 : S;
|
||||
|
@ -1574,8 +1574,8 @@ TEST_F(SpvModuleScopeVarParserTest, StorageBuffer_NonWritable_NotAllMembers) {
|
|||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str = test::ToString(p->program());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(struct S {
|
||||
field0 : f32;
|
||||
field1 : f32;
|
||||
field0 : f32,
|
||||
field1 : f32,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage, read_write> x_1 : S;
|
||||
|
@ -1606,8 +1606,8 @@ TEST_F(
|
|||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str = test::ToString(p->program());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(struct S {
|
||||
field0 : f32;
|
||||
field1 : f32;
|
||||
field0 : f32,
|
||||
field1 : f32,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage, read_write> x_1 : S;
|
||||
|
@ -2360,7 +2360,7 @@ fn main_1() {
|
|||
|
||||
struct main_out {
|
||||
@builtin(sample_mask)
|
||||
x_1_1 : u32;
|
||||
x_1_1 : u32,
|
||||
}
|
||||
|
||||
@stage(fragment)
|
||||
|
@ -2397,7 +2397,7 @@ fn main_1() {
|
|||
|
||||
struct main_out {
|
||||
@builtin(sample_mask)
|
||||
x_1_1 : u32;
|
||||
x_1_1 : u32,
|
||||
}
|
||||
|
||||
@stage(fragment)
|
||||
|
@ -2434,7 +2434,7 @@ fn main_1() {
|
|||
|
||||
struct main_out {
|
||||
@builtin(sample_mask)
|
||||
x_1_1 : u32;
|
||||
x_1_1 : u32,
|
||||
}
|
||||
|
||||
@stage(fragment)
|
||||
|
@ -2470,7 +2470,7 @@ fn main_1() {
|
|||
|
||||
struct main_out {
|
||||
@builtin(sample_mask)
|
||||
x_1_1 : u32;
|
||||
x_1_1 : u32,
|
||||
}
|
||||
|
||||
@stage(fragment)
|
||||
|
@ -2507,7 +2507,7 @@ fn main_1() {
|
|||
|
||||
struct main_out {
|
||||
@builtin(sample_mask)
|
||||
x_1_1 : u32;
|
||||
x_1_1 : u32,
|
||||
}
|
||||
|
||||
@stage(fragment)
|
||||
|
@ -2544,7 +2544,7 @@ fn main_1() {
|
|||
|
||||
struct main_out {
|
||||
@builtin(sample_mask)
|
||||
x_1_1 : u32;
|
||||
x_1_1 : u32,
|
||||
}
|
||||
|
||||
@stage(fragment)
|
||||
|
@ -2627,7 +2627,7 @@ fn main_1() {
|
|||
|
||||
struct main_out {
|
||||
@builtin(sample_mask)
|
||||
x_1_1 : u32;
|
||||
x_1_1 : u32,
|
||||
}
|
||||
|
||||
@stage(fragment)
|
||||
|
@ -2685,7 +2685,7 @@ fn main_1() {
|
|||
|
||||
struct main_out {
|
||||
@builtin(position)
|
||||
x_4_1 : vec4<f32>;
|
||||
x_4_1 : vec4<f32>,
|
||||
}
|
||||
|
||||
@stage(vertex)
|
||||
|
@ -2723,7 +2723,7 @@ fn main_1() {
|
|||
|
||||
struct main_out {
|
||||
@builtin(position)
|
||||
x_4_1 : vec4<f32>;
|
||||
x_4_1 : vec4<f32>,
|
||||
}
|
||||
|
||||
@stage(vertex)
|
||||
|
@ -2760,7 +2760,7 @@ fn main_1() {
|
|||
|
||||
struct main_out {
|
||||
@builtin(position)
|
||||
x_4_1 : vec4<f32>;
|
||||
x_4_1 : vec4<f32>,
|
||||
}
|
||||
|
||||
@stage(vertex)
|
||||
|
@ -2796,7 +2796,7 @@ fn main_1() {
|
|||
|
||||
struct main_out {
|
||||
@builtin(position)
|
||||
x_4_1 : vec4<f32>;
|
||||
x_4_1 : vec4<f32>,
|
||||
}
|
||||
|
||||
@stage(vertex)
|
||||
|
@ -2834,7 +2834,7 @@ fn main_1() {
|
|||
|
||||
struct main_out {
|
||||
@builtin(position)
|
||||
x_4_1 : vec4<f32>;
|
||||
x_4_1 : vec4<f32>,
|
||||
}
|
||||
|
||||
@stage(vertex)
|
||||
|
@ -2871,7 +2871,7 @@ fn main_1() {
|
|||
|
||||
struct main_out {
|
||||
@builtin(position)
|
||||
x_4_1 : vec4<f32>;
|
||||
x_4_1 : vec4<f32>,
|
||||
}
|
||||
|
||||
@stage(vertex)
|
||||
|
@ -2956,7 +2956,7 @@ fn main_1() {
|
|||
|
||||
struct main_out {
|
||||
@builtin(position)
|
||||
position_1 : vec4<f32>;
|
||||
position_1 : vec4<f32>,
|
||||
}
|
||||
|
||||
@stage(vertex)
|
||||
|
@ -2994,7 +2994,7 @@ fn main_1() {
|
|||
|
||||
struct main_out {
|
||||
@builtin(position)
|
||||
position_1 : vec4<f32>;
|
||||
position_1 : vec4<f32>,
|
||||
}
|
||||
|
||||
@stage(vertex)
|
||||
|
@ -3031,7 +3031,7 @@ fn main_1() {
|
|||
|
||||
struct main_out {
|
||||
@builtin(position)
|
||||
position_1 : vec4<f32>;
|
||||
position_1 : vec4<f32>,
|
||||
}
|
||||
|
||||
@stage(vertex)
|
||||
|
@ -3091,7 +3091,7 @@ fn main_1() {
|
|||
|
||||
struct main_out {
|
||||
@builtin(position)
|
||||
position_1 : vec4<f32>;
|
||||
position_1 : vec4<f32>,
|
||||
}
|
||||
|
||||
@stage(vertex)
|
||||
|
@ -3129,7 +3129,7 @@ fn main_1() {
|
|||
|
||||
struct main_out {
|
||||
@builtin(position)
|
||||
position_1 : vec4<f32>;
|
||||
position_1 : vec4<f32>,
|
||||
}
|
||||
|
||||
@stage(vertex)
|
||||
|
@ -3166,7 +3166,7 @@ fn main_1() {
|
|||
|
||||
struct main_out {
|
||||
@builtin(position)
|
||||
position_1 : vec4<f32>;
|
||||
position_1 : vec4<f32>,
|
||||
}
|
||||
|
||||
@stage(vertex)
|
||||
|
@ -3728,9 +3728,9 @@ fn main_1() {
|
|||
|
||||
struct main_out {
|
||||
@location(0) @interpolate(flat)
|
||||
x_2_1 : u32;
|
||||
x_2_1 : u32,
|
||||
@location(6) @interpolate(flat)
|
||||
x_4_1 : u32;
|
||||
x_4_1 : u32,
|
||||
}
|
||||
|
||||
@stage(fragment)
|
||||
|
@ -3782,7 +3782,7 @@ fn main_1() {
|
|||
|
||||
struct main_out {
|
||||
@builtin(position)
|
||||
x_4_1 : vec4<f32>;
|
||||
x_4_1 : vec4<f32>,
|
||||
}
|
||||
|
||||
@stage(vertex)
|
||||
|
@ -3832,7 +3832,7 @@ fn main_1() {
|
|||
|
||||
struct main_out {
|
||||
@builtin(position)
|
||||
x_4_1 : vec4<f32>;
|
||||
x_4_1 : vec4<f32>,
|
||||
}
|
||||
|
||||
@stage(vertex)
|
||||
|
@ -3958,7 +3958,7 @@ fn main_1() {
|
|||
|
||||
struct main_out {
|
||||
@builtin(sample_mask)
|
||||
x_1_1 : u32;
|
||||
x_1_1 : u32,
|
||||
}
|
||||
|
||||
@stage(fragment)
|
||||
|
@ -4004,7 +4004,7 @@ fn main_1() {
|
|||
|
||||
struct main_out {
|
||||
@builtin(sample_mask)
|
||||
x_1_1 : u32;
|
||||
x_1_1 : u32,
|
||||
}
|
||||
|
||||
@stage(fragment)
|
||||
|
@ -4048,7 +4048,7 @@ fn main_1() {
|
|||
|
||||
struct main_out {
|
||||
@builtin(frag_depth)
|
||||
x_1_1 : f32;
|
||||
x_1_1 : f32,
|
||||
}
|
||||
|
||||
@stage(fragment)
|
||||
|
@ -4082,7 +4082,7 @@ fn main_1() {
|
|||
|
||||
struct main_out {
|
||||
@builtin(position)
|
||||
gl_Position : vec4<f32>;
|
||||
gl_Position : vec4<f32>,
|
||||
}
|
||||
|
||||
@stage(vertex)
|
||||
|
@ -4152,7 +4152,7 @@ fn main_1() {
|
|||
|
||||
struct main_out {
|
||||
@builtin(position)
|
||||
gl_Position : vec4<f32>;
|
||||
gl_Position : vec4<f32>,
|
||||
}
|
||||
|
||||
@stage(vertex)
|
||||
|
@ -4209,7 +4209,7 @@ fn main_1() {
|
|||
|
||||
struct main_out {
|
||||
@builtin(position)
|
||||
x_2_1 : vec4<f32>;
|
||||
x_2_1 : vec4<f32>,
|
||||
}
|
||||
|
||||
@stage(vertex)
|
||||
|
@ -4267,7 +4267,7 @@ fn main_1() {
|
|||
|
||||
struct main_out {
|
||||
@builtin(position)
|
||||
x_2_1 : vec4<f32>;
|
||||
x_2_1 : vec4<f32>,
|
||||
}
|
||||
|
||||
@stage(vertex)
|
||||
|
@ -4320,8 +4320,8 @@ TEST_F(SpvModuleScopeVarParserTest, Input_FlattenStruct_LocOnVariable) {
|
|||
|
||||
const auto got = test::ToString(p->program());
|
||||
const std::string expected = R"(struct Communicators {
|
||||
alice : f32;
|
||||
bob : vec4<f32>;
|
||||
alice : f32,
|
||||
bob : vec4<f32>,
|
||||
}
|
||||
|
||||
var<private> x_1 : Communicators;
|
||||
|
@ -4334,7 +4334,7 @@ fn main_1() {
|
|||
|
||||
struct main_out {
|
||||
@builtin(position)
|
||||
x_2_1 : vec4<f32>;
|
||||
x_2_1 : vec4<f32>,
|
||||
}
|
||||
|
||||
@stage(vertex)
|
||||
|
@ -4393,7 +4393,7 @@ fn main_1() {
|
|||
|
||||
struct main_out {
|
||||
@builtin(position)
|
||||
x_2_1 : vec4<f32>;
|
||||
x_2_1 : vec4<f32>,
|
||||
}
|
||||
|
||||
@stage(vertex)
|
||||
|
@ -4454,13 +4454,13 @@ fn main_1() {
|
|||
|
||||
struct main_out {
|
||||
@location(4)
|
||||
x_1_1 : f32;
|
||||
x_1_1 : f32,
|
||||
@location(5)
|
||||
x_1_2 : f32;
|
||||
x_1_2 : f32,
|
||||
@location(6)
|
||||
x_1_3 : f32;
|
||||
x_1_3 : f32,
|
||||
@builtin(position)
|
||||
x_2_1 : vec4<f32>;
|
||||
x_2_1 : vec4<f32>,
|
||||
}
|
||||
|
||||
@stage(vertex)
|
||||
|
@ -4515,11 +4515,11 @@ fn main_1() {
|
|||
|
||||
struct main_out {
|
||||
@location(9)
|
||||
x_1_1 : vec4<f32>;
|
||||
x_1_1 : vec4<f32>,
|
||||
@location(10)
|
||||
x_1_2 : vec4<f32>;
|
||||
x_1_2 : vec4<f32>,
|
||||
@builtin(position)
|
||||
x_2_1 : vec4<f32>;
|
||||
x_2_1 : vec4<f32>,
|
||||
}
|
||||
|
||||
@stage(vertex)
|
||||
|
@ -4570,8 +4570,8 @@ TEST_F(SpvModuleScopeVarParserTest, Output_FlattenStruct_LocOnVariable) {
|
|||
|
||||
const auto got = test::ToString(p->program());
|
||||
const std::string expected = R"(struct Communicators {
|
||||
alice : f32;
|
||||
bob : vec4<f32>;
|
||||
alice : f32,
|
||||
bob : vec4<f32>,
|
||||
}
|
||||
|
||||
var<private> x_1 : Communicators;
|
||||
|
@ -4584,11 +4584,11 @@ fn main_1() {
|
|||
|
||||
struct main_out {
|
||||
@location(9)
|
||||
x_1_1 : f32;
|
||||
x_1_1 : f32,
|
||||
@location(10)
|
||||
x_1_2 : vec4<f32>;
|
||||
x_1_2 : vec4<f32>,
|
||||
@builtin(position)
|
||||
x_2_1 : vec4<f32>;
|
||||
x_2_1 : vec4<f32>,
|
||||
}
|
||||
|
||||
@stage(vertex)
|
||||
|
@ -4643,8 +4643,8 @@ TEST_F(SpvModuleScopeVarParserTest, FlattenStruct_LocOnMembers) {
|
|||
|
||||
const auto got = test::ToString(p->program());
|
||||
const std::string expected = R"(struct Communicators {
|
||||
alice : f32;
|
||||
bob : vec4<f32>;
|
||||
alice : f32,
|
||||
bob : vec4<f32>,
|
||||
}
|
||||
|
||||
var<private> x_1 : Communicators;
|
||||
|
@ -4659,11 +4659,11 @@ fn main_1() {
|
|||
|
||||
struct main_out {
|
||||
@builtin(position)
|
||||
x_2_1 : vec4<f32>;
|
||||
x_2_1 : vec4<f32>,
|
||||
@location(9)
|
||||
x_3_1 : f32;
|
||||
x_3_1 : f32,
|
||||
@location(11)
|
||||
x_3_2 : vec4<f32>;
|
||||
x_3_2 : vec4<f32>,
|
||||
}
|
||||
|
||||
@stage(vertex)
|
||||
|
@ -4743,7 +4743,7 @@ fn main_1() {
|
|||
|
||||
struct main_out {
|
||||
@builtin(position)
|
||||
x_10_1 : vec4<f32>;
|
||||
x_10_1 : vec4<f32>,
|
||||
}
|
||||
|
||||
@stage(vertex)
|
||||
|
@ -4827,19 +4827,19 @@ fn main_1() {
|
|||
|
||||
struct main_out {
|
||||
@location(1) @interpolate(flat)
|
||||
x_1_1 : u32;
|
||||
x_1_1 : u32,
|
||||
@location(2) @interpolate(flat)
|
||||
x_2_1 : vec2<u32>;
|
||||
x_2_1 : vec2<u32>,
|
||||
@location(3) @interpolate(flat)
|
||||
x_3_1 : i32;
|
||||
x_3_1 : i32,
|
||||
@location(4) @interpolate(flat)
|
||||
x_4_1 : vec2<i32>;
|
||||
x_4_1 : vec2<i32>,
|
||||
@location(5) @interpolate(flat)
|
||||
x_5_1 : f32;
|
||||
x_5_1 : f32,
|
||||
@location(6) @interpolate(flat)
|
||||
x_6_1 : vec2<f32>;
|
||||
x_6_1 : vec2<f32>,
|
||||
@builtin(position)
|
||||
x_10_1 : vec4<f32>;
|
||||
x_10_1 : vec4<f32>,
|
||||
}
|
||||
|
||||
@stage(vertex)
|
||||
|
@ -4881,8 +4881,8 @@ TEST_F(SpvModuleScopeVarParserTest,
|
|||
const auto got = test::ToString(p->program());
|
||||
const std::string expected =
|
||||
R"(struct S {
|
||||
field0 : f32;
|
||||
field1 : f32;
|
||||
field0 : f32,
|
||||
field1 : f32,
|
||||
}
|
||||
|
||||
var<private> x_1 : array<f32, 2u>;
|
||||
|
@ -5022,12 +5022,12 @@ TEST_F(SpvModuleScopeVarParserTest,
|
|||
const auto got = test::ToString(p->program());
|
||||
const std::string expected =
|
||||
R"(struct S {
|
||||
field0 : f32;
|
||||
field1 : f32;
|
||||
field2 : f32;
|
||||
field3 : f32;
|
||||
field4 : f32;
|
||||
field5 : f32;
|
||||
field0 : f32,
|
||||
field1 : f32,
|
||||
field2 : f32,
|
||||
field3 : f32,
|
||||
field4 : f32,
|
||||
field5 : f32,
|
||||
}
|
||||
|
||||
var<private> x_1 : S;
|
||||
|
@ -5115,17 +5115,17 @@ fn main_1() {
|
|||
|
||||
struct main_out {
|
||||
@location(1)
|
||||
x_1_1 : f32;
|
||||
x_1_1 : f32,
|
||||
@location(2) @interpolate(perspective, centroid)
|
||||
x_2_1 : f32;
|
||||
x_2_1 : f32,
|
||||
@location(3) @interpolate(perspective, sample)
|
||||
x_3_1 : f32;
|
||||
x_3_1 : f32,
|
||||
@location(4) @interpolate(linear)
|
||||
x_4_1 : f32;
|
||||
x_4_1 : f32,
|
||||
@location(5) @interpolate(linear, centroid)
|
||||
x_5_1 : f32;
|
||||
x_5_1 : f32,
|
||||
@location(6) @interpolate(linear, sample)
|
||||
x_6_1 : f32;
|
||||
x_6_1 : f32,
|
||||
}
|
||||
|
||||
@stage(fragment)
|
||||
|
@ -5178,12 +5178,12 @@ TEST_F(SpvModuleScopeVarParserTest,
|
|||
const auto got = test::ToString(p->program());
|
||||
const std::string expected =
|
||||
R"(struct S {
|
||||
field0 : f32;
|
||||
field1 : f32;
|
||||
field2 : f32;
|
||||
field3 : f32;
|
||||
field4 : f32;
|
||||
field5 : f32;
|
||||
field0 : f32,
|
||||
field1 : f32,
|
||||
field2 : f32,
|
||||
field3 : f32,
|
||||
field4 : f32,
|
||||
field5 : f32,
|
||||
}
|
||||
|
||||
var<private> x_1 : S;
|
||||
|
@ -5194,17 +5194,17 @@ fn main_1() {
|
|||
|
||||
struct main_out {
|
||||
@location(1)
|
||||
x_1_1 : f32;
|
||||
x_1_1 : f32,
|
||||
@location(2) @interpolate(perspective, centroid)
|
||||
x_1_2 : f32;
|
||||
x_1_2 : f32,
|
||||
@location(3) @interpolate(perspective, sample)
|
||||
x_1_3 : f32;
|
||||
x_1_3 : f32,
|
||||
@location(4) @interpolate(linear)
|
||||
x_1_4 : f32;
|
||||
x_1_4 : f32,
|
||||
@location(5) @interpolate(linear, centroid)
|
||||
x_1_5 : f32;
|
||||
x_1_5 : f32,
|
||||
@location(6) @interpolate(linear, sample)
|
||||
x_1_6 : f32;
|
||||
x_1_6 : f32,
|
||||
}
|
||||
|
||||
@stage(fragment)
|
||||
|
@ -5279,19 +5279,19 @@ fn main_1() {
|
|||
|
||||
struct main_out {
|
||||
@location(1) @interpolate(flat)
|
||||
x_1_1 : u32;
|
||||
x_1_1 : u32,
|
||||
@location(2) @interpolate(flat)
|
||||
x_2_1 : vec2<u32>;
|
||||
x_2_1 : vec2<u32>,
|
||||
@location(3) @interpolate(flat)
|
||||
x_3_1 : i32;
|
||||
x_3_1 : i32,
|
||||
@location(4) @interpolate(flat)
|
||||
x_4_1 : vec2<i32>;
|
||||
x_4_1 : vec2<i32>,
|
||||
@location(5)
|
||||
x_5_1 : f32;
|
||||
x_5_1 : f32,
|
||||
@location(6)
|
||||
x_6_1 : vec2<f32>;
|
||||
x_6_1 : vec2<f32>,
|
||||
@builtin(position)
|
||||
x_10_1 : vec4<f32>;
|
||||
x_10_1 : vec4<f32>,
|
||||
}
|
||||
|
||||
@stage(vertex)
|
||||
|
|
|
@ -54,13 +54,13 @@ TEST_F(SpvParserTest, NamedTypes_Dup_EmitBoth) {
|
|||
)"));
|
||||
EXPECT_TRUE(p->BuildAndParseInternalModule()) << p->error();
|
||||
EXPECT_THAT(test::ToString(p->program()), HasSubstr(R"(struct S {
|
||||
field0 : u32;
|
||||
field1 : u32;
|
||||
field0 : u32,
|
||||
field1 : u32,
|
||||
}
|
||||
|
||||
struct S_1 {
|
||||
field0 : u32;
|
||||
field1 : u32;
|
||||
field0 : u32,
|
||||
field1 : u32,
|
||||
})"));
|
||||
|
||||
p->DeliberatelyInvalidSpirv();
|
||||
|
|
|
@ -1166,56 +1166,61 @@ Maybe<const ast::Struct*> ParserImpl::struct_decl() {
|
|||
}
|
||||
|
||||
// struct_body_decl
|
||||
// : BRACKET_LEFT struct_member* BRACKET_RIGHT
|
||||
// : BRACE_LEFT (struct_member COMMA)* struct_member COMMA? BRACE_RIGHT
|
||||
Expect<ast::StructMemberList> ParserImpl::expect_struct_body_decl() {
|
||||
return expect_brace_block(
|
||||
"struct declaration", [&]() -> Expect<ast::StructMemberList> {
|
||||
bool errored = false;
|
||||
|
||||
ast::StructMemberList members;
|
||||
bool errored = false;
|
||||
while (continue_parsing()) {
|
||||
// Check for the end of the list.
|
||||
auto t = peek();
|
||||
if (!t.IsIdentifier() && !t.Is(Token::Type::kAttr)) {
|
||||
break;
|
||||
}
|
||||
|
||||
while (continue_parsing() && !peek_is(Token::Type::kBraceRight) &&
|
||||
!peek_is(Token::Type::kEOF)) {
|
||||
auto member = sync(Token::Type::kSemicolon,
|
||||
[&]() -> Expect<ast::StructMember*> {
|
||||
auto attrs = attribute_list();
|
||||
if (attrs.errored) {
|
||||
errored = true;
|
||||
}
|
||||
if (!synchronized_) {
|
||||
return Failure::kErrored;
|
||||
}
|
||||
return expect_struct_member(attrs.value);
|
||||
});
|
||||
|
||||
auto member = expect_struct_member();
|
||||
if (member.errored) {
|
||||
errored = true;
|
||||
if (!sync_to(Token::Type::kComma, /* consume: */ false)) {
|
||||
return Failure::kErrored;
|
||||
}
|
||||
} else {
|
||||
members.push_back(member.value);
|
||||
}
|
||||
|
||||
// TODO(crbug.com/tint/1475): Remove support for semicolons.
|
||||
if (auto sc = peek(); sc.Is(Token::Type::kSemicolon)) {
|
||||
deprecated(sc.source(),
|
||||
"struct members should be separated with commas");
|
||||
next();
|
||||
continue;
|
||||
}
|
||||
if (!match(Token::Type::kComma))
|
||||
break;
|
||||
}
|
||||
|
||||
if (errored)
|
||||
if (errored) {
|
||||
return Failure::kErrored;
|
||||
|
||||
}
|
||||
return members;
|
||||
});
|
||||
}
|
||||
|
||||
// struct_member
|
||||
// : struct_member_attribute_decl+ variable_ident_decl SEMICOLON
|
||||
Expect<ast::StructMember*> ParserImpl::expect_struct_member(
|
||||
ast::AttributeList& attrs) {
|
||||
// : attribute* variable_ident_decl
|
||||
Expect<ast::StructMember*> ParserImpl::expect_struct_member() {
|
||||
auto attrs = attribute_list();
|
||||
if (attrs.errored) {
|
||||
return Failure::kErrored;
|
||||
}
|
||||
|
||||
auto decl = expect_variable_ident_decl("struct member");
|
||||
if (decl.errored)
|
||||
return Failure::kErrored;
|
||||
|
||||
if (!expect("struct member", Token::Type::kSemicolon))
|
||||
return Failure::kErrored;
|
||||
|
||||
return create<ast::StructMember>(decl->source,
|
||||
builder_.Symbols().Register(decl->name),
|
||||
decl->type, std::move(attrs));
|
||||
decl->type, std::move(attrs.value));
|
||||
}
|
||||
|
||||
// function_decl
|
||||
|
|
|
@ -429,12 +429,9 @@ class ParserImpl {
|
|||
/// Parses a `struct_body_decl` grammar element, erroring on parse failure.
|
||||
/// @returns the struct members
|
||||
Expect<ast::StructMemberList> expect_struct_body_decl();
|
||||
/// Parses a `struct_member` grammar element with the initial
|
||||
/// `struct_member_attribute_decl+` provided as `attrs`, erroring on parse
|
||||
/// failure.
|
||||
/// @param attrs the list of attributes for the struct member.
|
||||
/// Parses a `struct_member` grammar element, erroring on parse failure.
|
||||
/// @returns the struct member or nullptr
|
||||
Expect<ast::StructMember*> expect_struct_member(ast::AttributeList& attrs);
|
||||
Expect<ast::StructMember*> expect_struct_member();
|
||||
/// Parses a `function_decl` grammar element with the initial
|
||||
/// `function_attribute_decl*` provided as `attrs`.
|
||||
/// @param attrs the list of attributes for the function declaration.
|
||||
|
|
|
@ -672,59 +672,51 @@ struct S };
|
|||
}
|
||||
|
||||
TEST_F(ParserImplErrorTest, GlobalDeclStructDeclMissingRBrace) {
|
||||
EXPECT("struct S { i : i32;",
|
||||
EXPECT("struct S { i : i32,",
|
||||
R"(test.wgsl:1:20 error: expected '}' for struct declaration
|
||||
struct S { i : i32;
|
||||
struct S { i : i32,
|
||||
^
|
||||
)");
|
||||
}
|
||||
|
||||
TEST_F(ParserImplErrorTest, GlobalDeclStructMemberInvalidIdentifier) {
|
||||
EXPECT("struct S { 1 : i32; };",
|
||||
R"(test.wgsl:1:12 error: expected identifier for struct member
|
||||
struct S { 1 : i32; };
|
||||
EXPECT("struct S { 1 : i32, };",
|
||||
R"(test.wgsl:1:12 error: expected '}' for struct declaration
|
||||
struct S { 1 : i32, };
|
||||
^
|
||||
)");
|
||||
}
|
||||
|
||||
TEST_F(ParserImplErrorTest, GlobalDeclStructMemberMissingSemicolon) {
|
||||
EXPECT("struct S { i : i32 };",
|
||||
R"(test.wgsl:1:20 error: expected ';' for struct member
|
||||
struct S { i : i32 };
|
||||
^
|
||||
)");
|
||||
}
|
||||
|
||||
TEST_F(ParserImplErrorTest, GlobalDeclStructMemberAlignInvaldValue) {
|
||||
EXPECT(
|
||||
"struct S { @align(x) i : i32; };",
|
||||
"struct S { @align(x) i : i32, };",
|
||||
R"(test.wgsl:1:19 error: expected signed integer literal for align attribute
|
||||
struct S { @align(x) i : i32; };
|
||||
struct S { @align(x) i : i32, };
|
||||
^
|
||||
)");
|
||||
}
|
||||
|
||||
TEST_F(ParserImplErrorTest, GlobalDeclStructMemberAlignNegativeValue) {
|
||||
EXPECT("struct S { @align(-2) i : i32; };",
|
||||
EXPECT("struct S { @align(-2) i : i32, };",
|
||||
R"(test.wgsl:1:19 error: align attribute must be positive
|
||||
struct S { @align(-2) i : i32; };
|
||||
struct S { @align(-2) i : i32, };
|
||||
^^
|
||||
)");
|
||||
}
|
||||
|
||||
TEST_F(ParserImplErrorTest, GlobalDeclStructMemberSizeInvaldValue) {
|
||||
EXPECT(
|
||||
"struct S { @size(x) i : i32; };",
|
||||
"struct S { @size(x) i : i32, };",
|
||||
R"(test.wgsl:1:18 error: expected signed integer literal for size attribute
|
||||
struct S { @size(x) i : i32; };
|
||||
struct S { @size(x) i : i32, };
|
||||
^
|
||||
)");
|
||||
}
|
||||
|
||||
TEST_F(ParserImplErrorTest, GlobalDeclStructMemberSizeNegativeValue) {
|
||||
EXPECT("struct S { @size(-2) i : i32; };",
|
||||
EXPECT("struct S { @size(-2) i : i32, };",
|
||||
R"(test.wgsl:1:18 error: size attribute must be positive
|
||||
struct S { @size(-2) i : i32; };
|
||||
struct S { @size(-2) i : i32, };
|
||||
^^
|
||||
)");
|
||||
}
|
||||
|
|
|
@ -110,24 +110,24 @@ test.wgsl:5:11 error: expected ';' for discard statement
|
|||
TEST_F(ParserImplErrorResyncTest, StructMembers) {
|
||||
EXPECT(R"(
|
||||
struct S {
|
||||
blah blah blah;
|
||||
a : i32;
|
||||
blah blah blah;
|
||||
b : i32;
|
||||
@- x : i32;
|
||||
c : i32;
|
||||
blah blah blah,
|
||||
a : i32,
|
||||
blah blah blah,
|
||||
b : i32,
|
||||
@- x : i32,
|
||||
c : i32,
|
||||
}
|
||||
)",
|
||||
R"(test.wgsl:3:10 error: expected ':' for struct member
|
||||
blah blah blah;
|
||||
blah blah blah,
|
||||
^^^^
|
||||
|
||||
test.wgsl:5:10 error: expected ':' for struct member
|
||||
blah blah blah;
|
||||
blah blah blah,
|
||||
^^^^
|
||||
|
||||
test.wgsl:7:6 error: expected attribute
|
||||
@- x : i32;
|
||||
@- x : i32,
|
||||
^
|
||||
)");
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ TEST_F(ParserImplTest, GlobalDecl_TypeAlias) {
|
|||
|
||||
TEST_F(ParserImplTest, GlobalDecl_TypeAlias_StructIdent) {
|
||||
auto p = parser(R"(struct A {
|
||||
a : f32;
|
||||
a : f32,
|
||||
}
|
||||
type B = A;)");
|
||||
p->expect_global_decl();
|
||||
|
@ -150,7 +150,7 @@ TEST_F(ParserImplTest, GlobalDecl_Function_Invalid) {
|
|||
}
|
||||
|
||||
TEST_F(ParserImplTest, GlobalDecl_ParsesStruct) {
|
||||
auto p = parser("struct A { b: i32; c: f32;}");
|
||||
auto p = parser("struct A { b: i32, c: f32}");
|
||||
p->expect_global_decl();
|
||||
ASSERT_FALSE(p->has_error()) << p->error();
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ TEST_F(ParserImplTest, PrimaryExpression_TypeDecl_InvalidValue) {
|
|||
|
||||
TEST_F(ParserImplTest, PrimaryExpression_TypeDecl_StructConstructor_Empty) {
|
||||
auto p = parser(R"(
|
||||
struct S { a : i32; b : f32; }
|
||||
struct S { a : i32, b : f32, }
|
||||
S()
|
||||
)");
|
||||
|
||||
|
@ -139,7 +139,7 @@ TEST_F(ParserImplTest, PrimaryExpression_TypeDecl_StructConstructor_Empty) {
|
|||
|
||||
TEST_F(ParserImplTest, PrimaryExpression_TypeDecl_StructConstructor_NotEmpty) {
|
||||
auto p = parser(R"(
|
||||
struct S { a : i32; b : f32; }
|
||||
struct S { a : i32, b : f32, }
|
||||
S(1u, 2.0)
|
||||
)");
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ TEST_P(ParserImplReservedKeywordTest, Struct) {
|
|||
}
|
||||
TEST_P(ParserImplReservedKeywordTest, StructMember) {
|
||||
auto name = GetParam();
|
||||
auto p = parser("struct S { " + name + " : i32; };");
|
||||
auto p = parser("struct S { " + name + " : i32, };");
|
||||
EXPECT_FALSE(p->Parse());
|
||||
EXPECT_TRUE(p->has_error());
|
||||
EXPECT_EQ(p->error(), "1:12: '" + name + "' is a reserved keyword");
|
||||
|
|
|
@ -20,7 +20,23 @@ namespace wgsl {
|
|||
namespace {
|
||||
|
||||
TEST_F(ParserImplTest, StructBodyDecl_Parses) {
|
||||
auto p = parser("{a : i32;}");
|
||||
auto p = parser("{a : i32}");
|
||||
|
||||
auto& builder = p->builder();
|
||||
|
||||
auto m = p->expect_struct_body_decl();
|
||||
ASSERT_FALSE(p->has_error());
|
||||
ASSERT_FALSE(m.errored);
|
||||
ASSERT_EQ(m.value.size(), 1u);
|
||||
|
||||
const auto* mem = m.value[0];
|
||||
EXPECT_EQ(mem->symbol, builder.Symbols().Get("a"));
|
||||
EXPECT_TRUE(mem->type->Is<ast::I32>());
|
||||
EXPECT_EQ(mem->attributes.size(), 0u);
|
||||
}
|
||||
|
||||
TEST_F(ParserImplTest, StructBodyDecl_Parses_TrailingComma) {
|
||||
auto p = parser("{a : i32,}");
|
||||
|
||||
auto& builder = p->builder();
|
||||
|
||||
|
@ -46,7 +62,7 @@ TEST_F(ParserImplTest, StructBodyDecl_ParsesEmpty) {
|
|||
TEST_F(ParserImplTest, StructBodyDecl_InvalidAlign) {
|
||||
auto p = parser(R"(
|
||||
{
|
||||
@align(nan) a : i32;
|
||||
@align(nan) a : i32,
|
||||
})");
|
||||
auto m = p->expect_struct_body_decl();
|
||||
ASSERT_TRUE(p->has_error());
|
||||
|
@ -58,7 +74,7 @@ TEST_F(ParserImplTest, StructBodyDecl_InvalidAlign) {
|
|||
TEST_F(ParserImplTest, StructBodyDecl_InvalidSize) {
|
||||
auto p = parser(R"(
|
||||
{
|
||||
@size(nan) a : i32;
|
||||
@size(nan) a : i32,
|
||||
})");
|
||||
auto m = p->expect_struct_body_decl();
|
||||
ASSERT_TRUE(p->has_error());
|
||||
|
@ -68,7 +84,7 @@ TEST_F(ParserImplTest, StructBodyDecl_InvalidSize) {
|
|||
}
|
||||
|
||||
TEST_F(ParserImplTest, StructBodyDecl_MissingClosingBracket) {
|
||||
auto p = parser("{a : i32;");
|
||||
auto p = parser("{a : i32,");
|
||||
auto m = p->expect_struct_body_decl();
|
||||
ASSERT_TRUE(p->has_error());
|
||||
ASSERT_TRUE(m.errored);
|
||||
|
@ -78,13 +94,13 @@ TEST_F(ParserImplTest, StructBodyDecl_MissingClosingBracket) {
|
|||
TEST_F(ParserImplTest, StructBodyDecl_InvalidToken) {
|
||||
auto p = parser(R"(
|
||||
{
|
||||
a : i32;
|
||||
a : i32,
|
||||
1.23
|
||||
} )");
|
||||
auto m = p->expect_struct_body_decl();
|
||||
ASSERT_TRUE(p->has_error());
|
||||
ASSERT_TRUE(m.errored);
|
||||
EXPECT_EQ(p->error(), "4:3: expected identifier for struct member");
|
||||
EXPECT_EQ(p->error(), "4:3: expected '}' for struct declaration");
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -23,8 +23,8 @@ namespace {
|
|||
TEST_F(ParserImplTest, StructDecl_Parses) {
|
||||
auto p = parser(R"(
|
||||
struct S {
|
||||
a : i32;
|
||||
b : f32;
|
||||
a : i32,
|
||||
b : f32,
|
||||
})");
|
||||
auto s = p->struct_decl();
|
||||
EXPECT_FALSE(p->has_error());
|
||||
|
@ -51,8 +51,8 @@ TEST_F(ParserImplTest, StructDecl_Unicode_Parses) {
|
|||
|
||||
std::string src = R"(
|
||||
struct $struct {
|
||||
$member_a : i32;
|
||||
$member_b : f32;
|
||||
$member_a : i32,
|
||||
$member_b : f32,
|
||||
})";
|
||||
src = utils::ReplaceAll(src, "$struct", struct_ident);
|
||||
src = utils::ReplaceAll(src, "$member_a", member_a_ident);
|
||||
|
@ -108,6 +108,24 @@ TEST_F(ParserImplTest, StructDecl_MissingBracketLeft) {
|
|||
EXPECT_EQ(p->error(), "1:10: expected '{' for struct declaration");
|
||||
}
|
||||
|
||||
// TODO(crbug.com/tint/1475): Remove this.
|
||||
TEST_F(ParserImplTest, DEPRECATED_StructDecl_Parses_WithSemicolons) {
|
||||
auto p = parser(R"(
|
||||
struct S {
|
||||
a : i32;
|
||||
b : f32;
|
||||
})");
|
||||
auto s = p->struct_decl();
|
||||
EXPECT_FALSE(p->has_error());
|
||||
EXPECT_FALSE(s.errored);
|
||||
EXPECT_TRUE(s.matched);
|
||||
ASSERT_NE(s.value, nullptr);
|
||||
ASSERT_EQ(s->name, p->builder().Symbols().Register("S"));
|
||||
ASSERT_EQ(s->members.size(), 2u);
|
||||
EXPECT_EQ(s->members[0]->symbol, p->builder().Symbols().Register("a"));
|
||||
EXPECT_EQ(s->members[1]->symbol, p->builder().Symbols().Register("b"));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace wgsl
|
||||
} // namespace reader
|
||||
|
|
|
@ -20,16 +20,11 @@ namespace wgsl {
|
|||
namespace {
|
||||
|
||||
TEST_F(ParserImplTest, StructMember_Parses) {
|
||||
auto p = parser("a : i32;");
|
||||
auto p = parser("a : i32,");
|
||||
|
||||
auto& builder = p->builder();
|
||||
|
||||
auto attrs = p->attribute_list();
|
||||
EXPECT_FALSE(attrs.errored);
|
||||
EXPECT_FALSE(attrs.matched);
|
||||
EXPECT_EQ(attrs.value.size(), 0u);
|
||||
|
||||
auto m = p->expect_struct_member(attrs.value);
|
||||
auto m = p->expect_struct_member();
|
||||
ASSERT_FALSE(p->has_error());
|
||||
ASSERT_FALSE(m.errored);
|
||||
ASSERT_NE(m.value, nullptr);
|
||||
|
@ -43,16 +38,11 @@ TEST_F(ParserImplTest, StructMember_Parses) {
|
|||
}
|
||||
|
||||
TEST_F(ParserImplTest, StructMember_ParsesWithAlignAttribute) {
|
||||
auto p = parser("@align(2) a : i32;");
|
||||
auto p = parser("@align(2) a : i32,");
|
||||
|
||||
auto& builder = p->builder();
|
||||
|
||||
auto attrs = p->attribute_list();
|
||||
EXPECT_FALSE(attrs.errored);
|
||||
EXPECT_TRUE(attrs.matched);
|
||||
EXPECT_EQ(attrs.value.size(), 1u);
|
||||
|
||||
auto m = p->expect_struct_member(attrs.value);
|
||||
auto m = p->expect_struct_member();
|
||||
ASSERT_FALSE(p->has_error());
|
||||
ASSERT_FALSE(m.errored);
|
||||
ASSERT_NE(m.value, nullptr);
|
||||
|
@ -68,41 +58,11 @@ TEST_F(ParserImplTest, StructMember_ParsesWithAlignAttribute) {
|
|||
}
|
||||
|
||||
TEST_F(ParserImplTest, StructMember_ParsesWithSizeAttribute) {
|
||||
auto p = parser("@size(2) a : i32;");
|
||||
auto p = parser("@size(2) a : i32,");
|
||||
|
||||
auto& builder = p->builder();
|
||||
|
||||
auto attrs = p->attribute_list();
|
||||
EXPECT_FALSE(attrs.errored);
|
||||
EXPECT_TRUE(attrs.matched);
|
||||
EXPECT_EQ(attrs.value.size(), 1u);
|
||||
|
||||
auto m = p->expect_struct_member(attrs.value);
|
||||
ASSERT_FALSE(p->has_error());
|
||||
ASSERT_FALSE(m.errored);
|
||||
ASSERT_NE(m.value, nullptr);
|
||||
|
||||
EXPECT_EQ(m->symbol, builder.Symbols().Get("a"));
|
||||
EXPECT_TRUE(m->type->Is<ast::I32>());
|
||||
EXPECT_EQ(m->attributes.size(), 1u);
|
||||
EXPECT_TRUE(m->attributes[0]->Is<ast::StructMemberSizeAttribute>());
|
||||
EXPECT_EQ(m->attributes[0]->As<ast::StructMemberSizeAttribute>()->size, 2u);
|
||||
|
||||
EXPECT_EQ(m->source.range, (Source::Range{{1u, 10u}, {1u, 11u}}));
|
||||
EXPECT_EQ(m->type->source.range, (Source::Range{{1u, 14u}, {1u, 17u}}));
|
||||
}
|
||||
|
||||
TEST_F(ParserImplTest, StructMember_ParsesWithAttribute) {
|
||||
auto p = parser("@size(2) a : i32;");
|
||||
|
||||
auto& builder = p->builder();
|
||||
|
||||
auto attrs = p->attribute_list();
|
||||
EXPECT_FALSE(attrs.errored);
|
||||
EXPECT_TRUE(attrs.matched);
|
||||
EXPECT_EQ(attrs.value.size(), 1u);
|
||||
|
||||
auto m = p->expect_struct_member(attrs.value);
|
||||
auto m = p->expect_struct_member();
|
||||
ASSERT_FALSE(p->has_error());
|
||||
ASSERT_FALSE(m.errored);
|
||||
ASSERT_NE(m.value, nullptr);
|
||||
|
@ -119,16 +79,11 @@ TEST_F(ParserImplTest, StructMember_ParsesWithAttribute) {
|
|||
|
||||
TEST_F(ParserImplTest, StructMember_ParsesWithMultipleattributes) {
|
||||
auto p = parser(R"(@size(2)
|
||||
@align(4) a : i32;)");
|
||||
@align(4) a : i32,)");
|
||||
|
||||
auto& builder = p->builder();
|
||||
|
||||
auto attrs = p->attribute_list();
|
||||
EXPECT_FALSE(attrs.errored);
|
||||
EXPECT_TRUE(attrs.matched);
|
||||
EXPECT_EQ(attrs.value.size(), 2u);
|
||||
|
||||
auto m = p->expect_struct_member(attrs.value);
|
||||
auto m = p->expect_struct_member();
|
||||
ASSERT_FALSE(p->has_error());
|
||||
ASSERT_FALSE(m.errored);
|
||||
ASSERT_NE(m.value, nullptr);
|
||||
|
@ -146,33 +101,17 @@ TEST_F(ParserImplTest, StructMember_ParsesWithMultipleattributes) {
|
|||
}
|
||||
|
||||
TEST_F(ParserImplTest, StructMember_InvalidAttribute) {
|
||||
auto p = parser("@size(nan) a : i32;");
|
||||
auto attrs = p->attribute_list();
|
||||
EXPECT_TRUE(attrs.errored);
|
||||
EXPECT_FALSE(attrs.matched);
|
||||
auto p = parser("@size(nan) a : i32,");
|
||||
|
||||
auto m = p->expect_struct_member(attrs.value);
|
||||
ASSERT_FALSE(m.errored);
|
||||
ASSERT_NE(m.value, nullptr);
|
||||
auto m = p->expect_struct_member();
|
||||
ASSERT_TRUE(m.errored);
|
||||
ASSERT_EQ(m.value, nullptr);
|
||||
|
||||
ASSERT_TRUE(p->has_error());
|
||||
EXPECT_EQ(p->error(),
|
||||
"1:7: expected signed integer literal for size attribute");
|
||||
}
|
||||
|
||||
TEST_F(ParserImplTest, StructMember_MissingSemicolon) {
|
||||
auto p = parser("a : i32");
|
||||
auto attrs = p->attribute_list();
|
||||
EXPECT_FALSE(attrs.errored);
|
||||
EXPECT_FALSE(attrs.matched);
|
||||
|
||||
auto m = p->expect_struct_member(attrs.value);
|
||||
ASSERT_TRUE(p->has_error());
|
||||
ASSERT_TRUE(m.errored);
|
||||
ASSERT_EQ(m.value, nullptr);
|
||||
EXPECT_EQ(p->error(), "1:8: expected ';' for struct member");
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace wgsl
|
||||
} // namespace reader
|
||||
|
|
|
@ -41,7 +41,7 @@ TEST_F(ParserImplTest, Parses_ExtraSemicolons) {
|
|||
auto p = parser(R"(
|
||||
;
|
||||
struct S {
|
||||
a : f32;
|
||||
a : f32,
|
||||
};;
|
||||
;
|
||||
fn foo() -> S {
|
||||
|
|
|
@ -37,7 +37,7 @@ TEST_F(AddSpirvBlockAttributeTest, EmptyModule) {
|
|||
TEST_F(AddSpirvBlockAttributeTest, Noop_UsedForPrivateVar) {
|
||||
auto* src = R"(
|
||||
struct S {
|
||||
f : f32;
|
||||
f : f32,
|
||||
}
|
||||
|
||||
var<private> p : S;
|
||||
|
@ -58,7 +58,7 @@ TEST_F(AddSpirvBlockAttributeTest, Noop_UsedForShaderIO) {
|
|||
auto* src = R"(
|
||||
struct S {
|
||||
@location(0)
|
||||
f : f32;
|
||||
f : f32,
|
||||
}
|
||||
|
||||
@stage(fragment)
|
||||
|
@ -86,7 +86,7 @@ fn main() {
|
|||
auto* expect = R"(
|
||||
@internal(spirv_block)
|
||||
struct u_block {
|
||||
inner : f32;
|
||||
inner : f32,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<uniform> u : u_block;
|
||||
|
@ -115,7 +115,7 @@ fn main() {
|
|||
auto* expect = R"(
|
||||
@internal(spirv_block)
|
||||
struct u_block {
|
||||
inner : array<vec4<f32>, 4u>;
|
||||
inner : array<vec4<f32>, 4u>,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<uniform> u : u_block;
|
||||
|
@ -148,7 +148,7 @@ type Numbers = array<vec4<f32>, 4u>;
|
|||
|
||||
@internal(spirv_block)
|
||||
struct u_block {
|
||||
inner : array<vec4<f32>, 4u>;
|
||||
inner : array<vec4<f32>, 4u>,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<uniform> u : u_block;
|
||||
|
@ -167,7 +167,7 @@ fn main() {
|
|||
TEST_F(AddSpirvBlockAttributeTest, BasicStruct) {
|
||||
auto* src = R"(
|
||||
struct S {
|
||||
f : f32;
|
||||
f : f32,
|
||||
};
|
||||
|
||||
@group(0) @binding(0)
|
||||
|
@ -181,7 +181,7 @@ fn main() {
|
|||
auto* expect = R"(
|
||||
@internal(spirv_block)
|
||||
struct S {
|
||||
f : f32;
|
||||
f : f32,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<uniform> u : S;
|
||||
|
@ -200,11 +200,11 @@ fn main() {
|
|||
TEST_F(AddSpirvBlockAttributeTest, Nested_OuterBuffer_InnerNotBuffer) {
|
||||
auto* src = R"(
|
||||
struct Inner {
|
||||
f : f32;
|
||||
f : f32,
|
||||
};
|
||||
|
||||
struct Outer {
|
||||
i : Inner;
|
||||
i : Inner,
|
||||
};
|
||||
|
||||
@group(0) @binding(0)
|
||||
|
@ -217,12 +217,12 @@ fn main() {
|
|||
)";
|
||||
auto* expect = R"(
|
||||
struct Inner {
|
||||
f : f32;
|
||||
f : f32,
|
||||
}
|
||||
|
||||
@internal(spirv_block)
|
||||
struct Outer {
|
||||
i : Inner;
|
||||
i : Inner,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<uniform> u : Outer;
|
||||
|
@ -241,11 +241,11 @@ fn main() {
|
|||
TEST_F(AddSpirvBlockAttributeTest, Nested_OuterBuffer_InnerBuffer) {
|
||||
auto* src = R"(
|
||||
struct Inner {
|
||||
f : f32;
|
||||
f : f32,
|
||||
};
|
||||
|
||||
struct Outer {
|
||||
i : Inner;
|
||||
i : Inner,
|
||||
};
|
||||
|
||||
@group(0) @binding(0)
|
||||
|
@ -262,19 +262,19 @@ fn main() {
|
|||
)";
|
||||
auto* expect = R"(
|
||||
struct Inner {
|
||||
f : f32;
|
||||
f : f32,
|
||||
}
|
||||
|
||||
@internal(spirv_block)
|
||||
struct Outer {
|
||||
i : Inner;
|
||||
i : Inner,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<uniform> u0 : Outer;
|
||||
|
||||
@internal(spirv_block)
|
||||
struct u1_block {
|
||||
inner : Inner;
|
||||
inner : Inner,
|
||||
}
|
||||
|
||||
@group(0) @binding(1) var<uniform> u1 : u1_block;
|
||||
|
@ -294,11 +294,11 @@ fn main() {
|
|||
TEST_F(AddSpirvBlockAttributeTest, Nested_OuterNotBuffer_InnerBuffer) {
|
||||
auto* src = R"(
|
||||
struct Inner {
|
||||
f : f32;
|
||||
f : f32,
|
||||
};
|
||||
|
||||
struct Outer {
|
||||
i : Inner;
|
||||
i : Inner,
|
||||
};
|
||||
|
||||
var<private> p : Outer;
|
||||
|
@ -314,18 +314,18 @@ fn main() {
|
|||
)";
|
||||
auto* expect = R"(
|
||||
struct Inner {
|
||||
f : f32;
|
||||
f : f32,
|
||||
}
|
||||
|
||||
struct Outer {
|
||||
i : Inner;
|
||||
i : Inner,
|
||||
}
|
||||
|
||||
var<private> p : Outer;
|
||||
|
||||
@internal(spirv_block)
|
||||
struct u_block {
|
||||
inner : Inner;
|
||||
inner : Inner,
|
||||
}
|
||||
|
||||
@group(0) @binding(1) var<uniform> u : u_block;
|
||||
|
@ -345,11 +345,11 @@ fn main() {
|
|||
TEST_F(AddSpirvBlockAttributeTest, Nested_InnerUsedForMultipleBuffers) {
|
||||
auto* src = R"(
|
||||
struct Inner {
|
||||
f : f32;
|
||||
f : f32,
|
||||
};
|
||||
|
||||
struct S {
|
||||
i : Inner;
|
||||
i : Inner,
|
||||
};
|
||||
|
||||
@group(0) @binding(0)
|
||||
|
@ -370,19 +370,19 @@ fn main() {
|
|||
)";
|
||||
auto* expect = R"(
|
||||
struct Inner {
|
||||
f : f32;
|
||||
f : f32,
|
||||
}
|
||||
|
||||
@internal(spirv_block)
|
||||
struct S {
|
||||
i : Inner;
|
||||
i : Inner,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<uniform> u0 : S;
|
||||
|
||||
@internal(spirv_block)
|
||||
struct u1_block {
|
||||
inner : Inner;
|
||||
inner : Inner,
|
||||
}
|
||||
|
||||
@group(0) @binding(1) var<uniform> u1 : u1_block;
|
||||
|
@ -405,7 +405,7 @@ fn main() {
|
|||
TEST_F(AddSpirvBlockAttributeTest, StructInArray) {
|
||||
auto* src = R"(
|
||||
struct S {
|
||||
f : f32;
|
||||
f : f32,
|
||||
};
|
||||
|
||||
@group(0) @binding(0)
|
||||
|
@ -419,12 +419,12 @@ fn main() {
|
|||
)";
|
||||
auto* expect = R"(
|
||||
struct S {
|
||||
f : f32;
|
||||
f : f32,
|
||||
}
|
||||
|
||||
@internal(spirv_block)
|
||||
struct u_block {
|
||||
inner : S;
|
||||
inner : S,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<uniform> u : u_block;
|
||||
|
@ -444,7 +444,7 @@ fn main() {
|
|||
TEST_F(AddSpirvBlockAttributeTest, StructInArray_MultipleBuffers) {
|
||||
auto* src = R"(
|
||||
struct S {
|
||||
f : f32;
|
||||
f : f32,
|
||||
};
|
||||
|
||||
@group(0) @binding(0)
|
||||
|
@ -462,12 +462,12 @@ fn main() {
|
|||
)";
|
||||
auto* expect = R"(
|
||||
struct S {
|
||||
f : f32;
|
||||
f : f32,
|
||||
}
|
||||
|
||||
@internal(spirv_block)
|
||||
struct u0_block {
|
||||
inner : S;
|
||||
inner : S,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<uniform> u0 : u0_block;
|
||||
|
@ -490,13 +490,13 @@ fn main() {
|
|||
TEST_F(AddSpirvBlockAttributeTest, Aliases_Nested_OuterBuffer_InnerBuffer) {
|
||||
auto* src = R"(
|
||||
struct Inner {
|
||||
f : f32;
|
||||
f : f32,
|
||||
};
|
||||
|
||||
type MyInner = Inner;
|
||||
|
||||
struct Outer {
|
||||
i : MyInner;
|
||||
i : MyInner,
|
||||
};
|
||||
|
||||
type MyOuter = Outer;
|
||||
|
@ -515,14 +515,14 @@ fn main() {
|
|||
)";
|
||||
auto* expect = R"(
|
||||
struct Inner {
|
||||
f : f32;
|
||||
f : f32,
|
||||
}
|
||||
|
||||
type MyInner = Inner;
|
||||
|
||||
@internal(spirv_block)
|
||||
struct Outer {
|
||||
i : MyInner;
|
||||
i : MyInner,
|
||||
}
|
||||
|
||||
type MyOuter = Outer;
|
||||
|
@ -531,7 +531,7 @@ type MyOuter = Outer;
|
|||
|
||||
@internal(spirv_block)
|
||||
struct u1_block {
|
||||
inner : Inner;
|
||||
inner : Inner,
|
||||
}
|
||||
|
||||
@group(0) @binding(1) var<uniform> u1 : u1_block;
|
||||
|
@ -568,11 +568,11 @@ var<uniform> u0 : MyOuter;
|
|||
type MyOuter = Outer;
|
||||
|
||||
struct Outer {
|
||||
i : MyInner;
|
||||
i : MyInner,
|
||||
};
|
||||
|
||||
struct Inner {
|
||||
f : f32;
|
||||
f : f32,
|
||||
};
|
||||
)";
|
||||
auto* expect = R"(
|
||||
|
@ -584,7 +584,7 @@ fn main() {
|
|||
|
||||
@internal(spirv_block)
|
||||
struct u1_block {
|
||||
inner : Inner;
|
||||
inner : Inner,
|
||||
}
|
||||
|
||||
@group(0) @binding(1) var<uniform> u1 : u1_block;
|
||||
|
@ -597,11 +597,11 @@ type MyOuter = Outer;
|
|||
|
||||
@internal(spirv_block)
|
||||
struct Outer {
|
||||
i : MyInner;
|
||||
i : MyInner,
|
||||
}
|
||||
|
||||
struct Inner {
|
||||
f : f32;
|
||||
f : f32,
|
||||
}
|
||||
)";
|
||||
|
||||
|
|
|
@ -35,8 +35,8 @@ TEST_F(ArrayLengthFromUniformTest, ShouldRunEmptyModule) {
|
|||
TEST_F(ArrayLengthFromUniformTest, ShouldRunNoArrayLength) {
|
||||
auto* src = R"(
|
||||
struct SB {
|
||||
x : i32;
|
||||
arr : array<i32>;
|
||||
x : i32,
|
||||
arr : array<i32>,
|
||||
};
|
||||
|
||||
@group(0) @binding(0) var<storage, read> sb : SB;
|
||||
|
@ -52,8 +52,8 @@ fn main() {
|
|||
TEST_F(ArrayLengthFromUniformTest, ShouldRunWithArrayLength) {
|
||||
auto* src = R"(
|
||||
struct SB {
|
||||
x : i32;
|
||||
arr : array<i32>;
|
||||
x : i32,
|
||||
arr : array<i32>,
|
||||
};
|
||||
|
||||
@group(0) @binding(0) var<storage, read> sb : SB;
|
||||
|
@ -70,8 +70,8 @@ fn main() {
|
|||
TEST_F(ArrayLengthFromUniformTest, Error_MissingTransformData) {
|
||||
auto* src = R"(
|
||||
struct SB {
|
||||
x : i32;
|
||||
arr : array<i32>;
|
||||
x : i32,
|
||||
arr : array<i32>,
|
||||
};
|
||||
|
||||
@group(0) @binding(0) var<storage, read> sb : SB;
|
||||
|
@ -103,7 +103,7 @@ fn main() {
|
|||
|
||||
auto* expect = R"(
|
||||
struct tint_symbol {
|
||||
buffer_size : array<vec4<u32>, 1u>;
|
||||
buffer_size : array<vec4<u32>, 1u>,
|
||||
}
|
||||
|
||||
@group(0) @binding(30) var<uniform> tint_symbol_1 : tint_symbol;
|
||||
|
@ -132,8 +132,8 @@ fn main() {
|
|||
TEST_F(ArrayLengthFromUniformTest, BasicInStruct) {
|
||||
auto* src = R"(
|
||||
struct SB {
|
||||
x : i32;
|
||||
arr : array<i32>;
|
||||
x : i32,
|
||||
arr : array<i32>,
|
||||
};
|
||||
|
||||
@group(0) @binding(0) var<storage, read> sb : SB;
|
||||
|
@ -146,14 +146,14 @@ fn main() {
|
|||
|
||||
auto* expect = R"(
|
||||
struct tint_symbol {
|
||||
buffer_size : array<vec4<u32>, 1u>;
|
||||
buffer_size : array<vec4<u32>, 1u>,
|
||||
}
|
||||
|
||||
@group(0) @binding(30) var<uniform> tint_symbol_1 : tint_symbol;
|
||||
|
||||
struct SB {
|
||||
x : i32;
|
||||
arr : array<i32>;
|
||||
x : i32,
|
||||
arr : array<i32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage, read> sb : SB;
|
||||
|
@ -180,16 +180,16 @@ fn main() {
|
|||
TEST_F(ArrayLengthFromUniformTest, MultipleStorageBuffers) {
|
||||
auto* src = R"(
|
||||
struct SB1 {
|
||||
x : i32;
|
||||
arr1 : array<i32>;
|
||||
x : i32,
|
||||
arr1 : array<i32>,
|
||||
};
|
||||
struct SB2 {
|
||||
x : i32;
|
||||
arr2 : array<vec4<f32>>;
|
||||
x : i32,
|
||||
arr2 : array<vec4<f32>>,
|
||||
};
|
||||
struct SB4 {
|
||||
x : i32;
|
||||
arr4 : array<vec4<f32>>;
|
||||
x : i32,
|
||||
arr4 : array<vec4<f32>>,
|
||||
};
|
||||
|
||||
@group(0) @binding(2) var<storage, read> sb1 : SB1;
|
||||
|
@ -211,24 +211,24 @@ fn main() {
|
|||
|
||||
auto* expect = R"(
|
||||
struct tint_symbol {
|
||||
buffer_size : array<vec4<u32>, 2u>;
|
||||
buffer_size : array<vec4<u32>, 2u>,
|
||||
}
|
||||
|
||||
@group(0) @binding(30) var<uniform> tint_symbol_1 : tint_symbol;
|
||||
|
||||
struct SB1 {
|
||||
x : i32;
|
||||
arr1 : array<i32>;
|
||||
x : i32,
|
||||
arr1 : array<i32>,
|
||||
}
|
||||
|
||||
struct SB2 {
|
||||
x : i32;
|
||||
arr2 : array<vec4<f32>>;
|
||||
x : i32,
|
||||
arr2 : array<vec4<f32>>,
|
||||
}
|
||||
|
||||
struct SB4 {
|
||||
x : i32;
|
||||
arr4 : array<vec4<f32>>;
|
||||
x : i32,
|
||||
arr4 : array<vec4<f32>>,
|
||||
}
|
||||
|
||||
@group(0) @binding(2) var<storage, read> sb1 : SB1;
|
||||
|
@ -272,16 +272,16 @@ fn main() {
|
|||
TEST_F(ArrayLengthFromUniformTest, MultipleUnusedStorageBuffers) {
|
||||
auto* src = R"(
|
||||
struct SB1 {
|
||||
x : i32;
|
||||
arr1 : array<i32>;
|
||||
x : i32,
|
||||
arr1 : array<i32>,
|
||||
};
|
||||
struct SB2 {
|
||||
x : i32;
|
||||
arr2 : array<vec4<f32>>;
|
||||
x : i32,
|
||||
arr2 : array<vec4<f32>>,
|
||||
};
|
||||
struct SB4 {
|
||||
x : i32;
|
||||
arr4 : array<vec4<f32>>;
|
||||
x : i32,
|
||||
arr4 : array<vec4<f32>>,
|
||||
};
|
||||
|
||||
@group(0) @binding(2) var<storage, read> sb1 : SB1;
|
||||
|
@ -300,24 +300,24 @@ fn main() {
|
|||
|
||||
auto* expect = R"(
|
||||
struct tint_symbol {
|
||||
buffer_size : array<vec4<u32>, 1u>;
|
||||
buffer_size : array<vec4<u32>, 1u>,
|
||||
}
|
||||
|
||||
@group(0) @binding(30) var<uniform> tint_symbol_1 : tint_symbol;
|
||||
|
||||
struct SB1 {
|
||||
x : i32;
|
||||
arr1 : array<i32>;
|
||||
x : i32,
|
||||
arr1 : array<i32>,
|
||||
}
|
||||
|
||||
struct SB2 {
|
||||
x : i32;
|
||||
arr2 : array<vec4<f32>>;
|
||||
x : i32,
|
||||
arr2 : array<vec4<f32>>,
|
||||
}
|
||||
|
||||
struct SB4 {
|
||||
x : i32;
|
||||
arr4 : array<vec4<f32>>;
|
||||
x : i32,
|
||||
arr4 : array<vec4<f32>>,
|
||||
}
|
||||
|
||||
@group(0) @binding(2) var<storage, read> sb1 : SB1;
|
||||
|
@ -358,8 +358,8 @@ fn main() {
|
|||
TEST_F(ArrayLengthFromUniformTest, NoArrayLengthCalls) {
|
||||
auto* src = R"(
|
||||
struct SB {
|
||||
x : i32;
|
||||
arr : array<i32>;
|
||||
x : i32,
|
||||
arr : array<i32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage, read> sb : SB;
|
||||
|
@ -385,13 +385,13 @@ fn main() {
|
|||
TEST_F(ArrayLengthFromUniformTest, MissingBindingPointToIndexMapping) {
|
||||
auto* src = R"(
|
||||
struct SB1 {
|
||||
x : i32;
|
||||
arr1 : array<i32>;
|
||||
x : i32,
|
||||
arr1 : array<i32>,
|
||||
};
|
||||
|
||||
struct SB2 {
|
||||
x : i32;
|
||||
arr2 : array<vec4<f32>>;
|
||||
x : i32,
|
||||
arr2 : array<vec4<f32>>,
|
||||
};
|
||||
|
||||
@group(0) @binding(2) var<storage, read> sb1 : SB1;
|
||||
|
@ -408,19 +408,19 @@ fn main() {
|
|||
|
||||
auto* expect = R"(
|
||||
struct tint_symbol {
|
||||
buffer_size : array<vec4<u32>, 1u>;
|
||||
buffer_size : array<vec4<u32>, 1u>,
|
||||
}
|
||||
|
||||
@group(0) @binding(30) var<uniform> tint_symbol_1 : tint_symbol;
|
||||
|
||||
struct SB1 {
|
||||
x : i32;
|
||||
arr1 : array<i32>;
|
||||
x : i32,
|
||||
arr1 : array<i32>,
|
||||
}
|
||||
|
||||
struct SB2 {
|
||||
x : i32;
|
||||
arr2 : array<vec4<f32>>;
|
||||
x : i32,
|
||||
arr2 : array<vec4<f32>>,
|
||||
}
|
||||
|
||||
@group(0) @binding(2) var<storage, read> sb1 : SB1;
|
||||
|
@ -458,14 +458,14 @@ fn main() {
|
|||
@group(0) @binding(0) var<storage, read> sb : SB;
|
||||
|
||||
struct SB {
|
||||
x : i32;
|
||||
arr : array<i32>;
|
||||
x : i32,
|
||||
arr : array<i32>,
|
||||
};
|
||||
)";
|
||||
|
||||
auto* expect = R"(
|
||||
struct tint_symbol {
|
||||
buffer_size : array<vec4<u32>, 1u>;
|
||||
buffer_size : array<vec4<u32>, 1u>,
|
||||
}
|
||||
|
||||
@group(0) @binding(30) var<uniform> tint_symbol_1 : tint_symbol;
|
||||
|
@ -478,8 +478,8 @@ fn main() {
|
|||
@group(0) @binding(0) var<storage, read> sb : SB;
|
||||
|
||||
struct SB {
|
||||
x : i32;
|
||||
arr : array<i32>;
|
||||
x : i32,
|
||||
arr : array<i32>,
|
||||
}
|
||||
)";
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ TEST_F(BindingRemapperTest, ShouldRunAccessControlRemappings) {
|
|||
TEST_F(BindingRemapperTest, NoRemappings) {
|
||||
auto* src = R"(
|
||||
struct S {
|
||||
a : f32;
|
||||
a : f32,
|
||||
}
|
||||
|
||||
@group(2) @binding(1) var<storage, read> a : S;
|
||||
|
@ -93,7 +93,7 @@ fn f() {
|
|||
TEST_F(BindingRemapperTest, RemapBindingPoints) {
|
||||
auto* src = R"(
|
||||
struct S {
|
||||
a : f32;
|
||||
a : f32,
|
||||
};
|
||||
|
||||
@group(2) @binding(1) var<storage, read> a : S;
|
||||
|
@ -107,7 +107,7 @@ fn f() {
|
|||
|
||||
auto* expect = R"(
|
||||
struct S {
|
||||
a : f32;
|
||||
a : f32,
|
||||
}
|
||||
|
||||
@group(1) @binding(2) var<storage, read> a : S;
|
||||
|
@ -135,7 +135,7 @@ fn f() {
|
|||
TEST_F(BindingRemapperTest, RemapAccessControls) {
|
||||
auto* src = R"(
|
||||
struct S {
|
||||
a : f32;
|
||||
a : f32,
|
||||
};
|
||||
|
||||
@group(2) @binding(1) var<storage, read> a : S;
|
||||
|
@ -151,7 +151,7 @@ fn f() {
|
|||
|
||||
auto* expect = R"(
|
||||
struct S {
|
||||
a : f32;
|
||||
a : f32,
|
||||
}
|
||||
|
||||
@group(2) @binding(1) var<storage, write> a : S;
|
||||
|
@ -181,7 +181,7 @@ fn f() {
|
|||
TEST_F(BindingRemapperTest, RemapAll) {
|
||||
auto* src = R"(
|
||||
struct S {
|
||||
a : f32;
|
||||
a : f32,
|
||||
};
|
||||
|
||||
@group(2) @binding(1) var<storage, read> a : S;
|
||||
|
@ -195,7 +195,7 @@ fn f() {
|
|||
|
||||
auto* expect = R"(
|
||||
struct S {
|
||||
a : f32;
|
||||
a : f32,
|
||||
}
|
||||
|
||||
@group(4) @binding(5) var<storage, write> a : S;
|
||||
|
@ -225,7 +225,7 @@ fn f() {
|
|||
TEST_F(BindingRemapperTest, BindingCollisionsSameEntryPoint) {
|
||||
auto* src = R"(
|
||||
struct S {
|
||||
i : i32;
|
||||
i : i32,
|
||||
};
|
||||
|
||||
@group(2) @binding(1) var<storage, read> a : S;
|
||||
|
@ -244,7 +244,7 @@ fn f() {
|
|||
|
||||
auto* expect = R"(
|
||||
struct S {
|
||||
i : i32;
|
||||
i : i32,
|
||||
}
|
||||
|
||||
@internal(disable_validation__binding_point_collision) @group(1) @binding(1) var<storage, read> a : S;
|
||||
|
@ -277,7 +277,7 @@ fn f() {
|
|||
TEST_F(BindingRemapperTest, BindingCollisionsDifferentEntryPoints) {
|
||||
auto* src = R"(
|
||||
struct S {
|
||||
i : i32;
|
||||
i : i32,
|
||||
};
|
||||
|
||||
@group(2) @binding(1) var<storage, read> a : S;
|
||||
|
@ -301,7 +301,7 @@ fn f2() {
|
|||
|
||||
auto* expect = R"(
|
||||
struct S {
|
||||
i : i32;
|
||||
i : i32,
|
||||
}
|
||||
|
||||
@group(1) @binding(1) var<storage, read> a : S;
|
||||
|
@ -339,7 +339,7 @@ fn f2() {
|
|||
TEST_F(BindingRemapperTest, NoData) {
|
||||
auto* src = R"(
|
||||
struct S {
|
||||
a : f32;
|
||||
a : f32,
|
||||
}
|
||||
|
||||
@group(2) @binding(1) var<storage, read> a : S;
|
||||
|
|
|
@ -33,8 +33,8 @@ TEST_F(CalculateArrayLengthTest, ShouldRunEmptyModule) {
|
|||
TEST_F(CalculateArrayLengthTest, ShouldRunNoArrayLength) {
|
||||
auto* src = R"(
|
||||
struct SB {
|
||||
x : i32;
|
||||
arr : array<i32>;
|
||||
x : i32,
|
||||
arr : array<i32>,
|
||||
};
|
||||
|
||||
@group(0) @binding(0) var<storage, read> sb : SB;
|
||||
|
@ -50,8 +50,8 @@ fn main() {
|
|||
TEST_F(CalculateArrayLengthTest, ShouldRunWithArrayLength) {
|
||||
auto* src = R"(
|
||||
struct SB {
|
||||
x : i32;
|
||||
arr : array<i32>;
|
||||
x : i32,
|
||||
arr : array<i32>,
|
||||
};
|
||||
|
||||
@group(0) @binding(0) var<storage, read> sb : SB;
|
||||
|
@ -98,8 +98,8 @@ fn main() {
|
|||
TEST_F(CalculateArrayLengthTest, BasicInStruct) {
|
||||
auto* src = R"(
|
||||
struct SB {
|
||||
x : i32;
|
||||
arr : array<i32>;
|
||||
x : i32,
|
||||
arr : array<i32>,
|
||||
};
|
||||
|
||||
@group(0) @binding(0) var<storage, read> sb : SB;
|
||||
|
@ -115,8 +115,8 @@ fn main() {
|
|||
fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, result : ptr<function, u32>)
|
||||
|
||||
struct SB {
|
||||
x : i32;
|
||||
arr : array<i32>;
|
||||
x : i32,
|
||||
arr : array<i32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage, read> sb : SB;
|
||||
|
@ -138,7 +138,7 @@ fn main() {
|
|||
TEST_F(CalculateArrayLengthTest, ArrayOfStruct) {
|
||||
auto* src = R"(
|
||||
struct S {
|
||||
f : f32;
|
||||
f : f32,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage, read> arr : array<S>;
|
||||
|
@ -153,7 +153,7 @@ fn main() {
|
|||
fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : array<S>, result : ptr<function, u32>)
|
||||
|
||||
struct S {
|
||||
f : f32;
|
||||
f : f32,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage, read> arr : array<S>;
|
||||
|
@ -175,7 +175,7 @@ fn main() {
|
|||
TEST_F(CalculateArrayLengthTest, ArrayOfArrayOfStruct) {
|
||||
auto* src = R"(
|
||||
struct S {
|
||||
f : f32;
|
||||
f : f32,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage, read> arr : array<array<S, 4>>;
|
||||
|
@ -190,7 +190,7 @@ fn main() {
|
|||
fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : array<array<S, 4u>>, result : ptr<function, u32>)
|
||||
|
||||
struct S {
|
||||
f : f32;
|
||||
f : f32,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage, read> arr : array<array<S, 4>>;
|
||||
|
@ -246,8 +246,8 @@ fn main() {
|
|||
TEST_F(CalculateArrayLengthTest, InSameBlock_Struct) {
|
||||
auto* src = R"(
|
||||
struct SB {
|
||||
x : i32;
|
||||
arr : array<i32>;
|
||||
x : i32,
|
||||
arr : array<i32>,
|
||||
};
|
||||
|
||||
@group(0) @binding(0) var<storage, read> sb : SB;
|
||||
|
@ -265,8 +265,8 @@ fn main() {
|
|||
fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, result : ptr<function, u32>)
|
||||
|
||||
struct SB {
|
||||
x : i32;
|
||||
arr : array<i32>;
|
||||
x : i32,
|
||||
arr : array<i32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage, read> sb : SB;
|
||||
|
@ -290,8 +290,8 @@ fn main() {
|
|||
TEST_F(CalculateArrayLengthTest, Nested) {
|
||||
auto* src = R"(
|
||||
struct SB {
|
||||
x : i32;
|
||||
arr : array<i32>;
|
||||
x : i32,
|
||||
arr : array<i32>,
|
||||
};
|
||||
|
||||
@group(0) @binding(0) var<storage, read> sb : SB;
|
||||
|
@ -313,8 +313,8 @@ fn main() {
|
|||
fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, result : ptr<function, u32>)
|
||||
|
||||
struct SB {
|
||||
x : i32;
|
||||
arr : array<i32>;
|
||||
x : i32,
|
||||
arr : array<i32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage, read> sb : SB;
|
||||
|
@ -345,13 +345,13 @@ fn main() {
|
|||
TEST_F(CalculateArrayLengthTest, MultipleStorageBuffers) {
|
||||
auto* src = R"(
|
||||
struct SB1 {
|
||||
x : i32;
|
||||
arr1 : array<i32>;
|
||||
x : i32,
|
||||
arr1 : array<i32>,
|
||||
};
|
||||
|
||||
struct SB2 {
|
||||
x : i32;
|
||||
arr2 : array<vec4<f32>>;
|
||||
x : i32,
|
||||
arr2 : array<vec4<f32>>,
|
||||
};
|
||||
|
||||
@group(0) @binding(0) var<storage, read> sb1 : SB1;
|
||||
|
@ -380,13 +380,13 @@ fn tint_symbol_3(@internal(disable_validation__ignore_constructible_function_par
|
|||
fn tint_symbol_6(@internal(disable_validation__ignore_constructible_function_parameter) buffer : array<i32>, result : ptr<function, u32>)
|
||||
|
||||
struct SB1 {
|
||||
x : i32;
|
||||
arr1 : array<i32>;
|
||||
x : i32,
|
||||
arr1 : array<i32>,
|
||||
}
|
||||
|
||||
struct SB2 {
|
||||
x : i32;
|
||||
arr2 : array<vec4<f32>>;
|
||||
x : i32,
|
||||
arr2 : array<vec4<f32>>,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage, read> sb1 : SB1;
|
||||
|
@ -421,8 +421,8 @@ fn main() {
|
|||
TEST_F(CalculateArrayLengthTest, Shadowing) {
|
||||
auto* src = R"(
|
||||
struct SB {
|
||||
x : i32;
|
||||
arr : array<i32>;
|
||||
x : i32,
|
||||
arr : array<i32>,
|
||||
};
|
||||
|
||||
@group(0) @binding(0) var<storage, read> a : SB;
|
||||
|
@ -444,8 +444,8 @@ fn main() {
|
|||
fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, result : ptr<function, u32>)
|
||||
|
||||
struct SB {
|
||||
x : i32;
|
||||
arr : array<i32>;
|
||||
x : i32,
|
||||
arr : array<i32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage, read> a : SB;
|
||||
|
@ -485,15 +485,15 @@ fn main() {
|
|||
@group(0) @binding(0) var<storage, read> sb1 : SB1;
|
||||
|
||||
struct SB1 {
|
||||
x : i32;
|
||||
arr1 : array<i32>;
|
||||
x : i32,
|
||||
arr1 : array<i32>,
|
||||
};
|
||||
|
||||
@group(0) @binding(1) var<storage, read> sb2 : SB2;
|
||||
|
||||
struct SB2 {
|
||||
x : i32;
|
||||
arr2 : array<vec4<f32>>;
|
||||
x : i32,
|
||||
arr2 : array<vec4<f32>>,
|
||||
};
|
||||
|
||||
@group(0) @binding(2) var<storage, read> sb3 : array<i32>;
|
||||
|
@ -529,15 +529,15 @@ fn main() {
|
|||
@group(0) @binding(0) var<storage, read> sb1 : SB1;
|
||||
|
||||
struct SB1 {
|
||||
x : i32;
|
||||
arr1 : array<i32>;
|
||||
x : i32,
|
||||
arr1 : array<i32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(1) var<storage, read> sb2 : SB2;
|
||||
|
||||
struct SB2 {
|
||||
x : i32;
|
||||
arr2 : array<vec4<f32>>;
|
||||
x : i32,
|
||||
arr2 : array<vec4<f32>>,
|
||||
}
|
||||
|
||||
@group(0) @binding(2) var<storage, read> sb3 : array<i32>;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -129,7 +129,7 @@ TEST_F(DecomposeStridedArrayTest, PrivateStridedArray) {
|
|||
auto* expect = R"(
|
||||
struct strided_arr {
|
||||
@size(32)
|
||||
el : f32;
|
||||
el : f32,
|
||||
}
|
||||
|
||||
var<private> arr : array<strided_arr, 4>;
|
||||
|
@ -149,7 +149,7 @@ fn f() {
|
|||
|
||||
TEST_F(DecomposeStridedArrayTest, ReadUniformStridedArray) {
|
||||
// struct S {
|
||||
// a : @stride(32) array<f32, 4>;
|
||||
// a : @stride(32) array<f32, 4>,
|
||||
// };
|
||||
// @group(0) @binding(0) var<uniform> s : S;
|
||||
//
|
||||
|
@ -177,11 +177,11 @@ TEST_F(DecomposeStridedArrayTest, ReadUniformStridedArray) {
|
|||
auto* expect = R"(
|
||||
struct strided_arr {
|
||||
@size(32)
|
||||
el : f32;
|
||||
el : f32,
|
||||
}
|
||||
|
||||
struct S {
|
||||
a : array<strided_arr, 4>;
|
||||
a : array<strided_arr, 4>,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<uniform> s : S;
|
||||
|
@ -201,7 +201,7 @@ fn f() {
|
|||
|
||||
TEST_F(DecomposeStridedArrayTest, ReadUniformDefaultStridedArray) {
|
||||
// struct S {
|
||||
// a : @stride(16) array<vec4<f32>, 4>;
|
||||
// a : @stride(16) array<vec4<f32>, 4>,
|
||||
// };
|
||||
// @group(0) @binding(0) var<uniform> s : S;
|
||||
//
|
||||
|
@ -232,7 +232,7 @@ TEST_F(DecomposeStridedArrayTest, ReadUniformDefaultStridedArray) {
|
|||
auto* expect =
|
||||
R"(
|
||||
struct S {
|
||||
a : array<vec4<f32>, 4>;
|
||||
a : array<vec4<f32>, 4>,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<uniform> s : S;
|
||||
|
@ -252,7 +252,7 @@ fn f() {
|
|||
|
||||
TEST_F(DecomposeStridedArrayTest, ReadStorageStridedArray) {
|
||||
// struct S {
|
||||
// a : @stride(32) array<f32, 4>;
|
||||
// a : @stride(32) array<f32, 4>,
|
||||
// };
|
||||
// @group(0) @binding(0) var<storage> s : S;
|
||||
//
|
||||
|
@ -280,11 +280,11 @@ TEST_F(DecomposeStridedArrayTest, ReadStorageStridedArray) {
|
|||
auto* expect = R"(
|
||||
struct strided_arr {
|
||||
@size(32)
|
||||
el : f32;
|
||||
el : f32,
|
||||
}
|
||||
|
||||
struct S {
|
||||
a : array<strided_arr, 4>;
|
||||
a : array<strided_arr, 4>,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage> s : S;
|
||||
|
@ -304,7 +304,7 @@ fn f() {
|
|||
|
||||
TEST_F(DecomposeStridedArrayTest, ReadStorageDefaultStridedArray) {
|
||||
// struct S {
|
||||
// a : @stride(4) array<f32, 4>;
|
||||
// a : @stride(4) array<f32, 4>,
|
||||
// };
|
||||
// @group(0) @binding(0) var<storage> s : S;
|
||||
//
|
||||
|
@ -331,7 +331,7 @@ TEST_F(DecomposeStridedArrayTest, ReadStorageDefaultStridedArray) {
|
|||
|
||||
auto* expect = R"(
|
||||
struct S {
|
||||
a : array<f32, 4>;
|
||||
a : array<f32, 4>,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage> s : S;
|
||||
|
@ -351,7 +351,7 @@ fn f() {
|
|||
|
||||
TEST_F(DecomposeStridedArrayTest, WriteStorageStridedArray) {
|
||||
// struct S {
|
||||
// a : @stride(32) array<f32, 4>;
|
||||
// a : @stride(32) array<f32, 4>,
|
||||
// };
|
||||
// @group(0) @binding(0) var<storage, read_write> s : S;
|
||||
//
|
||||
|
@ -383,11 +383,11 @@ TEST_F(DecomposeStridedArrayTest, WriteStorageStridedArray) {
|
|||
R"(
|
||||
struct strided_arr {
|
||||
@size(32)
|
||||
el : f32;
|
||||
el : f32,
|
||||
}
|
||||
|
||||
struct S {
|
||||
a : array<strided_arr, 4>;
|
||||
a : array<strided_arr, 4>,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage, read_write> s : S;
|
||||
|
@ -408,7 +408,7 @@ fn f() {
|
|||
|
||||
TEST_F(DecomposeStridedArrayTest, WriteStorageDefaultStridedArray) {
|
||||
// struct S {
|
||||
// a : @stride(4) array<f32, 4>;
|
||||
// a : @stride(4) array<f32, 4>,
|
||||
// };
|
||||
// @group(0) @binding(0) var<storage, read_write> s : S;
|
||||
//
|
||||
|
@ -439,7 +439,7 @@ TEST_F(DecomposeStridedArrayTest, WriteStorageDefaultStridedArray) {
|
|||
auto* expect =
|
||||
R"(
|
||||
struct S {
|
||||
a : array<f32, 4>;
|
||||
a : array<f32, 4>,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage, read_write> s : S;
|
||||
|
@ -460,7 +460,7 @@ fn f() {
|
|||
|
||||
TEST_F(DecomposeStridedArrayTest, ReadWriteViaPointerLets) {
|
||||
// struct S {
|
||||
// a : @stride(32) array<f32, 4>;
|
||||
// a : @stride(32) array<f32, 4>,
|
||||
// };
|
||||
// @group(0) @binding(0) var<storage, read_write> s : S;
|
||||
//
|
||||
|
@ -498,11 +498,11 @@ TEST_F(DecomposeStridedArrayTest, ReadWriteViaPointerLets) {
|
|||
R"(
|
||||
struct strided_arr {
|
||||
@size(32)
|
||||
el : f32;
|
||||
el : f32,
|
||||
}
|
||||
|
||||
struct S {
|
||||
a : array<strided_arr, 4>;
|
||||
a : array<strided_arr, 4>,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage, read_write> s : S;
|
||||
|
@ -525,7 +525,7 @@ fn f() {
|
|||
TEST_F(DecomposeStridedArrayTest, PrivateAliasedStridedArray) {
|
||||
// type ARR = @stride(32) array<f32, 4>;
|
||||
// struct S {
|
||||
// a : ARR;
|
||||
// a : ARR,
|
||||
// };
|
||||
// @group(0) @binding(0) var<storage, read_write> s : S;
|
||||
//
|
||||
|
@ -563,13 +563,13 @@ TEST_F(DecomposeStridedArrayTest, PrivateAliasedStridedArray) {
|
|||
auto* expect = R"(
|
||||
struct strided_arr {
|
||||
@size(32)
|
||||
el : f32;
|
||||
el : f32,
|
||||
}
|
||||
|
||||
type ARR = array<strided_arr, 4>;
|
||||
|
||||
struct S {
|
||||
a : ARR;
|
||||
a : ARR,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage, read_write> s : S;
|
||||
|
@ -594,7 +594,7 @@ TEST_F(DecomposeStridedArrayTest, PrivateNestedStridedArray) {
|
|||
// type ARR_A = @stride(8) array<f32, 2>;
|
||||
// type ARR_B = @stride(128) array<@stride(16) array<ARR_A, 3>, 4>;
|
||||
// struct S {
|
||||
// a : ARR_B;
|
||||
// a : ARR_B,
|
||||
// };
|
||||
// @group(0) @binding(0) var<storage, read_write> s : S;
|
||||
//
|
||||
|
@ -659,20 +659,20 @@ TEST_F(DecomposeStridedArrayTest, PrivateNestedStridedArray) {
|
|||
R"(
|
||||
struct strided_arr {
|
||||
@size(8)
|
||||
el : f32;
|
||||
el : f32,
|
||||
}
|
||||
|
||||
type ARR_A = array<strided_arr, 2>;
|
||||
|
||||
struct strided_arr_1 {
|
||||
@size(128)
|
||||
el : array<ARR_A, 3>;
|
||||
el : array<ARR_A, 3>,
|
||||
}
|
||||
|
||||
type ARR_B = array<strided_arr_1, 4>;
|
||||
|
||||
struct S {
|
||||
a : ARR_B;
|
||||
a : ARR_B,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage, read_write> s : S;
|
||||
|
|
|
@ -58,7 +58,7 @@ TEST_F(DecomposeStridedMatrixTest, ReadUniformMatrix) {
|
|||
// struct S {
|
||||
// @offset(16) @stride(32)
|
||||
// @internal(ignore_stride_attribute)
|
||||
// m : mat2x2<f32>;
|
||||
// m : mat2x2<f32>,
|
||||
// };
|
||||
// @group(0) @binding(0) var<uniform> s : S;
|
||||
//
|
||||
|
@ -93,8 +93,8 @@ TEST_F(DecomposeStridedMatrixTest, ReadUniformMatrix) {
|
|||
auto* expect = R"(
|
||||
struct S {
|
||||
@size(16)
|
||||
padding : u32;
|
||||
m : @stride(32) array<vec2<f32>, 2u>;
|
||||
padding : u32,
|
||||
m : @stride(32) array<vec2<f32>, 2u>,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<uniform> s : S;
|
||||
|
@ -119,7 +119,7 @@ TEST_F(DecomposeStridedMatrixTest, ReadUniformColumn) {
|
|||
// struct S {
|
||||
// @offset(16) @stride(32)
|
||||
// @internal(ignore_stride_attribute)
|
||||
// m : mat2x2<f32>;
|
||||
// m : mat2x2<f32>,
|
||||
// };
|
||||
// @group(0) @binding(0) var<uniform> s : S;
|
||||
//
|
||||
|
@ -154,8 +154,8 @@ TEST_F(DecomposeStridedMatrixTest, ReadUniformColumn) {
|
|||
auto* expect = R"(
|
||||
struct S {
|
||||
@size(16)
|
||||
padding : u32;
|
||||
m : @stride(32) array<vec2<f32>, 2u>;
|
||||
padding : u32,
|
||||
m : @stride(32) array<vec2<f32>, 2u>,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<uniform> s : S;
|
||||
|
@ -176,7 +176,7 @@ TEST_F(DecomposeStridedMatrixTest, ReadUniformMatrix_DefaultStride) {
|
|||
// struct S {
|
||||
// @offset(16) @stride(8)
|
||||
// @internal(ignore_stride_attribute)
|
||||
// m : mat2x2<f32>;
|
||||
// m : mat2x2<f32>,
|
||||
// };
|
||||
// @group(0) @binding(0) var<uniform> s : S;
|
||||
//
|
||||
|
@ -211,9 +211,9 @@ TEST_F(DecomposeStridedMatrixTest, ReadUniformMatrix_DefaultStride) {
|
|||
auto* expect = R"(
|
||||
struct S {
|
||||
@size(16)
|
||||
padding : u32;
|
||||
padding : u32,
|
||||
@stride(8) @internal(disable_validation__ignore_stride)
|
||||
m : mat2x2<f32>;
|
||||
m : mat2x2<f32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<uniform> s : S;
|
||||
|
@ -234,7 +234,7 @@ TEST_F(DecomposeStridedMatrixTest, ReadStorageMatrix) {
|
|||
// struct S {
|
||||
// @offset(8) @stride(32)
|
||||
// @internal(ignore_stride_attribute)
|
||||
// m : mat2x2<f32>;
|
||||
// m : mat2x2<f32>,
|
||||
// };
|
||||
// @group(0) @binding(0) var<storage, read_write> s : S;
|
||||
//
|
||||
|
@ -269,8 +269,8 @@ TEST_F(DecomposeStridedMatrixTest, ReadStorageMatrix) {
|
|||
auto* expect = R"(
|
||||
struct S {
|
||||
@size(8)
|
||||
padding : u32;
|
||||
m : @stride(32) array<vec2<f32>, 2u>;
|
||||
padding : u32,
|
||||
m : @stride(32) array<vec2<f32>, 2u>,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage, read_write> s : S;
|
||||
|
@ -295,7 +295,7 @@ TEST_F(DecomposeStridedMatrixTest, ReadStorageColumn) {
|
|||
// struct S {
|
||||
// @offset(16) @stride(32)
|
||||
// @internal(ignore_stride_attribute)
|
||||
// m : mat2x2<f32>;
|
||||
// m : mat2x2<f32>,
|
||||
// };
|
||||
// @group(0) @binding(0) var<storage, read_write> s : S;
|
||||
//
|
||||
|
@ -330,8 +330,8 @@ TEST_F(DecomposeStridedMatrixTest, ReadStorageColumn) {
|
|||
auto* expect = R"(
|
||||
struct S {
|
||||
@size(16)
|
||||
padding : u32;
|
||||
m : @stride(32) array<vec2<f32>, 2u>;
|
||||
padding : u32,
|
||||
m : @stride(32) array<vec2<f32>, 2u>,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage, read_write> s : S;
|
||||
|
@ -352,7 +352,7 @@ TEST_F(DecomposeStridedMatrixTest, WriteStorageMatrix) {
|
|||
// struct S {
|
||||
// @offset(8) @stride(32)
|
||||
// @internal(ignore_stride_attribute)
|
||||
// m : mat2x2<f32>;
|
||||
// m : mat2x2<f32>,
|
||||
// };
|
||||
// @group(0) @binding(0) var<storage, read_write> s : S;
|
||||
//
|
||||
|
@ -388,8 +388,8 @@ TEST_F(DecomposeStridedMatrixTest, WriteStorageMatrix) {
|
|||
auto* expect = R"(
|
||||
struct S {
|
||||
@size(8)
|
||||
padding : u32;
|
||||
m : @stride(32) array<vec2<f32>, 2u>;
|
||||
padding : u32,
|
||||
m : @stride(32) array<vec2<f32>, 2u>,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage, read_write> s : S;
|
||||
|
@ -414,7 +414,7 @@ TEST_F(DecomposeStridedMatrixTest, WriteStorageColumn) {
|
|||
// struct S {
|
||||
// @offset(8) @stride(32)
|
||||
// @internal(ignore_stride_attribute)
|
||||
// m : mat2x2<f32>;
|
||||
// m : mat2x2<f32>,
|
||||
// };
|
||||
// @group(0) @binding(0) var<storage, read_write> s : S;
|
||||
//
|
||||
|
@ -449,8 +449,8 @@ TEST_F(DecomposeStridedMatrixTest, WriteStorageColumn) {
|
|||
auto* expect = R"(
|
||||
struct S {
|
||||
@size(8)
|
||||
padding : u32;
|
||||
m : @stride(32) array<vec2<f32>, 2u>;
|
||||
padding : u32,
|
||||
m : @stride(32) array<vec2<f32>, 2u>,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage, read_write> s : S;
|
||||
|
@ -471,7 +471,7 @@ TEST_F(DecomposeStridedMatrixTest, ReadWriteViaPointerLets) {
|
|||
// struct S {
|
||||
// @offset(8) @stride(32)
|
||||
// @internal(ignore_stride_attribute)
|
||||
// m : mat2x2<f32>;
|
||||
// m : mat2x2<f32>,
|
||||
// };
|
||||
// @group(0) @binding(0) var<storage, read_write> s : S;
|
||||
//
|
||||
|
@ -521,8 +521,8 @@ TEST_F(DecomposeStridedMatrixTest, ReadWriteViaPointerLets) {
|
|||
auto* expect = R"(
|
||||
struct S {
|
||||
@size(8)
|
||||
padding : u32;
|
||||
m : @stride(32) array<vec2<f32>, 2u>;
|
||||
padding : u32,
|
||||
m : @stride(32) array<vec2<f32>, 2u>,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage, read_write> s : S;
|
||||
|
@ -555,7 +555,7 @@ TEST_F(DecomposeStridedMatrixTest, ReadPrivateMatrix) {
|
|||
// struct S {
|
||||
// @offset(8) @stride(32)
|
||||
// @internal(ignore_stride_attribute)
|
||||
// m : mat2x2<f32>;
|
||||
// m : mat2x2<f32>,
|
||||
// };
|
||||
// var<private> s : S;
|
||||
//
|
||||
|
@ -589,9 +589,9 @@ TEST_F(DecomposeStridedMatrixTest, ReadPrivateMatrix) {
|
|||
auto* expect = R"(
|
||||
struct S {
|
||||
@size(8)
|
||||
padding : u32;
|
||||
padding : u32,
|
||||
@stride(32) @internal(disable_validation__ignore_stride)
|
||||
m : mat2x2<f32>;
|
||||
m : mat2x2<f32>,
|
||||
}
|
||||
|
||||
var<private> s : S;
|
||||
|
@ -612,7 +612,7 @@ TEST_F(DecomposeStridedMatrixTest, WritePrivateMatrix) {
|
|||
// struct S {
|
||||
// @offset(8) @stride(32)
|
||||
// @internal(ignore_stride_attribute)
|
||||
// m : mat2x2<f32>;
|
||||
// m : mat2x2<f32>,
|
||||
// };
|
||||
// var<private> s : S;
|
||||
//
|
||||
|
@ -647,9 +647,9 @@ TEST_F(DecomposeStridedMatrixTest, WritePrivateMatrix) {
|
|||
auto* expect = R"(
|
||||
struct S {
|
||||
@size(8)
|
||||
padding : u32;
|
||||
padding : u32,
|
||||
@stride(32) @internal(disable_validation__ignore_stride)
|
||||
m : mat2x2<f32>;
|
||||
m : mat2x2<f32>,
|
||||
}
|
||||
|
||||
var<private> s : S;
|
||||
|
|
|
@ -108,7 +108,7 @@ fn entry(@builtin(vertex_index) vert_idx : u32) -> @builtin(position) vec4<f32>
|
|||
|
||||
auto* expect = R"(
|
||||
struct tint_symbol {
|
||||
first_vertex_index : u32;
|
||||
first_vertex_index : u32,
|
||||
}
|
||||
|
||||
@binding(1) @group(2) var<uniform> tint_symbol_1 : tint_symbol;
|
||||
|
@ -154,7 +154,7 @@ fn test(vert_idx : u32) -> u32 {
|
|||
|
||||
auto* expect = R"(
|
||||
struct tint_symbol {
|
||||
first_vertex_index : u32;
|
||||
first_vertex_index : u32,
|
||||
}
|
||||
|
||||
@binding(1) @group(2) var<uniform> tint_symbol_1 : tint_symbol;
|
||||
|
@ -200,7 +200,7 @@ fn entry(@builtin(instance_index) inst_idx : u32) -> @builtin(position) vec4<f32
|
|||
|
||||
auto* expect = R"(
|
||||
struct tint_symbol {
|
||||
first_instance_index : u32;
|
||||
first_instance_index : u32,
|
||||
}
|
||||
|
||||
@binding(1) @group(7) var<uniform> tint_symbol_1 : tint_symbol;
|
||||
|
@ -246,7 +246,7 @@ fn test(inst_idx : u32) -> u32 {
|
|||
|
||||
auto* expect = R"(
|
||||
struct tint_symbol {
|
||||
first_instance_index : u32;
|
||||
first_instance_index : u32,
|
||||
}
|
||||
|
||||
@binding(1) @group(7) var<uniform> tint_symbol_1 : tint_symbol;
|
||||
|
@ -284,8 +284,8 @@ fn test(instance_idx : u32, vert_idx : u32) -> u32 {
|
|||
}
|
||||
|
||||
struct Inputs {
|
||||
@builtin(instance_index) instance_idx : u32;
|
||||
@builtin(vertex_index) vert_idx : u32;
|
||||
@builtin(instance_index) instance_idx : u32,
|
||||
@builtin(vertex_index) vert_idx : u32,
|
||||
};
|
||||
|
||||
@stage(vertex)
|
||||
|
@ -297,8 +297,8 @@ fn entry(inputs : Inputs) -> @builtin(position) vec4<f32> {
|
|||
|
||||
auto* expect = R"(
|
||||
struct tint_symbol {
|
||||
first_vertex_index : u32;
|
||||
first_instance_index : u32;
|
||||
first_vertex_index : u32,
|
||||
first_instance_index : u32,
|
||||
}
|
||||
|
||||
@binding(1) @group(2) var<uniform> tint_symbol_1 : tint_symbol;
|
||||
|
@ -309,9 +309,9 @@ fn test(instance_idx : u32, vert_idx : u32) -> u32 {
|
|||
|
||||
struct Inputs {
|
||||
@builtin(instance_index)
|
||||
instance_idx : u32;
|
||||
instance_idx : u32,
|
||||
@builtin(vertex_index)
|
||||
vert_idx : u32;
|
||||
vert_idx : u32,
|
||||
}
|
||||
|
||||
@stage(vertex)
|
||||
|
@ -345,8 +345,8 @@ fn entry(inputs : Inputs) -> @builtin(position) vec4<f32> {
|
|||
}
|
||||
|
||||
struct Inputs {
|
||||
@builtin(instance_index) instance_idx : u32;
|
||||
@builtin(vertex_index) vert_idx : u32;
|
||||
@builtin(instance_index) instance_idx : u32,
|
||||
@builtin(vertex_index) vert_idx : u32,
|
||||
};
|
||||
|
||||
fn test(instance_idx : u32, vert_idx : u32) -> u32 {
|
||||
|
@ -356,8 +356,8 @@ fn test(instance_idx : u32, vert_idx : u32) -> u32 {
|
|||
|
||||
auto* expect = R"(
|
||||
struct tint_symbol {
|
||||
first_vertex_index : u32;
|
||||
first_instance_index : u32;
|
||||
first_vertex_index : u32,
|
||||
first_instance_index : u32,
|
||||
}
|
||||
|
||||
@binding(1) @group(2) var<uniform> tint_symbol_1 : tint_symbol;
|
||||
|
@ -370,9 +370,9 @@ fn entry(inputs : Inputs) -> @builtin(position) vec4<f32> {
|
|||
|
||||
struct Inputs {
|
||||
@builtin(instance_index)
|
||||
instance_idx : u32;
|
||||
instance_idx : u32,
|
||||
@builtin(vertex_index)
|
||||
vert_idx : u32;
|
||||
vert_idx : u32,
|
||||
}
|
||||
|
||||
fn test(instance_idx : u32, vert_idx : u32) -> u32 {
|
||||
|
@ -414,7 +414,7 @@ fn entry(@builtin(vertex_index) vert_idx : u32) -> @builtin(position) vec4<f32>
|
|||
|
||||
auto* expect = R"(
|
||||
struct tint_symbol {
|
||||
first_vertex_index : u32;
|
||||
first_vertex_index : u32,
|
||||
}
|
||||
|
||||
@binding(1) @group(2) var<uniform> tint_symbol_1 : tint_symbol;
|
||||
|
@ -468,7 +468,7 @@ fn func1(vert_idx : u32) -> u32 {
|
|||
|
||||
auto* expect = R"(
|
||||
struct tint_symbol {
|
||||
first_vertex_index : u32;
|
||||
first_vertex_index : u32,
|
||||
}
|
||||
|
||||
@binding(1) @group(2) var<uniform> tint_symbol_1 : tint_symbol;
|
||||
|
@ -530,8 +530,8 @@ fn entry_c(@builtin(instance_index) inst_idx : u32) -> @builtin(position) vec4<f
|
|||
|
||||
auto* expect = R"(
|
||||
struct tint_symbol {
|
||||
first_vertex_index : u32;
|
||||
first_instance_index : u32;
|
||||
first_vertex_index : u32,
|
||||
first_instance_index : u32,
|
||||
}
|
||||
|
||||
@binding(1) @group(2) var<uniform> tint_symbol_1 : tint_symbol;
|
||||
|
@ -601,8 +601,8 @@ fn func(i : u32) -> u32 {
|
|||
|
||||
auto* expect = R"(
|
||||
struct tint_symbol {
|
||||
first_vertex_index : u32;
|
||||
first_instance_index : u32;
|
||||
first_vertex_index : u32,
|
||||
first_instance_index : u32,
|
||||
}
|
||||
|
||||
@binding(1) @group(2) var<uniform> tint_symbol_1 : tint_symbol;
|
||||
|
|
|
@ -35,15 +35,15 @@ TEST_F(LocalizeStructArrayAssignmentTest, EmptyModule) {
|
|||
TEST_F(LocalizeStructArrayAssignmentTest, StructArray) {
|
||||
auto* src = R"(
|
||||
struct Uniforms {
|
||||
i : u32;
|
||||
i : u32,
|
||||
};
|
||||
|
||||
struct InnerS {
|
||||
v : i32;
|
||||
v : i32,
|
||||
};
|
||||
|
||||
struct OuterS {
|
||||
a1 : array<InnerS, 8>;
|
||||
a1 : array<InnerS, 8>,
|
||||
};
|
||||
|
||||
@group(1) @binding(4) var<uniform> uniforms : Uniforms;
|
||||
|
@ -58,15 +58,15 @@ fn main() {
|
|||
|
||||
auto* expect = R"(
|
||||
struct Uniforms {
|
||||
i : u32;
|
||||
i : u32,
|
||||
}
|
||||
|
||||
struct InnerS {
|
||||
v : i32;
|
||||
v : i32,
|
||||
}
|
||||
|
||||
struct OuterS {
|
||||
a1 : array<InnerS, 8>;
|
||||
a1 : array<InnerS, 8>,
|
||||
}
|
||||
|
||||
@group(1) @binding(4) var<uniform> uniforms : Uniforms;
|
||||
|
@ -101,15 +101,15 @@ fn main() {
|
|||
@group(1) @binding(4) var<uniform> uniforms : Uniforms;
|
||||
|
||||
struct OuterS {
|
||||
a1 : array<InnerS, 8>;
|
||||
a1 : array<InnerS, 8>,
|
||||
};
|
||||
|
||||
struct InnerS {
|
||||
v : i32;
|
||||
v : i32,
|
||||
};
|
||||
|
||||
struct Uniforms {
|
||||
i : u32;
|
||||
i : u32,
|
||||
};
|
||||
)";
|
||||
|
||||
|
@ -129,15 +129,15 @@ fn main() {
|
|||
@group(1) @binding(4) var<uniform> uniforms : Uniforms;
|
||||
|
||||
struct OuterS {
|
||||
a1 : array<InnerS, 8>;
|
||||
a1 : array<InnerS, 8>,
|
||||
}
|
||||
|
||||
struct InnerS {
|
||||
v : i32;
|
||||
v : i32,
|
||||
}
|
||||
|
||||
struct Uniforms {
|
||||
i : u32;
|
||||
i : u32,
|
||||
}
|
||||
)";
|
||||
|
||||
|
@ -149,19 +149,19 @@ struct Uniforms {
|
|||
TEST_F(LocalizeStructArrayAssignmentTest, StructStructArray) {
|
||||
auto* src = R"(
|
||||
struct Uniforms {
|
||||
i : u32;
|
||||
i : u32,
|
||||
};
|
||||
|
||||
struct InnerS {
|
||||
v : i32;
|
||||
v : i32,
|
||||
};
|
||||
|
||||
struct S1 {
|
||||
a : array<InnerS, 8>;
|
||||
a : array<InnerS, 8>,
|
||||
};
|
||||
|
||||
struct OuterS {
|
||||
s2 : S1;
|
||||
s2 : S1,
|
||||
};
|
||||
|
||||
@group(1) @binding(4) var<uniform> uniforms : Uniforms;
|
||||
|
@ -176,19 +176,19 @@ fn main() {
|
|||
|
||||
auto* expect = R"(
|
||||
struct Uniforms {
|
||||
i : u32;
|
||||
i : u32,
|
||||
}
|
||||
|
||||
struct InnerS {
|
||||
v : i32;
|
||||
v : i32,
|
||||
}
|
||||
|
||||
struct S1 {
|
||||
a : array<InnerS, 8>;
|
||||
a : array<InnerS, 8>,
|
||||
}
|
||||
|
||||
struct OuterS {
|
||||
s2 : S1;
|
||||
s2 : S1,
|
||||
}
|
||||
|
||||
@group(1) @binding(4) var<uniform> uniforms : Uniforms;
|
||||
|
@ -223,19 +223,19 @@ fn main() {
|
|||
@group(1) @binding(4) var<uniform> uniforms : Uniforms;
|
||||
|
||||
struct OuterS {
|
||||
s2 : S1;
|
||||
s2 : S1,
|
||||
};
|
||||
|
||||
struct S1 {
|
||||
a : array<InnerS, 8>;
|
||||
a : array<InnerS, 8>,
|
||||
};
|
||||
|
||||
struct InnerS {
|
||||
v : i32;
|
||||
v : i32,
|
||||
};
|
||||
|
||||
struct Uniforms {
|
||||
i : u32;
|
||||
i : u32,
|
||||
};
|
||||
)";
|
||||
|
||||
|
@ -255,19 +255,19 @@ fn main() {
|
|||
@group(1) @binding(4) var<uniform> uniforms : Uniforms;
|
||||
|
||||
struct OuterS {
|
||||
s2 : S1;
|
||||
s2 : S1,
|
||||
}
|
||||
|
||||
struct S1 {
|
||||
a : array<InnerS, 8>;
|
||||
a : array<InnerS, 8>,
|
||||
}
|
||||
|
||||
struct InnerS {
|
||||
v : i32;
|
||||
v : i32,
|
||||
}
|
||||
|
||||
struct Uniforms {
|
||||
i : u32;
|
||||
i : u32,
|
||||
}
|
||||
)";
|
||||
|
||||
|
@ -279,16 +279,16 @@ struct Uniforms {
|
|||
TEST_F(LocalizeStructArrayAssignmentTest, StructArrayArray) {
|
||||
auto* src = R"(
|
||||
struct Uniforms {
|
||||
i : u32;
|
||||
j : u32;
|
||||
i : u32,
|
||||
j : u32,
|
||||
};
|
||||
|
||||
struct InnerS {
|
||||
v : i32;
|
||||
v : i32,
|
||||
};
|
||||
|
||||
struct OuterS {
|
||||
a1 : array<array<InnerS, 8>, 8>;
|
||||
a1 : array<array<InnerS, 8>, 8>,
|
||||
};
|
||||
|
||||
@group(1) @binding(4) var<uniform> uniforms : Uniforms;
|
||||
|
@ -303,16 +303,16 @@ fn main() {
|
|||
|
||||
auto* expect = R"(
|
||||
struct Uniforms {
|
||||
i : u32;
|
||||
j : u32;
|
||||
i : u32,
|
||||
j : u32,
|
||||
}
|
||||
|
||||
struct InnerS {
|
||||
v : i32;
|
||||
v : i32,
|
||||
}
|
||||
|
||||
struct OuterS {
|
||||
a1 : array<array<InnerS, 8>, 8>;
|
||||
a1 : array<array<InnerS, 8>, 8>,
|
||||
}
|
||||
|
||||
@group(1) @binding(4) var<uniform> uniforms : Uniforms;
|
||||
|
@ -338,19 +338,19 @@ fn main() {
|
|||
TEST_F(LocalizeStructArrayAssignmentTest, StructArrayStruct) {
|
||||
auto* src = R"(
|
||||
struct Uniforms {
|
||||
i : u32;
|
||||
i : u32,
|
||||
};
|
||||
|
||||
struct InnerS {
|
||||
v : i32;
|
||||
v : i32,
|
||||
};
|
||||
|
||||
struct S1 {
|
||||
s2 : InnerS;
|
||||
s2 : InnerS,
|
||||
};
|
||||
|
||||
struct OuterS {
|
||||
a1 : array<S1, 8>;
|
||||
a1 : array<S1, 8>,
|
||||
};
|
||||
|
||||
@group(1) @binding(4) var<uniform> uniforms : Uniforms;
|
||||
|
@ -365,19 +365,19 @@ fn main() {
|
|||
|
||||
auto* expect = R"(
|
||||
struct Uniforms {
|
||||
i : u32;
|
||||
i : u32,
|
||||
}
|
||||
|
||||
struct InnerS {
|
||||
v : i32;
|
||||
v : i32,
|
||||
}
|
||||
|
||||
struct S1 {
|
||||
s2 : InnerS;
|
||||
s2 : InnerS,
|
||||
}
|
||||
|
||||
struct OuterS {
|
||||
a1 : array<S1, 8>;
|
||||
a1 : array<S1, 8>,
|
||||
}
|
||||
|
||||
@group(1) @binding(4) var<uniform> uniforms : Uniforms;
|
||||
|
@ -403,20 +403,20 @@ fn main() {
|
|||
TEST_F(LocalizeStructArrayAssignmentTest, StructArrayStructArray) {
|
||||
auto* src = R"(
|
||||
struct Uniforms {
|
||||
i : u32;
|
||||
j : u32;
|
||||
i : u32,
|
||||
j : u32,
|
||||
};
|
||||
|
||||
struct InnerS {
|
||||
v : i32;
|
||||
v : i32,
|
||||
};
|
||||
|
||||
struct S1 {
|
||||
a2 : array<InnerS, 8>;
|
||||
a2 : array<InnerS, 8>,
|
||||
};
|
||||
|
||||
struct OuterS {
|
||||
a1 : array<S1, 8>;
|
||||
a1 : array<S1, 8>,
|
||||
};
|
||||
|
||||
@group(1) @binding(4) var<uniform> uniforms : Uniforms;
|
||||
|
@ -431,20 +431,20 @@ fn main() {
|
|||
|
||||
auto* expect = R"(
|
||||
struct Uniforms {
|
||||
i : u32;
|
||||
j : u32;
|
||||
i : u32,
|
||||
j : u32,
|
||||
}
|
||||
|
||||
struct InnerS {
|
||||
v : i32;
|
||||
v : i32,
|
||||
}
|
||||
|
||||
struct S1 {
|
||||
a2 : array<InnerS, 8>;
|
||||
a2 : array<InnerS, 8>,
|
||||
}
|
||||
|
||||
struct OuterS {
|
||||
a1 : array<S1, 8>;
|
||||
a1 : array<S1, 8>,
|
||||
}
|
||||
|
||||
@group(1) @binding(4) var<uniform> uniforms : Uniforms;
|
||||
|
@ -473,20 +473,20 @@ fn main() {
|
|||
TEST_F(LocalizeStructArrayAssignmentTest, IndexingWithSideEffectFunc) {
|
||||
auto* src = R"(
|
||||
struct Uniforms {
|
||||
i : u32;
|
||||
j : u32;
|
||||
i : u32,
|
||||
j : u32,
|
||||
};
|
||||
|
||||
struct InnerS {
|
||||
v : i32;
|
||||
v : i32,
|
||||
};
|
||||
|
||||
struct S1 {
|
||||
a2 : array<InnerS, 8>;
|
||||
a2 : array<InnerS, 8>,
|
||||
};
|
||||
|
||||
struct OuterS {
|
||||
a1 : array<S1, 8>;
|
||||
a1 : array<S1, 8>,
|
||||
};
|
||||
|
||||
var<private> nextIndex : u32;
|
||||
|
@ -507,20 +507,20 @@ fn main() {
|
|||
|
||||
auto* expect = R"(
|
||||
struct Uniforms {
|
||||
i : u32;
|
||||
j : u32;
|
||||
i : u32,
|
||||
j : u32,
|
||||
}
|
||||
|
||||
struct InnerS {
|
||||
v : i32;
|
||||
v : i32,
|
||||
}
|
||||
|
||||
struct S1 {
|
||||
a2 : array<InnerS, 8>;
|
||||
a2 : array<InnerS, 8>,
|
||||
}
|
||||
|
||||
struct OuterS {
|
||||
a1 : array<S1, 8>;
|
||||
a1 : array<S1, 8>,
|
||||
}
|
||||
|
||||
var<private> nextIndex : u32;
|
||||
|
@ -566,8 +566,8 @@ fn main() {
|
|||
@group(1) @binding(4) var<uniform> uniforms : Uniforms;
|
||||
|
||||
struct Uniforms {
|
||||
i : u32;
|
||||
j : u32;
|
||||
i : u32,
|
||||
j : u32,
|
||||
};
|
||||
|
||||
var<private> nextIndex : u32;
|
||||
|
@ -577,15 +577,15 @@ fn getNextIndex() -> u32 {
|
|||
}
|
||||
|
||||
struct OuterS {
|
||||
a1 : array<S1, 8>;
|
||||
a1 : array<S1, 8>,
|
||||
};
|
||||
|
||||
struct S1 {
|
||||
a2 : array<InnerS, 8>;
|
||||
a2 : array<InnerS, 8>,
|
||||
};
|
||||
|
||||
struct InnerS {
|
||||
v : i32;
|
||||
v : i32,
|
||||
};
|
||||
)";
|
||||
|
||||
|
@ -608,8 +608,8 @@ fn main() {
|
|||
@group(1) @binding(4) var<uniform> uniforms : Uniforms;
|
||||
|
||||
struct Uniforms {
|
||||
i : u32;
|
||||
j : u32;
|
||||
i : u32,
|
||||
j : u32,
|
||||
}
|
||||
|
||||
var<private> nextIndex : u32;
|
||||
|
@ -620,15 +620,15 @@ fn getNextIndex() -> u32 {
|
|||
}
|
||||
|
||||
struct OuterS {
|
||||
a1 : array<S1, 8>;
|
||||
a1 : array<S1, 8>,
|
||||
}
|
||||
|
||||
struct S1 {
|
||||
a2 : array<InnerS, 8>;
|
||||
a2 : array<InnerS, 8>,
|
||||
}
|
||||
|
||||
struct InnerS {
|
||||
v : i32;
|
||||
v : i32,
|
||||
}
|
||||
)";
|
||||
|
||||
|
@ -640,13 +640,13 @@ struct InnerS {
|
|||
TEST_F(LocalizeStructArrayAssignmentTest, ViaPointerArg) {
|
||||
auto* src = R"(
|
||||
struct Uniforms {
|
||||
i : u32;
|
||||
i : u32,
|
||||
};
|
||||
struct InnerS {
|
||||
v : i32;
|
||||
v : i32,
|
||||
};
|
||||
struct OuterS {
|
||||
a1 : array<InnerS, 8>;
|
||||
a1 : array<InnerS, 8>,
|
||||
};
|
||||
@group(1) @binding(4) var<uniform> uniforms : Uniforms;
|
||||
|
||||
|
@ -664,15 +664,15 @@ fn main() {
|
|||
|
||||
auto* expect = R"(
|
||||
struct Uniforms {
|
||||
i : u32;
|
||||
i : u32,
|
||||
}
|
||||
|
||||
struct InnerS {
|
||||
v : i32;
|
||||
v : i32,
|
||||
}
|
||||
|
||||
struct OuterS {
|
||||
a1 : array<InnerS, 8>;
|
||||
a1 : array<InnerS, 8>,
|
||||
}
|
||||
|
||||
@group(1) @binding(4) var<uniform> uniforms : Uniforms;
|
||||
|
@ -713,16 +713,16 @@ fn f(p : ptr<function, OuterS>) {
|
|||
}
|
||||
|
||||
struct InnerS {
|
||||
v : i32;
|
||||
v : i32,
|
||||
};
|
||||
struct OuterS {
|
||||
a1 : array<InnerS, 8>;
|
||||
a1 : array<InnerS, 8>,
|
||||
};
|
||||
|
||||
@group(1) @binding(4) var<uniform> uniforms : Uniforms;
|
||||
|
||||
struct Uniforms {
|
||||
i : u32;
|
||||
i : u32,
|
||||
};
|
||||
)";
|
||||
|
||||
|
@ -744,17 +744,17 @@ fn f(p : ptr<function, OuterS>) {
|
|||
}
|
||||
|
||||
struct InnerS {
|
||||
v : i32;
|
||||
v : i32,
|
||||
}
|
||||
|
||||
struct OuterS {
|
||||
a1 : array<InnerS, 8>;
|
||||
a1 : array<InnerS, 8>,
|
||||
}
|
||||
|
||||
@group(1) @binding(4) var<uniform> uniforms : Uniforms;
|
||||
|
||||
struct Uniforms {
|
||||
i : u32;
|
||||
i : u32,
|
||||
}
|
||||
)";
|
||||
|
||||
|
@ -766,15 +766,15 @@ struct Uniforms {
|
|||
TEST_F(LocalizeStructArrayAssignmentTest, ViaPointerVar) {
|
||||
auto* src = R"(
|
||||
struct Uniforms {
|
||||
i : u32;
|
||||
i : u32,
|
||||
};
|
||||
|
||||
struct InnerS {
|
||||
v : i32;
|
||||
v : i32,
|
||||
};
|
||||
|
||||
struct OuterS {
|
||||
a1 : array<InnerS, 8>;
|
||||
a1 : array<InnerS, 8>,
|
||||
};
|
||||
|
||||
@group(1) @binding(4) var<uniform> uniforms : Uniforms;
|
||||
|
@ -794,15 +794,15 @@ fn main() {
|
|||
|
||||
auto* expect = R"(
|
||||
struct Uniforms {
|
||||
i : u32;
|
||||
i : u32,
|
||||
}
|
||||
|
||||
struct InnerS {
|
||||
v : i32;
|
||||
v : i32,
|
||||
}
|
||||
|
||||
struct OuterS {
|
||||
a1 : array<InnerS, 8>;
|
||||
a1 : array<InnerS, 8>,
|
||||
}
|
||||
|
||||
@group(1) @binding(4) var<uniform> uniforms : Uniforms;
|
||||
|
@ -833,11 +833,11 @@ fn main() {
|
|||
TEST_F(LocalizeStructArrayAssignmentTest, VectorAssignment) {
|
||||
auto* src = R"(
|
||||
struct Uniforms {
|
||||
i : u32;
|
||||
i : u32,
|
||||
}
|
||||
|
||||
struct OuterS {
|
||||
a1 : array<u32, 8>;
|
||||
a1 : array<u32, 8>,
|
||||
}
|
||||
|
||||
@group(1) @binding(4) var<uniform> uniforms : Uniforms;
|
||||
|
|
|
@ -387,7 +387,7 @@ fn bar(p : ptr<private, f32>) {
|
|||
TEST_F(ModuleScopeVarToEntryPointParamTest, Buffers_Basic) {
|
||||
auto* src = R"(
|
||||
struct S {
|
||||
a : f32;
|
||||
a : f32,
|
||||
};
|
||||
|
||||
@group(0) @binding(0)
|
||||
|
@ -404,7 +404,7 @@ fn main() {
|
|||
|
||||
auto* expect = R"(
|
||||
struct S {
|
||||
a : f32;
|
||||
a : f32,
|
||||
}
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
|
@ -431,7 +431,7 @@ fn main() {
|
|||
@group(0) @binding(1) var<storage> s : S;
|
||||
|
||||
struct S {
|
||||
a : f32;
|
||||
a : f32,
|
||||
};
|
||||
|
||||
)";
|
||||
|
@ -444,7 +444,7 @@ fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_paramete
|
|||
}
|
||||
|
||||
struct S {
|
||||
a : f32;
|
||||
a : f32,
|
||||
}
|
||||
)";
|
||||
|
||||
|
@ -466,7 +466,7 @@ fn main() {
|
|||
|
||||
auto* expect = R"(
|
||||
struct tint_symbol_1 {
|
||||
arr : array<f32>;
|
||||
arr : array<f32>,
|
||||
}
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
|
@ -493,7 +493,7 @@ var<storage> buffer : array<f32>;
|
|||
|
||||
auto* expect = R"(
|
||||
struct tint_symbol_1 {
|
||||
arr : array<f32>;
|
||||
arr : array<f32>,
|
||||
}
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
|
@ -524,7 +524,7 @@ fn main() {
|
|||
|
||||
auto* expect = R"(
|
||||
struct tint_symbol_2 {
|
||||
arr : array<f32>;
|
||||
arr : array<f32>,
|
||||
}
|
||||
|
||||
fn foo(@internal(disable_validation__ignore_storage_class) @internal(disable_validation__ignore_invalid_pointer_argument) tint_symbol : ptr<storage, array<f32>>) {
|
||||
|
@ -559,7 +559,7 @@ fn foo() {
|
|||
|
||||
auto* expect = R"(
|
||||
struct tint_symbol_1 {
|
||||
arr : array<f32>;
|
||||
arr : array<f32>,
|
||||
}
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
|
@ -592,7 +592,7 @@ fn main() {
|
|||
|
||||
auto* expect = R"(
|
||||
struct tint_symbol_1 {
|
||||
arr : array<f32>;
|
||||
arr : array<f32>,
|
||||
}
|
||||
|
||||
type myarray = array<f32>;
|
||||
|
@ -623,7 +623,7 @@ type myarray = array<f32>;
|
|||
|
||||
auto* expect = R"(
|
||||
struct tint_symbol_1 {
|
||||
arr : array<f32>;
|
||||
arr : array<f32>,
|
||||
}
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
|
@ -642,7 +642,7 @@ type myarray = array<f32>;
|
|||
TEST_F(ModuleScopeVarToEntryPointParamTest, Buffer_ArrayOfStruct) {
|
||||
auto* src = R"(
|
||||
struct S {
|
||||
f : f32;
|
||||
f : f32,
|
||||
};
|
||||
|
||||
@group(0) @binding(0)
|
||||
|
@ -656,11 +656,11 @@ fn main() {
|
|||
|
||||
auto* expect = R"(
|
||||
struct S {
|
||||
f : f32;
|
||||
f : f32,
|
||||
}
|
||||
|
||||
struct tint_symbol_1 {
|
||||
arr : array<S>;
|
||||
arr : array<S>,
|
||||
}
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
|
@ -684,17 +684,17 @@ fn main() {
|
|||
@group(0) @binding(0) var<storage> buffer : array<S>;
|
||||
|
||||
struct S {
|
||||
f : f32;
|
||||
f : f32,
|
||||
};
|
||||
)";
|
||||
|
||||
auto* expect = R"(
|
||||
struct S {
|
||||
f : f32;
|
||||
f : f32,
|
||||
}
|
||||
|
||||
struct tint_symbol_1 {
|
||||
arr : array<S>;
|
||||
arr : array<S>,
|
||||
}
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
|
@ -711,7 +711,7 @@ fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_paramete
|
|||
TEST_F(ModuleScopeVarToEntryPointParamTest, Buffers_FunctionCalls) {
|
||||
auto* src = R"(
|
||||
struct S {
|
||||
a : f32;
|
||||
a : f32,
|
||||
};
|
||||
|
||||
@group(0) @binding(0)
|
||||
|
@ -742,7 +742,7 @@ fn main() {
|
|||
|
||||
auto* expect = R"(
|
||||
struct S {
|
||||
a : f32;
|
||||
a : f32,
|
||||
}
|
||||
|
||||
fn no_uses() {
|
||||
|
@ -794,7 +794,7 @@ fn bar(a : f32, b : f32) {
|
|||
}
|
||||
|
||||
struct S {
|
||||
a : f32;
|
||||
a : f32,
|
||||
};
|
||||
|
||||
@group(0) @binding(0)
|
||||
|
@ -825,7 +825,7 @@ fn bar(a : f32, b : f32, @internal(disable_validation__ignore_storage_class) @in
|
|||
}
|
||||
|
||||
struct S {
|
||||
a : f32;
|
||||
a : f32,
|
||||
}
|
||||
)";
|
||||
|
||||
|
@ -978,7 +978,7 @@ fn main() {
|
|||
|
||||
auto* expect = R"(
|
||||
struct tint_symbol_2 {
|
||||
m : mat2x2<f32>;
|
||||
m : mat2x2<f32>,
|
||||
}
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
|
@ -996,10 +996,10 @@ fn main(@internal(disable_validation__entry_point_parameter) tint_symbol_1 : ptr
|
|||
TEST_F(ModuleScopeVarToEntryPointParamTest, NestedMatrix) {
|
||||
auto* src = R"(
|
||||
struct S1 {
|
||||
m : mat2x2<f32>;
|
||||
m : mat2x2<f32>,
|
||||
};
|
||||
struct S2 {
|
||||
s : S1;
|
||||
s : S1,
|
||||
};
|
||||
var<workgroup> m : array<S2, 4>;
|
||||
|
||||
|
@ -1011,15 +1011,15 @@ fn main() {
|
|||
|
||||
auto* expect = R"(
|
||||
struct S1 {
|
||||
m : mat2x2<f32>;
|
||||
m : mat2x2<f32>,
|
||||
}
|
||||
|
||||
struct S2 {
|
||||
s : S1;
|
||||
s : S1,
|
||||
}
|
||||
|
||||
struct tint_symbol_2 {
|
||||
m : array<S2, 4u>;
|
||||
m : array<S2, 4u>,
|
||||
}
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
|
@ -1039,7 +1039,7 @@ fn main(@internal(disable_validation__entry_point_parameter) tint_symbol_1 : ptr
|
|||
TEST_F(ModuleScopeVarToEntryPointParamTest, DuplicateThreadgroupArgumentTypes) {
|
||||
auto* src = R"(
|
||||
struct S {
|
||||
m : mat2x2<f32>;
|
||||
m : mat2x2<f32>,
|
||||
};
|
||||
|
||||
var<workgroup> a : S;
|
||||
|
@ -1055,12 +1055,12 @@ fn main() {
|
|||
|
||||
auto* expect = R"(
|
||||
struct S {
|
||||
m : mat2x2<f32>;
|
||||
m : mat2x2<f32>,
|
||||
}
|
||||
|
||||
struct tint_symbol_3 {
|
||||
a : S;
|
||||
b : S;
|
||||
a : S,
|
||||
b : S,
|
||||
}
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
|
@ -1092,18 +1092,18 @@ var<workgroup> a : S;
|
|||
var<workgroup> b : S;
|
||||
|
||||
struct S {
|
||||
m : mat2x2<f32>;
|
||||
m : mat2x2<f32>,
|
||||
};
|
||||
)";
|
||||
|
||||
auto* expect = R"(
|
||||
struct S {
|
||||
m : mat2x2<f32>;
|
||||
m : mat2x2<f32>,
|
||||
}
|
||||
|
||||
struct tint_symbol_3 {
|
||||
a : S;
|
||||
b : S;
|
||||
a : S,
|
||||
b : S,
|
||||
}
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
|
@ -1123,7 +1123,7 @@ fn main(@internal(disable_validation__entry_point_parameter) tint_symbol_1 : ptr
|
|||
TEST_F(ModuleScopeVarToEntryPointParamTest, UnusedVariables) {
|
||||
auto* src = R"(
|
||||
struct S {
|
||||
a : f32;
|
||||
a : f32,
|
||||
};
|
||||
|
||||
var<private> p : f32;
|
||||
|
@ -1144,7 +1144,7 @@ fn main() {
|
|||
|
||||
auto* expect = R"(
|
||||
struct S {
|
||||
a : f32;
|
||||
a : f32,
|
||||
}
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
|
|
|
@ -108,11 +108,11 @@ fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
|
|||
|
||||
auto* expect = R"(
|
||||
struct ExternalTextureParams {
|
||||
numPlanes : u32;
|
||||
vr : f32;
|
||||
ug : f32;
|
||||
vg : f32;
|
||||
ub : f32;
|
||||
numPlanes : u32,
|
||||
vr : f32,
|
||||
ug : f32,
|
||||
vg : f32,
|
||||
ub : f32,
|
||||
}
|
||||
|
||||
@group(0) @binding(1) var ext_tex_plane_1 : texture_2d<f32>;
|
||||
|
@ -151,11 +151,11 @@ fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
|
|||
|
||||
auto* expect = R"(
|
||||
struct ExternalTextureParams {
|
||||
numPlanes : u32;
|
||||
vr : f32;
|
||||
ug : f32;
|
||||
vg : f32;
|
||||
ub : f32;
|
||||
numPlanes : u32,
|
||||
vr : f32,
|
||||
ug : f32,
|
||||
vg : f32,
|
||||
ub : f32,
|
||||
}
|
||||
|
||||
@group(0) @binding(1) var ext_tex_plane_1 : texture_2d<f32>;
|
||||
|
@ -193,11 +193,11 @@ fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
|
|||
|
||||
auto* expect = R"(
|
||||
struct ExternalTextureParams {
|
||||
numPlanes : u32;
|
||||
vr : f32;
|
||||
ug : f32;
|
||||
vg : f32;
|
||||
ub : f32;
|
||||
numPlanes : u32,
|
||||
vr : f32,
|
||||
ug : f32,
|
||||
vg : f32,
|
||||
ub : f32,
|
||||
}
|
||||
|
||||
@group(0) @binding(2) var ext_tex_plane_1 : texture_2d<f32>;
|
||||
|
@ -249,11 +249,11 @@ fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
|
|||
|
||||
auto* expect = R"(
|
||||
struct ExternalTextureParams {
|
||||
numPlanes : u32;
|
||||
vr : f32;
|
||||
ug : f32;
|
||||
vg : f32;
|
||||
ub : f32;
|
||||
numPlanes : u32,
|
||||
vr : f32,
|
||||
ug : f32,
|
||||
vg : f32,
|
||||
ub : f32,
|
||||
}
|
||||
|
||||
@group(0) @binding(2) var ext_tex_plane_1 : texture_2d<f32>;
|
||||
|
@ -304,11 +304,11 @@ fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
|
|||
|
||||
auto* expect = R"(
|
||||
struct ExternalTextureParams {
|
||||
numPlanes : u32;
|
||||
vr : f32;
|
||||
ug : f32;
|
||||
vg : f32;
|
||||
ub : f32;
|
||||
numPlanes : u32,
|
||||
vr : f32,
|
||||
ug : f32,
|
||||
vg : f32,
|
||||
ub : f32,
|
||||
}
|
||||
|
||||
@group(0) @binding(1) var ext_tex_plane_1 : texture_2d<f32>;
|
||||
|
@ -357,11 +357,11 @@ fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
|
|||
|
||||
auto* expect = R"(
|
||||
struct ExternalTextureParams {
|
||||
numPlanes : u32;
|
||||
vr : f32;
|
||||
ug : f32;
|
||||
vg : f32;
|
||||
ub : f32;
|
||||
numPlanes : u32,
|
||||
vr : f32,
|
||||
ug : f32,
|
||||
vg : f32,
|
||||
ub : f32,
|
||||
}
|
||||
|
||||
@group(0) @binding(1) var ext_tex_plane_1 : texture_2d<f32>;
|
||||
|
@ -412,11 +412,11 @@ fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
|
|||
|
||||
auto* expect = R"(
|
||||
struct ExternalTextureParams {
|
||||
numPlanes : u32;
|
||||
vr : f32;
|
||||
ug : f32;
|
||||
vg : f32;
|
||||
ub : f32;
|
||||
numPlanes : u32,
|
||||
vr : f32,
|
||||
ug : f32,
|
||||
vg : f32,
|
||||
ub : f32,
|
||||
}
|
||||
|
||||
@group(0) @binding(2) var ext_tex_plane_1 : texture_2d<f32>;
|
||||
|
@ -483,11 +483,11 @@ fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
|
|||
|
||||
auto* expect = R"(
|
||||
struct ExternalTextureParams {
|
||||
numPlanes : u32;
|
||||
vr : f32;
|
||||
ug : f32;
|
||||
vg : f32;
|
||||
ub : f32;
|
||||
numPlanes : u32,
|
||||
vr : f32,
|
||||
ug : f32,
|
||||
vg : f32,
|
||||
ub : f32,
|
||||
}
|
||||
|
||||
@group(0) @binding(2) var ext_tex_plane_1 : texture_2d<f32>;
|
||||
|
@ -556,11 +556,11 @@ fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
|
|||
|
||||
auto* expect = R"(
|
||||
struct ExternalTextureParams {
|
||||
numPlanes : u32;
|
||||
vr : f32;
|
||||
ug : f32;
|
||||
vg : f32;
|
||||
ub : f32;
|
||||
numPlanes : u32,
|
||||
vr : f32,
|
||||
ug : f32,
|
||||
vg : f32,
|
||||
ub : f32,
|
||||
}
|
||||
|
||||
@group(0) @binding(4) var ext_tex_plane_1 : texture_2d<f32>;
|
||||
|
@ -640,11 +640,11 @@ fn main() {
|
|||
|
||||
auto* expect = R"(
|
||||
struct ExternalTextureParams {
|
||||
numPlanes : u32;
|
||||
vr : f32;
|
||||
ug : f32;
|
||||
vg : f32;
|
||||
ub : f32;
|
||||
numPlanes : u32,
|
||||
vr : f32,
|
||||
ug : f32,
|
||||
vg : f32,
|
||||
ub : f32,
|
||||
}
|
||||
|
||||
@group(0) @binding(2) var ext_tex_plane_1 : texture_2d<f32>;
|
||||
|
@ -707,11 +707,11 @@ fn f(t : texture_external, s : sampler) {
|
|||
|
||||
auto* expect = R"(
|
||||
struct ExternalTextureParams {
|
||||
numPlanes : u32;
|
||||
vr : f32;
|
||||
ug : f32;
|
||||
vg : f32;
|
||||
ub : f32;
|
||||
numPlanes : u32,
|
||||
vr : f32,
|
||||
ug : f32,
|
||||
vg : f32,
|
||||
ub : f32,
|
||||
}
|
||||
|
||||
@group(0) @binding(2) var ext_tex_plane_1 : texture_2d<f32>;
|
||||
|
@ -773,11 +773,11 @@ fn main() {
|
|||
|
||||
auto* expect = R"(
|
||||
struct ExternalTextureParams {
|
||||
numPlanes : u32;
|
||||
vr : f32;
|
||||
ug : f32;
|
||||
vg : f32;
|
||||
ub : f32;
|
||||
numPlanes : u32,
|
||||
vr : f32,
|
||||
ug : f32,
|
||||
vg : f32,
|
||||
ub : f32,
|
||||
}
|
||||
|
||||
@group(0) @binding(2) var ext_tex_plane_1 : texture_2d<f32>;
|
||||
|
@ -841,11 +841,11 @@ fn main() {
|
|||
|
||||
auto* expect = R"(
|
||||
struct ExternalTextureParams {
|
||||
numPlanes : u32;
|
||||
vr : f32;
|
||||
ug : f32;
|
||||
vg : f32;
|
||||
ub : f32;
|
||||
numPlanes : u32,
|
||||
vr : f32,
|
||||
ug : f32,
|
||||
vg : f32,
|
||||
ub : f32,
|
||||
}
|
||||
|
||||
@group(0) @binding(3) var ext_tex_plane_1 : texture_2d<f32>;
|
||||
|
@ -919,11 +919,11 @@ fn f(t : texture_external, s : sampler, t2 : texture_external) {
|
|||
|
||||
auto* expect = R"(
|
||||
struct ExternalTextureParams {
|
||||
numPlanes : u32;
|
||||
vr : f32;
|
||||
ug : f32;
|
||||
vg : f32;
|
||||
ub : f32;
|
||||
numPlanes : u32,
|
||||
vr : f32,
|
||||
ug : f32,
|
||||
vg : f32,
|
||||
ub : f32,
|
||||
}
|
||||
|
||||
@group(0) @binding(3) var ext_tex_plane_1 : texture_2d<f32>;
|
||||
|
@ -997,11 +997,11 @@ fn main() {
|
|||
|
||||
auto* expect = R"(
|
||||
struct ExternalTextureParams {
|
||||
numPlanes : u32;
|
||||
vr : f32;
|
||||
ug : f32;
|
||||
vg : f32;
|
||||
ub : f32;
|
||||
numPlanes : u32,
|
||||
vr : f32,
|
||||
ug : f32,
|
||||
vg : f32,
|
||||
ub : f32,
|
||||
}
|
||||
|
||||
@group(0) @binding(2) var ext_tex_plane_1 : texture_2d<f32>;
|
||||
|
@ -1072,11 +1072,11 @@ fn main() {
|
|||
|
||||
auto* expect = R"(
|
||||
struct ExternalTextureParams {
|
||||
numPlanes : u32;
|
||||
vr : f32;
|
||||
ug : f32;
|
||||
vg : f32;
|
||||
ub : f32;
|
||||
numPlanes : u32,
|
||||
vr : f32,
|
||||
ug : f32,
|
||||
vg : f32,
|
||||
ub : f32,
|
||||
}
|
||||
|
||||
@group(0) @binding(2) var ext_tex_plane_1 : texture_2d<f32>;
|
||||
|
@ -1135,11 +1135,11 @@ fn f(ext_tex : texture_external) -> vec2<i32> {
|
|||
|
||||
auto* expect = R"(
|
||||
struct ExternalTextureParams {
|
||||
numPlanes : u32;
|
||||
vr : f32;
|
||||
ug : f32;
|
||||
vg : f32;
|
||||
ub : f32;
|
||||
numPlanes : u32,
|
||||
vr : f32,
|
||||
ug : f32,
|
||||
vg : f32,
|
||||
ub : f32,
|
||||
}
|
||||
|
||||
fn f(ext_tex : texture_2d<f32>, ext_tex_plane_1 : texture_2d<f32>, ext_tex_params : ExternalTextureParams) -> vec2<i32> {
|
||||
|
@ -1174,11 +1174,11 @@ fn main() {
|
|||
|
||||
auto* expect = R"(
|
||||
struct ExternalTextureParams {
|
||||
numPlanes : u32;
|
||||
vr : f32;
|
||||
ug : f32;
|
||||
vg : f32;
|
||||
ub : f32;
|
||||
numPlanes : u32,
|
||||
vr : f32,
|
||||
ug : f32,
|
||||
vg : f32,
|
||||
ub : f32,
|
||||
}
|
||||
|
||||
@group(0) @binding(2) var ext_tex_plane_1 : texture_2d<f32>;
|
||||
|
@ -1243,11 +1243,11 @@ type ET = texture_external;
|
|||
|
||||
auto* expect = R"(
|
||||
struct ExternalTextureParams {
|
||||
numPlanes : u32;
|
||||
vr : f32;
|
||||
ug : f32;
|
||||
vg : f32;
|
||||
ub : f32;
|
||||
numPlanes : u32,
|
||||
vr : f32,
|
||||
ug : f32,
|
||||
vg : f32,
|
||||
ub : f32,
|
||||
}
|
||||
|
||||
@group(0) @binding(2) var ext_tex_plane_1 : texture_2d<f32>;
|
||||
|
|
|
@ -74,7 +74,7 @@ fn main(@builtin(num_workgroups) num_wgs : vec3<u32>) {
|
|||
|
||||
auto* expect = R"(
|
||||
struct tint_symbol_2 {
|
||||
num_workgroups : vec3<u32>;
|
||||
num_workgroups : vec3<u32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(30) var<uniform> tint_symbol_3 : tint_symbol_2;
|
||||
|
@ -103,7 +103,7 @@ fn main() {
|
|||
TEST_F(NumWorkgroupsFromUniformTest, StructOnlyMember) {
|
||||
auto* src = R"(
|
||||
struct Builtins {
|
||||
@builtin(num_workgroups) num_wgs : vec3<u32>;
|
||||
@builtin(num_workgroups) num_wgs : vec3<u32>,
|
||||
};
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
|
@ -116,13 +116,13 @@ fn main(in : Builtins) {
|
|||
|
||||
auto* expect = R"(
|
||||
struct tint_symbol_2 {
|
||||
num_workgroups : vec3<u32>;
|
||||
num_workgroups : vec3<u32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(30) var<uniform> tint_symbol_3 : tint_symbol_2;
|
||||
|
||||
struct Builtins {
|
||||
num_wgs : vec3<u32>;
|
||||
num_wgs : vec3<u32>,
|
||||
}
|
||||
|
||||
fn main_inner(in : Builtins) {
|
||||
|
@ -156,13 +156,13 @@ fn main(in : Builtins) {
|
|||
}
|
||||
|
||||
struct Builtins {
|
||||
@builtin(num_workgroups) num_wgs : vec3<u32>;
|
||||
@builtin(num_workgroups) num_wgs : vec3<u32>,
|
||||
};
|
||||
)";
|
||||
|
||||
auto* expect = R"(
|
||||
struct tint_symbol_2 {
|
||||
num_workgroups : vec3<u32>;
|
||||
num_workgroups : vec3<u32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(30) var<uniform> tint_symbol_3 : tint_symbol_2;
|
||||
|
@ -179,7 +179,7 @@ fn main() {
|
|||
}
|
||||
|
||||
struct Builtins {
|
||||
num_wgs : vec3<u32>;
|
||||
num_wgs : vec3<u32>,
|
||||
}
|
||||
)";
|
||||
|
||||
|
@ -195,9 +195,9 @@ struct Builtins {
|
|||
TEST_F(NumWorkgroupsFromUniformTest, StructMultipleMembers) {
|
||||
auto* src = R"(
|
||||
struct Builtins {
|
||||
@builtin(global_invocation_id) gid : vec3<u32>;
|
||||
@builtin(num_workgroups) num_wgs : vec3<u32>;
|
||||
@builtin(workgroup_id) wgid : vec3<u32>;
|
||||
@builtin(global_invocation_id) gid : vec3<u32>,
|
||||
@builtin(num_workgroups) num_wgs : vec3<u32>,
|
||||
@builtin(workgroup_id) wgid : vec3<u32>,
|
||||
};
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
|
@ -210,22 +210,22 @@ fn main(in : Builtins) {
|
|||
|
||||
auto* expect = R"(
|
||||
struct tint_symbol_2 {
|
||||
num_workgroups : vec3<u32>;
|
||||
num_workgroups : vec3<u32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(30) var<uniform> tint_symbol_3 : tint_symbol_2;
|
||||
|
||||
struct Builtins {
|
||||
gid : vec3<u32>;
|
||||
num_wgs : vec3<u32>;
|
||||
wgid : vec3<u32>;
|
||||
gid : vec3<u32>,
|
||||
num_wgs : vec3<u32>,
|
||||
wgid : vec3<u32>,
|
||||
}
|
||||
|
||||
struct tint_symbol_1 {
|
||||
@builtin(global_invocation_id)
|
||||
gid : vec3<u32>;
|
||||
gid : vec3<u32>,
|
||||
@builtin(workgroup_id)
|
||||
wgid : vec3<u32>;
|
||||
wgid : vec3<u32>,
|
||||
}
|
||||
|
||||
fn main_inner(in : Builtins) {
|
||||
|
@ -259,25 +259,25 @@ fn main(in : Builtins) {
|
|||
}
|
||||
|
||||
struct Builtins {
|
||||
@builtin(global_invocation_id) gid : vec3<u32>;
|
||||
@builtin(num_workgroups) num_wgs : vec3<u32>;
|
||||
@builtin(workgroup_id) wgid : vec3<u32>;
|
||||
@builtin(global_invocation_id) gid : vec3<u32>,
|
||||
@builtin(num_workgroups) num_wgs : vec3<u32>,
|
||||
@builtin(workgroup_id) wgid : vec3<u32>,
|
||||
};
|
||||
|
||||
)";
|
||||
|
||||
auto* expect = R"(
|
||||
struct tint_symbol_2 {
|
||||
num_workgroups : vec3<u32>;
|
||||
num_workgroups : vec3<u32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(30) var<uniform> tint_symbol_3 : tint_symbol_2;
|
||||
|
||||
struct tint_symbol_1 {
|
||||
@builtin(global_invocation_id)
|
||||
gid : vec3<u32>;
|
||||
gid : vec3<u32>,
|
||||
@builtin(workgroup_id)
|
||||
wgid : vec3<u32>;
|
||||
wgid : vec3<u32>,
|
||||
}
|
||||
|
||||
fn main_inner(in : Builtins) {
|
||||
|
@ -292,9 +292,9 @@ fn main(tint_symbol : tint_symbol_1) {
|
|||
}
|
||||
|
||||
struct Builtins {
|
||||
gid : vec3<u32>;
|
||||
num_wgs : vec3<u32>;
|
||||
wgid : vec3<u32>;
|
||||
gid : vec3<u32>,
|
||||
num_wgs : vec3<u32>,
|
||||
wgid : vec3<u32>,
|
||||
}
|
||||
)";
|
||||
|
||||
|
@ -310,13 +310,13 @@ struct Builtins {
|
|||
TEST_F(NumWorkgroupsFromUniformTest, MultipleEntryPoints) {
|
||||
auto* src = R"(
|
||||
struct Builtins1 {
|
||||
@builtin(num_workgroups) num_wgs : vec3<u32>;
|
||||
@builtin(num_workgroups) num_wgs : vec3<u32>,
|
||||
};
|
||||
|
||||
struct Builtins2 {
|
||||
@builtin(global_invocation_id) gid : vec3<u32>;
|
||||
@builtin(num_workgroups) num_wgs : vec3<u32>;
|
||||
@builtin(workgroup_id) wgid : vec3<u32>;
|
||||
@builtin(global_invocation_id) gid : vec3<u32>,
|
||||
@builtin(num_workgroups) num_wgs : vec3<u32>,
|
||||
@builtin(workgroup_id) wgid : vec3<u32>,
|
||||
};
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
|
@ -343,19 +343,19 @@ fn main3(@builtin(num_workgroups) num_wgs : vec3<u32>) {
|
|||
|
||||
auto* expect = R"(
|
||||
struct tint_symbol_6 {
|
||||
num_workgroups : vec3<u32>;
|
||||
num_workgroups : vec3<u32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(30) var<uniform> tint_symbol_7 : tint_symbol_6;
|
||||
|
||||
struct Builtins1 {
|
||||
num_wgs : vec3<u32>;
|
||||
num_wgs : vec3<u32>,
|
||||
}
|
||||
|
||||
struct Builtins2 {
|
||||
gid : vec3<u32>;
|
||||
num_wgs : vec3<u32>;
|
||||
wgid : vec3<u32>;
|
||||
gid : vec3<u32>,
|
||||
num_wgs : vec3<u32>,
|
||||
wgid : vec3<u32>,
|
||||
}
|
||||
|
||||
fn main1_inner(in : Builtins1) {
|
||||
|
@ -371,9 +371,9 @@ fn main1() {
|
|||
|
||||
struct tint_symbol_3 {
|
||||
@builtin(global_invocation_id)
|
||||
gid : vec3<u32>;
|
||||
gid : vec3<u32>,
|
||||
@builtin(workgroup_id)
|
||||
wgid : vec3<u32>;
|
||||
wgid : vec3<u32>,
|
||||
}
|
||||
|
||||
fn main2_inner(in : Builtins2) {
|
||||
|
@ -411,8 +411,8 @@ fn main3() {
|
|||
TEST_F(NumWorkgroupsFromUniformTest, NoUsages) {
|
||||
auto* src = R"(
|
||||
struct Builtins {
|
||||
@builtin(global_invocation_id) gid : vec3<u32>;
|
||||
@builtin(workgroup_id) wgid : vec3<u32>;
|
||||
@builtin(global_invocation_id) gid : vec3<u32>,
|
||||
@builtin(workgroup_id) wgid : vec3<u32>,
|
||||
};
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
|
@ -422,15 +422,15 @@ fn main(in : Builtins) {
|
|||
|
||||
auto* expect = R"(
|
||||
struct Builtins {
|
||||
gid : vec3<u32>;
|
||||
wgid : vec3<u32>;
|
||||
gid : vec3<u32>,
|
||||
wgid : vec3<u32>,
|
||||
}
|
||||
|
||||
struct tint_symbol_1 {
|
||||
@builtin(global_invocation_id)
|
||||
gid : vec3<u32>;
|
||||
gid : vec3<u32>,
|
||||
@builtin(workgroup_id)
|
||||
wgid : vec3<u32>;
|
||||
wgid : vec3<u32>,
|
||||
}
|
||||
|
||||
fn main_inner(in : Builtins) {
|
||||
|
|
|
@ -62,9 +62,9 @@ fn f() {
|
|||
TEST_F(PromoteInitializersToConstVarTest, BasicStruct) {
|
||||
auto* src = R"(
|
||||
struct S {
|
||||
a : i32;
|
||||
b : f32;
|
||||
c : vec3<f32>;
|
||||
a : i32,
|
||||
b : f32,
|
||||
c : vec3<f32>,
|
||||
};
|
||||
|
||||
fn f() {
|
||||
|
@ -74,9 +74,9 @@ fn f() {
|
|||
|
||||
auto* expect = R"(
|
||||
struct S {
|
||||
a : i32;
|
||||
b : f32;
|
||||
c : vec3<f32>;
|
||||
a : i32,
|
||||
b : f32,
|
||||
c : vec3<f32>,
|
||||
}
|
||||
|
||||
fn f() {
|
||||
|
@ -98,9 +98,9 @@ fn f() {
|
|||
}
|
||||
|
||||
struct S {
|
||||
a : i32;
|
||||
b : f32;
|
||||
c : vec3<f32>;
|
||||
a : i32,
|
||||
b : f32,
|
||||
c : vec3<f32>,
|
||||
};
|
||||
)";
|
||||
|
||||
|
@ -111,9 +111,9 @@ fn f() {
|
|||
}
|
||||
|
||||
struct S {
|
||||
a : i32;
|
||||
b : f32;
|
||||
c : vec3<f32>;
|
||||
a : i32,
|
||||
b : f32,
|
||||
c : vec3<f32>,
|
||||
}
|
||||
)";
|
||||
|
||||
|
@ -152,9 +152,9 @@ fn f() {
|
|||
TEST_F(PromoteInitializersToConstVarTest, StructInForLoopInit) {
|
||||
auto* src = R"(
|
||||
struct S {
|
||||
a : i32;
|
||||
b : f32;
|
||||
c : vec3<f32>;
|
||||
a : i32,
|
||||
b : f32,
|
||||
c : vec3<f32>,
|
||||
};
|
||||
|
||||
fn f() {
|
||||
|
@ -167,9 +167,9 @@ fn f() {
|
|||
|
||||
auto* expect = R"(
|
||||
struct S {
|
||||
a : i32;
|
||||
b : f32;
|
||||
c : vec3<f32>;
|
||||
a : i32,
|
||||
b : f32,
|
||||
c : vec3<f32>,
|
||||
}
|
||||
|
||||
fn f() {
|
||||
|
@ -197,9 +197,9 @@ fn f() {
|
|||
}
|
||||
|
||||
struct S {
|
||||
a : i32;
|
||||
b : f32;
|
||||
c : vec3<f32>;
|
||||
a : i32,
|
||||
b : f32,
|
||||
c : vec3<f32>,
|
||||
};
|
||||
)";
|
||||
|
||||
|
@ -213,9 +213,9 @@ fn f() {
|
|||
}
|
||||
|
||||
struct S {
|
||||
a : i32;
|
||||
b : f32;
|
||||
c : vec3<f32>;
|
||||
a : i32,
|
||||
b : f32,
|
||||
c : vec3<f32>,
|
||||
}
|
||||
)";
|
||||
|
||||
|
@ -443,17 +443,17 @@ fn f() {
|
|||
TEST_F(PromoteInitializersToConstVarTest, StructNested) {
|
||||
auto* src = R"(
|
||||
struct S1 {
|
||||
a : i32;
|
||||
a : i32,
|
||||
};
|
||||
|
||||
struct S2 {
|
||||
a : i32;
|
||||
b : S1;
|
||||
c : i32;
|
||||
a : i32,
|
||||
b : S1,
|
||||
c : i32,
|
||||
};
|
||||
|
||||
struct S3 {
|
||||
a : S2;
|
||||
a : S2,
|
||||
};
|
||||
|
||||
fn f() {
|
||||
|
@ -463,17 +463,17 @@ fn f() {
|
|||
|
||||
auto* expect = R"(
|
||||
struct S1 {
|
||||
a : i32;
|
||||
a : i32,
|
||||
}
|
||||
|
||||
struct S2 {
|
||||
a : i32;
|
||||
b : S1;
|
||||
c : i32;
|
||||
a : i32,
|
||||
b : S1,
|
||||
c : i32,
|
||||
}
|
||||
|
||||
struct S3 {
|
||||
a : S2;
|
||||
a : S2,
|
||||
}
|
||||
|
||||
fn f() {
|
||||
|
@ -493,11 +493,11 @@ fn f() {
|
|||
TEST_F(PromoteInitializersToConstVarTest, Mixed) {
|
||||
auto* src = R"(
|
||||
struct S1 {
|
||||
a : i32;
|
||||
a : i32,
|
||||
};
|
||||
|
||||
struct S2 {
|
||||
a : array<S1, 3u>;
|
||||
a : array<S1, 3u>,
|
||||
};
|
||||
|
||||
fn f() {
|
||||
|
@ -507,11 +507,11 @@ fn f() {
|
|||
|
||||
auto* expect = R"(
|
||||
struct S1 {
|
||||
a : i32;
|
||||
a : i32,
|
||||
}
|
||||
|
||||
struct S2 {
|
||||
a : array<S1, 3u>;
|
||||
a : array<S1, 3u>,
|
||||
}
|
||||
|
||||
fn f() {
|
||||
|
@ -537,11 +537,11 @@ fn f() {
|
|||
}
|
||||
|
||||
struct S2 {
|
||||
a : array<S1, 3u>;
|
||||
a : array<S1, 3u>,
|
||||
};
|
||||
|
||||
struct S1 {
|
||||
a : i32;
|
||||
a : i32,
|
||||
};
|
||||
)";
|
||||
|
||||
|
@ -556,11 +556,11 @@ fn f() {
|
|||
}
|
||||
|
||||
struct S2 {
|
||||
a : array<S1, 3u>;
|
||||
a : array<S1, 3u>,
|
||||
}
|
||||
|
||||
struct S1 {
|
||||
a : i32;
|
||||
a : i32,
|
||||
}
|
||||
)";
|
||||
|
||||
|
@ -573,9 +573,9 @@ struct S1 {
|
|||
TEST_F(PromoteInitializersToConstVarTest, NoChangeOnVarDecl) {
|
||||
auto* src = R"(
|
||||
struct S {
|
||||
a : i32;
|
||||
b : f32;
|
||||
c : i32;
|
||||
a : i32,
|
||||
b : f32,
|
||||
c : i32,
|
||||
}
|
||||
|
||||
fn f() {
|
||||
|
@ -606,9 +606,9 @@ fn f() {
|
|||
let module_str : S = S(1, 2.0, 3);
|
||||
|
||||
struct S {
|
||||
a : i32;
|
||||
b : f32;
|
||||
c : i32;
|
||||
a : i32,
|
||||
b : f32,
|
||||
c : i32,
|
||||
}
|
||||
|
||||
let module_arr : array<f32, 4u> = array<f32, 4u>(0.0, 1.0, 2.0, 3.0);
|
||||
|
|
|
@ -444,7 +444,7 @@ fn main() {
|
|||
TEST_F(PromoteSideEffectsToDeclTest, Binary_Arith_Builtins_WithSE) {
|
||||
auto* src = R"(
|
||||
struct SB {
|
||||
a : atomic<i32>;
|
||||
a : atomic<i32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage, read_write> sb : SB;
|
||||
|
@ -457,7 +457,7 @@ fn f() {
|
|||
|
||||
auto* expect = R"(
|
||||
struct SB {
|
||||
a : atomic<i32>;
|
||||
a : atomic<i32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage, read_write> sb : SB;
|
||||
|
@ -478,7 +478,7 @@ fn f() {
|
|||
TEST_F(PromoteSideEffectsToDeclTest, Binary_Arith_Builtins_NoSEAndVar) {
|
||||
auto* src = R"(
|
||||
struct SB {
|
||||
a : atomic<i32>;
|
||||
a : atomic<i32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage, read_write> sb : SB;
|
||||
|
@ -500,7 +500,7 @@ fn f() {
|
|||
TEST_F(PromoteSideEffectsToDeclTest, Binary_Arith_Builtins_NoSEAndSE) {
|
||||
auto* src = R"(
|
||||
struct SB {
|
||||
a : atomic<i32>;
|
||||
a : atomic<i32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage, read_write> sb : SB;
|
||||
|
@ -517,7 +517,7 @@ fn f() {
|
|||
|
||||
auto* expect = R"(
|
||||
struct SB {
|
||||
a : atomic<i32>;
|
||||
a : atomic<i32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage, read_write> sb : SB;
|
||||
|
@ -728,7 +728,7 @@ TEST_F(PromoteSideEffectsToDeclTest, Binary_Arith_InMemberAccessor) {
|
|||
auto* src = R"(
|
||||
|
||||
struct S {
|
||||
v : i32;
|
||||
v : i32,
|
||||
}
|
||||
|
||||
fn a(i : i32) -> S {
|
||||
|
@ -743,7 +743,7 @@ fn f() {
|
|||
|
||||
auto* expect = R"(
|
||||
struct S {
|
||||
v : i32;
|
||||
v : i32,
|
||||
}
|
||||
|
||||
fn a(i : i32) -> S {
|
||||
|
@ -2002,7 +2002,7 @@ TEST_F(PromoteSideEffectsToDeclTest, Binary_Logical_InMemberAccessor) {
|
|||
auto* src = R"(
|
||||
|
||||
struct S {
|
||||
v : bool;
|
||||
v : bool,
|
||||
}
|
||||
|
||||
fn a(i : i32) -> S {
|
||||
|
@ -2017,7 +2017,7 @@ fn f() {
|
|||
|
||||
auto* expect = R"(
|
||||
struct S {
|
||||
v : bool;
|
||||
v : bool,
|
||||
}
|
||||
|
||||
fn a(i : i32) -> S {
|
||||
|
@ -2961,9 +2961,9 @@ fn a(i : i32) -> i32 {
|
|||
}
|
||||
|
||||
struct S {
|
||||
x : i32;
|
||||
y : i32;
|
||||
z : i32;
|
||||
x : i32,
|
||||
y : i32,
|
||||
z : i32,
|
||||
}
|
||||
|
||||
fn f() {
|
||||
|
@ -2977,9 +2977,9 @@ fn a(i : i32) -> i32 {
|
|||
}
|
||||
|
||||
struct S {
|
||||
x : i32;
|
||||
y : i32;
|
||||
z : i32;
|
||||
x : i32,
|
||||
y : i32,
|
||||
z : i32,
|
||||
}
|
||||
|
||||
fn f() {
|
||||
|
@ -3091,8 +3091,8 @@ fn f() {
|
|||
TEST_F(PromoteSideEffectsToDeclTest, MemberAccessor_Struct) {
|
||||
auto* src = R"(
|
||||
struct S {
|
||||
x : i32;
|
||||
y : i32;
|
||||
x : i32,
|
||||
y : i32,
|
||||
}
|
||||
|
||||
fn a(i : i32) -> S {
|
||||
|
@ -3106,8 +3106,8 @@ fn f() {
|
|||
|
||||
auto* expect = R"(
|
||||
struct S {
|
||||
x : i32;
|
||||
y : i32;
|
||||
x : i32,
|
||||
y : i32,
|
||||
}
|
||||
|
||||
fn a(i : i32) -> S {
|
||||
|
@ -3130,9 +3130,9 @@ fn f() {
|
|||
TEST_F(PromoteSideEffectsToDeclTest, MemberAccessor_Struct_Mixed) {
|
||||
auto* src = R"(
|
||||
struct S {
|
||||
x : i32;
|
||||
y : i32;
|
||||
arr : array<i32, 10>;
|
||||
x : i32,
|
||||
y : i32,
|
||||
arr : array<i32, 10>,
|
||||
}
|
||||
|
||||
fn a(i : i32) -> S {
|
||||
|
@ -3155,9 +3155,9 @@ fn f() {
|
|||
|
||||
auto* expect = R"(
|
||||
struct S {
|
||||
x : i32;
|
||||
y : i32;
|
||||
arr : array<i32, 10>;
|
||||
x : i32,
|
||||
y : i32,
|
||||
arr : array<i32, 10>,
|
||||
}
|
||||
|
||||
fn a(i : i32) -> S {
|
||||
|
|
|
@ -295,7 +295,7 @@ fn xor(a : u32, b : u32) -> u32 {
|
|||
TEST_F(RemovePhoniesTest, ForLoop) {
|
||||
auto* src = R"(
|
||||
struct S {
|
||||
arr : array<i32>;
|
||||
arr : array<i32>,
|
||||
};
|
||||
|
||||
@group(0) @binding(0) var<storage, read_write> s : S;
|
||||
|
@ -324,7 +324,7 @@ fn f() {
|
|||
|
||||
auto* expect = R"(
|
||||
struct S {
|
||||
arr : array<i32>;
|
||||
arr : array<i32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage, read_write> s : S;
|
||||
|
@ -383,7 +383,7 @@ fn z() -> i32 {
|
|||
}
|
||||
|
||||
struct S {
|
||||
arr : array<i32>;
|
||||
arr : array<i32>,
|
||||
};
|
||||
|
||||
@group(0) @binding(0) var<storage, read_write> s : S;
|
||||
|
@ -415,7 +415,7 @@ fn z() -> i32 {
|
|||
}
|
||||
|
||||
struct S {
|
||||
arr : array<i32>;
|
||||
arr : array<i32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage, read_write> s : S;
|
||||
|
|
|
@ -323,8 +323,8 @@ var<private> a : array<f32, 3>;
|
|||
TEST_F(RobustnessTest, DISABLED_LargeArrays_Idx) {
|
||||
auto* src = R"(
|
||||
struct S {
|
||||
a : array<f32, 0x7fffffff>;
|
||||
b : array<f32>;
|
||||
a : array<f32, 0x7fffffff>,
|
||||
b : array<f32>,
|
||||
};
|
||||
@group(0) @binding(0) var<storage, read> s : S;
|
||||
|
||||
|
@ -361,8 +361,8 @@ fn f() {
|
|||
|
||||
auto* expect = R"(
|
||||
struct S {
|
||||
a : array<f32, 2147483647>;
|
||||
b : array<f32>;
|
||||
a : array<f32, 2147483647>,
|
||||
b : array<f32>,
|
||||
};
|
||||
|
||||
@group(0) @binding(0) var<storage, read> s : S;
|
||||
|
@ -1093,8 +1093,8 @@ TEST_F(RobustnessTest, DISABLED_Matrix_Row_Constant_Id_Clamps) {
|
|||
TEST_F(RobustnessTest, RuntimeArray_Clamps) {
|
||||
auto* src = R"(
|
||||
struct S {
|
||||
a : f32;
|
||||
b : array<f32>;
|
||||
a : f32,
|
||||
b : array<f32>,
|
||||
};
|
||||
@group(0) @binding(0) var<storage, read> s : S;
|
||||
|
||||
|
@ -1105,8 +1105,8 @@ fn f() {
|
|||
|
||||
auto* expect = R"(
|
||||
struct S {
|
||||
a : f32;
|
||||
b : array<f32>;
|
||||
a : f32,
|
||||
b : array<f32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage, read> s : S;
|
||||
|
@ -1130,8 +1130,8 @@ fn f() {
|
|||
@group(0) @binding(0) var<storage, read> s : S;
|
||||
|
||||
struct S {
|
||||
a : f32;
|
||||
b : array<f32>;
|
||||
a : f32,
|
||||
b : array<f32>,
|
||||
};
|
||||
)";
|
||||
|
||||
|
@ -1143,8 +1143,8 @@ fn f() {
|
|||
@group(0) @binding(0) var<storage, read> s : S;
|
||||
|
||||
struct S {
|
||||
a : f32;
|
||||
b : array<f32>;
|
||||
a : f32,
|
||||
b : array<f32>,
|
||||
}
|
||||
)";
|
||||
|
||||
|
@ -1387,8 +1387,8 @@ TEST_F(RobustnessTest, DISABLED_Shadowed_Variable) {
|
|||
TEST_F(RobustnessTest, DontRenameSymbols) {
|
||||
auto* src = R"(
|
||||
struct S {
|
||||
a : f32;
|
||||
b : array<f32>;
|
||||
a : f32,
|
||||
b : array<f32>,
|
||||
};
|
||||
|
||||
@group(0) @binding(0) var<storage, read> s : S;
|
||||
|
@ -1404,8 +1404,8 @@ fn f() {
|
|||
|
||||
auto* expect = R"(
|
||||
struct S {
|
||||
a : f32;
|
||||
b : array<f32>;
|
||||
a : f32,
|
||||
b : array<f32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage, read> s : S;
|
||||
|
@ -1426,14 +1426,14 @@ fn f() {
|
|||
|
||||
const char* kOmitSourceShader = R"(
|
||||
struct S {
|
||||
a : array<f32, 4>;
|
||||
b : array<f32>;
|
||||
a : array<f32, 4>,
|
||||
b : array<f32>,
|
||||
};
|
||||
@group(0) @binding(0) var<storage, read> s : S;
|
||||
|
||||
type UArr = array<vec4<f32>, 4>;
|
||||
struct U {
|
||||
a : UArr;
|
||||
a : UArr,
|
||||
};
|
||||
@group(1) @binding(0) var<uniform> u : U;
|
||||
|
||||
|
@ -1484,8 +1484,8 @@ fn f() {
|
|||
TEST_F(RobustnessTest, OmitNone) {
|
||||
auto* expect = R"(
|
||||
struct S {
|
||||
a : array<f32, 4>;
|
||||
b : array<f32>;
|
||||
a : array<f32, 4>,
|
||||
b : array<f32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage, read> s : S;
|
||||
|
@ -1493,7 +1493,7 @@ struct S {
|
|||
type UArr = array<vec4<f32>, 4>;
|
||||
|
||||
struct U {
|
||||
a : UArr;
|
||||
a : UArr,
|
||||
}
|
||||
|
||||
@group(1) @binding(0) var<uniform> u : U;
|
||||
|
@ -1547,8 +1547,8 @@ fn f() {
|
|||
TEST_F(RobustnessTest, OmitStorage) {
|
||||
auto* expect = R"(
|
||||
struct S {
|
||||
a : array<f32, 4>;
|
||||
b : array<f32>;
|
||||
a : array<f32, 4>,
|
||||
b : array<f32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage, read> s : S;
|
||||
|
@ -1556,7 +1556,7 @@ struct S {
|
|||
type UArr = array<vec4<f32>, 4>;
|
||||
|
||||
struct U {
|
||||
a : UArr;
|
||||
a : UArr,
|
||||
}
|
||||
|
||||
@group(1) @binding(0) var<uniform> u : U;
|
||||
|
@ -1612,8 +1612,8 @@ fn f() {
|
|||
TEST_F(RobustnessTest, OmitUniform) {
|
||||
auto* expect = R"(
|
||||
struct S {
|
||||
a : array<f32, 4>;
|
||||
b : array<f32>;
|
||||
a : array<f32, 4>,
|
||||
b : array<f32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage, read> s : S;
|
||||
|
@ -1621,7 +1621,7 @@ struct S {
|
|||
type UArr = array<vec4<f32>, 4>;
|
||||
|
||||
struct U {
|
||||
a : UArr;
|
||||
a : UArr,
|
||||
}
|
||||
|
||||
@group(1) @binding(0) var<uniform> u : U;
|
||||
|
@ -1677,8 +1677,8 @@ fn f() {
|
|||
TEST_F(RobustnessTest, OmitBoth) {
|
||||
auto* expect = R"(
|
||||
struct S {
|
||||
a : array<f32, 4>;
|
||||
b : array<f32>;
|
||||
a : array<f32, 4>,
|
||||
b : array<f32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage, read> s : S;
|
||||
|
@ -1686,7 +1686,7 @@ struct S {
|
|||
type UArr = array<vec4<f32>, 4>;
|
||||
|
||||
struct U {
|
||||
a : UArr;
|
||||
a : UArr,
|
||||
}
|
||||
|
||||
@group(1) @binding(0) var<uniform> u : U;
|
||||
|
|
|
@ -131,7 +131,7 @@ fn f() {
|
|||
TEST_F(SimplifyPointersTest, SavedVars) {
|
||||
auto* src = R"(
|
||||
struct S {
|
||||
i : i32;
|
||||
i : i32,
|
||||
};
|
||||
|
||||
fn arr() {
|
||||
|
@ -155,7 +155,7 @@ fn matrix() {
|
|||
|
||||
auto* expect = R"(
|
||||
struct S {
|
||||
i : i32;
|
||||
i : i32,
|
||||
}
|
||||
|
||||
fn arr() {
|
||||
|
@ -283,11 +283,11 @@ fn z() -> i32 {
|
|||
}
|
||||
|
||||
struct Inner {
|
||||
a : array<i32, 2>;
|
||||
a : array<i32, 2>,
|
||||
};
|
||||
|
||||
struct Outer {
|
||||
a : array<Inner, 2>;
|
||||
a : array<Inner, 2>,
|
||||
};
|
||||
|
||||
fn f() {
|
||||
|
@ -312,11 +312,11 @@ fn z() -> i32 {
|
|||
}
|
||||
|
||||
struct Inner {
|
||||
a : array<i32, 2>;
|
||||
a : array<i32, 2>,
|
||||
}
|
||||
|
||||
struct Outer {
|
||||
a : array<Inner, 2>;
|
||||
a : array<Inner, 2>,
|
||||
}
|
||||
|
||||
fn f() {
|
||||
|
|
|
@ -117,7 +117,7 @@ type a = i32;
|
|||
TEST_F(UnshadowTest, LocalShadowsStruct) {
|
||||
auto* src = R"(
|
||||
struct a {
|
||||
m : i32;
|
||||
m : i32,
|
||||
};
|
||||
|
||||
fn X() {
|
||||
|
@ -131,7 +131,7 @@ fn Y() {
|
|||
|
||||
auto* expect = R"(
|
||||
struct a {
|
||||
m : i32;
|
||||
m : i32,
|
||||
}
|
||||
|
||||
fn X() {
|
||||
|
@ -159,7 +159,7 @@ fn Y() {
|
|||
}
|
||||
|
||||
struct a {
|
||||
m : i32;
|
||||
m : i32,
|
||||
};
|
||||
|
||||
)";
|
||||
|
@ -174,7 +174,7 @@ fn Y() {
|
|||
}
|
||||
|
||||
struct a {
|
||||
m : i32;
|
||||
m : i32,
|
||||
}
|
||||
)";
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ fn main() -> @builtin(position) vec4<f32> {
|
|||
|
||||
auto* expect = R"(
|
||||
struct TintVertexData {
|
||||
tint_vertex_data : array<u32>;
|
||||
tint_vertex_data : array<u32>,
|
||||
}
|
||||
|
||||
@stage(vertex)
|
||||
|
@ -137,7 +137,7 @@ fn main(@location(0) var_a : f32) -> @builtin(position) vec4<f32> {
|
|||
|
||||
auto* expect = R"(
|
||||
struct TintVertexData {
|
||||
tint_vertex_data : array<u32>;
|
||||
tint_vertex_data : array<u32>,
|
||||
}
|
||||
|
||||
@binding(0) @group(4) var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
|
||||
|
@ -175,7 +175,7 @@ fn main(@location(0) var_a : f32) -> @builtin(position) vec4<f32> {
|
|||
|
||||
auto* expect = R"(
|
||||
struct TintVertexData {
|
||||
tint_vertex_data : array<u32>;
|
||||
tint_vertex_data : array<u32>,
|
||||
}
|
||||
|
||||
@binding(0) @group(4) var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
|
||||
|
@ -213,7 +213,7 @@ fn main(@location(0) var_a : f32) -> @builtin(position) vec4<f32> {
|
|||
|
||||
auto* expect = R"(
|
||||
struct TintVertexData {
|
||||
tint_vertex_data : array<u32>;
|
||||
tint_vertex_data : array<u32>,
|
||||
}
|
||||
|
||||
@binding(0) @group(5) var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
|
||||
|
@ -245,7 +245,7 @@ fn main(@builtin(vertex_index) tint_pulling_vertex_index : u32) -> @builtin(posi
|
|||
TEST_F(VertexPullingTest, OneAttribute_Struct) {
|
||||
auto* src = R"(
|
||||
struct Inputs {
|
||||
@location(0) var_a : f32;
|
||||
@location(0) var_a : f32,
|
||||
};
|
||||
|
||||
@stage(vertex)
|
||||
|
@ -256,14 +256,14 @@ fn main(inputs : Inputs) -> @builtin(position) vec4<f32> {
|
|||
|
||||
auto* expect = R"(
|
||||
struct TintVertexData {
|
||||
tint_vertex_data : array<u32>;
|
||||
tint_vertex_data : array<u32>,
|
||||
}
|
||||
|
||||
@binding(0) @group(4) var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
|
||||
|
||||
struct Inputs {
|
||||
@location(0)
|
||||
var_a : f32;
|
||||
var_a : f32,
|
||||
}
|
||||
|
||||
@stage(vertex)
|
||||
|
@ -304,7 +304,7 @@ fn main(@location(0) var_a : f32,
|
|||
|
||||
auto* expect = R"(
|
||||
struct TintVertexData {
|
||||
tint_vertex_data : array<u32>;
|
||||
tint_vertex_data : array<u32>,
|
||||
}
|
||||
|
||||
@binding(0) @group(4) var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
|
||||
|
@ -350,10 +350,10 @@ fn main(@builtin(vertex_index) custom_vertex_index : u32, @builtin(instance_inde
|
|||
TEST_F(VertexPullingTest, ExistingVertexIndexAndInstanceIndex_Struct) {
|
||||
auto* src = R"(
|
||||
struct Inputs {
|
||||
@location(0) var_a : f32;
|
||||
@location(1) var_b : f32;
|
||||
@builtin(vertex_index) custom_vertex_index : u32;
|
||||
@builtin(instance_index) custom_instance_index : u32;
|
||||
@location(0) var_a : f32,
|
||||
@location(1) var_b : f32,
|
||||
@builtin(vertex_index) custom_vertex_index : u32,
|
||||
@builtin(instance_index) custom_instance_index : u32,
|
||||
};
|
||||
|
||||
@stage(vertex)
|
||||
|
@ -364,7 +364,7 @@ fn main(inputs : Inputs) -> @builtin(position) vec4<f32> {
|
|||
|
||||
auto* expect = R"(
|
||||
struct TintVertexData {
|
||||
tint_vertex_data : array<u32>;
|
||||
tint_vertex_data : array<u32>,
|
||||
}
|
||||
|
||||
@binding(0) @group(4) var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
|
||||
|
@ -373,20 +373,20 @@ struct TintVertexData {
|
|||
|
||||
struct tint_symbol {
|
||||
@builtin(vertex_index)
|
||||
custom_vertex_index : u32;
|
||||
custom_vertex_index : u32,
|
||||
@builtin(instance_index)
|
||||
custom_instance_index : u32;
|
||||
custom_instance_index : u32,
|
||||
}
|
||||
|
||||
struct Inputs {
|
||||
@location(0)
|
||||
var_a : f32;
|
||||
var_a : f32,
|
||||
@location(1)
|
||||
var_b : f32;
|
||||
var_b : f32,
|
||||
@builtin(vertex_index)
|
||||
custom_vertex_index : u32;
|
||||
custom_vertex_index : u32,
|
||||
@builtin(instance_index)
|
||||
custom_instance_index : u32;
|
||||
custom_instance_index : u32,
|
||||
}
|
||||
|
||||
@stage(vertex)
|
||||
|
@ -435,16 +435,16 @@ fn main(inputs : Inputs) -> @builtin(position) vec4<f32> {
|
|||
}
|
||||
|
||||
struct Inputs {
|
||||
@location(0) var_a : f32;
|
||||
@location(1) var_b : f32;
|
||||
@builtin(vertex_index) custom_vertex_index : u32;
|
||||
@builtin(instance_index) custom_instance_index : u32;
|
||||
@location(0) var_a : f32,
|
||||
@location(1) var_b : f32,
|
||||
@builtin(vertex_index) custom_vertex_index : u32,
|
||||
@builtin(instance_index) custom_instance_index : u32,
|
||||
};
|
||||
)";
|
||||
|
||||
auto* expect = R"(
|
||||
struct TintVertexData {
|
||||
tint_vertex_data : array<u32>;
|
||||
tint_vertex_data : array<u32>,
|
||||
}
|
||||
|
||||
@binding(0) @group(4) var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
|
||||
|
@ -453,9 +453,9 @@ struct TintVertexData {
|
|||
|
||||
struct tint_symbol {
|
||||
@builtin(vertex_index)
|
||||
custom_vertex_index : u32;
|
||||
custom_vertex_index : u32,
|
||||
@builtin(instance_index)
|
||||
custom_instance_index : u32;
|
||||
custom_instance_index : u32,
|
||||
}
|
||||
|
||||
@stage(vertex)
|
||||
|
@ -474,13 +474,13 @@ fn main(tint_symbol_1 : tint_symbol) -> @builtin(position) vec4<f32> {
|
|||
|
||||
struct Inputs {
|
||||
@location(0)
|
||||
var_a : f32;
|
||||
var_a : f32,
|
||||
@location(1)
|
||||
var_b : f32;
|
||||
var_b : f32,
|
||||
@builtin(vertex_index)
|
||||
custom_vertex_index : u32;
|
||||
custom_vertex_index : u32,
|
||||
@builtin(instance_index)
|
||||
custom_instance_index : u32;
|
||||
custom_instance_index : u32,
|
||||
}
|
||||
)";
|
||||
|
||||
|
@ -509,13 +509,13 @@ struct Inputs {
|
|||
TEST_F(VertexPullingTest, ExistingVertexIndexAndInstanceIndex_SeparateStruct) {
|
||||
auto* src = R"(
|
||||
struct Inputs {
|
||||
@location(0) var_a : f32;
|
||||
@location(1) var_b : f32;
|
||||
@location(0) var_a : f32,
|
||||
@location(1) var_b : f32,
|
||||
};
|
||||
|
||||
struct Indices {
|
||||
@builtin(vertex_index) custom_vertex_index : u32;
|
||||
@builtin(instance_index) custom_instance_index : u32;
|
||||
@builtin(vertex_index) custom_vertex_index : u32,
|
||||
@builtin(instance_index) custom_instance_index : u32,
|
||||
};
|
||||
|
||||
@stage(vertex)
|
||||
|
@ -526,7 +526,7 @@ fn main(inputs : Inputs, indices : Indices) -> @builtin(position) vec4<f32> {
|
|||
|
||||
auto* expect = R"(
|
||||
struct TintVertexData {
|
||||
tint_vertex_data : array<u32>;
|
||||
tint_vertex_data : array<u32>,
|
||||
}
|
||||
|
||||
@binding(0) @group(4) var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
|
||||
|
@ -535,16 +535,16 @@ struct TintVertexData {
|
|||
|
||||
struct Inputs {
|
||||
@location(0)
|
||||
var_a : f32;
|
||||
var_a : f32,
|
||||
@location(1)
|
||||
var_b : f32;
|
||||
var_b : f32,
|
||||
}
|
||||
|
||||
struct Indices {
|
||||
@builtin(vertex_index)
|
||||
custom_vertex_index : u32;
|
||||
custom_vertex_index : u32,
|
||||
@builtin(instance_index)
|
||||
custom_instance_index : u32;
|
||||
custom_instance_index : u32,
|
||||
}
|
||||
|
||||
@stage(vertex)
|
||||
|
@ -591,19 +591,19 @@ fn main(inputs : Inputs, indices : Indices) -> @builtin(position) vec4<f32> {
|
|||
}
|
||||
|
||||
struct Inputs {
|
||||
@location(0) var_a : f32;
|
||||
@location(1) var_b : f32;
|
||||
@location(0) var_a : f32,
|
||||
@location(1) var_b : f32,
|
||||
};
|
||||
|
||||
struct Indices {
|
||||
@builtin(vertex_index) custom_vertex_index : u32;
|
||||
@builtin(instance_index) custom_instance_index : u32;
|
||||
@builtin(vertex_index) custom_vertex_index : u32,
|
||||
@builtin(instance_index) custom_instance_index : u32,
|
||||
};
|
||||
)";
|
||||
|
||||
auto* expect = R"(
|
||||
struct TintVertexData {
|
||||
tint_vertex_data : array<u32>;
|
||||
tint_vertex_data : array<u32>,
|
||||
}
|
||||
|
||||
@binding(0) @group(4) var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
|
||||
|
@ -624,16 +624,16 @@ fn main(indices : Indices) -> @builtin(position) vec4<f32> {
|
|||
|
||||
struct Inputs {
|
||||
@location(0)
|
||||
var_a : f32;
|
||||
var_a : f32,
|
||||
@location(1)
|
||||
var_b : f32;
|
||||
var_b : f32,
|
||||
}
|
||||
|
||||
struct Indices {
|
||||
@builtin(vertex_index)
|
||||
custom_vertex_index : u32;
|
||||
custom_vertex_index : u32,
|
||||
@builtin(instance_index)
|
||||
custom_instance_index : u32;
|
||||
custom_instance_index : u32,
|
||||
}
|
||||
)";
|
||||
|
||||
|
@ -670,7 +670,7 @@ fn main(@location(0) var_a : f32,
|
|||
|
||||
auto* expect = R"(
|
||||
struct TintVertexData {
|
||||
tint_vertex_data : array<u32>;
|
||||
tint_vertex_data : array<u32>,
|
||||
}
|
||||
|
||||
@binding(0) @group(4) var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
|
||||
|
@ -715,7 +715,7 @@ fn main(@location(0) var_a : vec2<f32>,
|
|||
|
||||
auto* expect = R"(
|
||||
struct TintVertexData {
|
||||
tint_vertex_data : array<u32>;
|
||||
tint_vertex_data : array<u32>,
|
||||
}
|
||||
|
||||
@binding(0) @group(4) var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
|
||||
|
@ -771,7 +771,7 @@ fn main(@location(0) var_a : f32,
|
|||
|
||||
auto* expect = R"(
|
||||
struct TintVertexData {
|
||||
tint_vertex_data_1 : array<u32>;
|
||||
tint_vertex_data_1 : array<u32>,
|
||||
}
|
||||
|
||||
@binding(0) @group(4) var<storage, read> tint_pulling_vertex_buffer_0_1 : TintVertexData;
|
||||
|
@ -848,7 +848,7 @@ fn main(
|
|||
|
||||
auto* expect = R"(
|
||||
struct TintVertexData {
|
||||
tint_vertex_data : array<u32>;
|
||||
tint_vertex_data : array<u32>,
|
||||
}
|
||||
|
||||
@binding(0) @group(4) var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
|
||||
|
@ -1008,7 +1008,7 @@ fn main(
|
|||
auto* expect =
|
||||
R"(
|
||||
struct TintVertexData {
|
||||
tint_vertex_data : array<u32>;
|
||||
tint_vertex_data : array<u32>,
|
||||
}
|
||||
|
||||
@binding(0) @group(4) var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
|
||||
|
@ -1167,7 +1167,7 @@ fn main(
|
|||
|
||||
auto* expect = R"(
|
||||
struct TintVertexData {
|
||||
tint_vertex_data : array<u32>;
|
||||
tint_vertex_data : array<u32>,
|
||||
}
|
||||
|
||||
@binding(0) @group(4) var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
|
||||
|
|
|
@ -54,7 +54,7 @@ var<private> arr : array<i32, 4>;
|
|||
)";
|
||||
auto* expect = R"(
|
||||
struct tint_array_wrapper {
|
||||
arr : array<i32, 4u>;
|
||||
arr : array<i32, 4u>,
|
||||
}
|
||||
|
||||
var<private> arr : tint_array_wrapper;
|
||||
|
@ -74,7 +74,7 @@ fn f() {
|
|||
)";
|
||||
auto* expect = R"(
|
||||
struct tint_array_wrapper {
|
||||
arr : array<i32, 4u>;
|
||||
arr : array<i32, 4u>,
|
||||
}
|
||||
|
||||
fn f() {
|
||||
|
@ -96,7 +96,7 @@ fn f(a : array<i32, 4>) -> i32 {
|
|||
)";
|
||||
auto* expect = R"(
|
||||
struct tint_array_wrapper {
|
||||
arr : array<i32, 4u>;
|
||||
arr : array<i32, 4u>,
|
||||
}
|
||||
|
||||
fn f(a : tint_array_wrapper) -> i32 {
|
||||
|
@ -117,7 +117,7 @@ fn f() -> array<i32, 4> {
|
|||
)";
|
||||
auto* expect = R"(
|
||||
struct tint_array_wrapper {
|
||||
arr : array<i32, 4u>;
|
||||
arr : array<i32, 4u>,
|
||||
}
|
||||
|
||||
fn f() -> tint_array_wrapper {
|
||||
|
@ -146,13 +146,13 @@ fn f() {
|
|||
)";
|
||||
auto* expect = R"(
|
||||
struct tint_array_wrapper {
|
||||
arr : array<i32, 2u>;
|
||||
arr : array<i32, 2u>,
|
||||
}
|
||||
|
||||
type Inner = tint_array_wrapper;
|
||||
|
||||
struct tint_array_wrapper_1 {
|
||||
arr : array<tint_array_wrapper, 2u>;
|
||||
arr : array<tint_array_wrapper, 2u>,
|
||||
}
|
||||
|
||||
type Array = tint_array_wrapper_1;
|
||||
|
@ -188,11 +188,11 @@ type Inner = array<i32, 2>;
|
|||
)";
|
||||
auto* expect = R"(
|
||||
struct tint_array_wrapper_1 {
|
||||
arr : array<i32, 2u>;
|
||||
arr : array<i32, 2u>,
|
||||
}
|
||||
|
||||
struct tint_array_wrapper {
|
||||
arr : array<tint_array_wrapper_1, 2u>;
|
||||
arr : array<tint_array_wrapper_1, 2u>,
|
||||
}
|
||||
|
||||
fn f() {
|
||||
|
@ -217,24 +217,24 @@ type Inner = tint_array_wrapper_1;
|
|||
TEST_F(WrapArraysInStructsTest, ArraysInStruct) {
|
||||
auto* src = R"(
|
||||
struct S {
|
||||
a : array<i32, 4>;
|
||||
b : array<i32, 8>;
|
||||
c : array<i32, 4>;
|
||||
a : array<i32, 4>,
|
||||
b : array<i32, 8>,
|
||||
c : array<i32, 4>,
|
||||
};
|
||||
)";
|
||||
auto* expect = R"(
|
||||
struct tint_array_wrapper {
|
||||
arr : array<i32, 4u>;
|
||||
arr : array<i32, 4u>,
|
||||
}
|
||||
|
||||
struct tint_array_wrapper_1 {
|
||||
arr : array<i32, 8u>;
|
||||
arr : array<i32, 8u>,
|
||||
}
|
||||
|
||||
struct S {
|
||||
a : tint_array_wrapper;
|
||||
b : tint_array_wrapper_1;
|
||||
c : tint_array_wrapper;
|
||||
a : tint_array_wrapper,
|
||||
b : tint_array_wrapper_1,
|
||||
c : tint_array_wrapper,
|
||||
}
|
||||
)";
|
||||
|
||||
|
@ -246,28 +246,28 @@ struct S {
|
|||
TEST_F(WrapArraysInStructsTest, ArraysOfArraysInStruct) {
|
||||
auto* src = R"(
|
||||
struct S {
|
||||
a : array<i32, 4>;
|
||||
b : array<array<i32, 4>, 4>;
|
||||
c : array<array<array<i32, 4>, 4>, 4>;
|
||||
a : array<i32, 4>,
|
||||
b : array<array<i32, 4>, 4>,
|
||||
c : array<array<array<i32, 4>, 4>, 4>,
|
||||
};
|
||||
)";
|
||||
auto* expect = R"(
|
||||
struct tint_array_wrapper {
|
||||
arr : array<i32, 4u>;
|
||||
arr : array<i32, 4u>,
|
||||
}
|
||||
|
||||
struct tint_array_wrapper_1 {
|
||||
arr : array<tint_array_wrapper, 4u>;
|
||||
arr : array<tint_array_wrapper, 4u>,
|
||||
}
|
||||
|
||||
struct tint_array_wrapper_2 {
|
||||
arr : array<tint_array_wrapper_1, 4u>;
|
||||
arr : array<tint_array_wrapper_1, 4u>,
|
||||
}
|
||||
|
||||
struct S {
|
||||
a : tint_array_wrapper;
|
||||
b : tint_array_wrapper_1;
|
||||
c : tint_array_wrapper_2;
|
||||
a : tint_array_wrapper,
|
||||
b : tint_array_wrapper_1,
|
||||
c : tint_array_wrapper_2,
|
||||
}
|
||||
)";
|
||||
|
||||
|
@ -279,9 +279,9 @@ struct S {
|
|||
TEST_F(WrapArraysInStructsTest, AccessArraysOfArraysInStruct) {
|
||||
auto* src = R"(
|
||||
struct S {
|
||||
a : array<i32, 4>;
|
||||
b : array<array<i32, 4>, 4>;
|
||||
c : array<array<array<i32, 4>, 4>, 4>;
|
||||
a : array<i32, 4>,
|
||||
b : array<array<i32, 4>, 4>,
|
||||
c : array<array<array<i32, 4>, 4>, 4>,
|
||||
};
|
||||
|
||||
fn f(s : S) -> i32 {
|
||||
|
@ -290,21 +290,21 @@ fn f(s : S) -> i32 {
|
|||
)";
|
||||
auto* expect = R"(
|
||||
struct tint_array_wrapper {
|
||||
arr : array<i32, 4u>;
|
||||
arr : array<i32, 4u>,
|
||||
}
|
||||
|
||||
struct tint_array_wrapper_1 {
|
||||
arr : array<tint_array_wrapper, 4u>;
|
||||
arr : array<tint_array_wrapper, 4u>,
|
||||
}
|
||||
|
||||
struct tint_array_wrapper_2 {
|
||||
arr : array<tint_array_wrapper_1, 4u>;
|
||||
arr : array<tint_array_wrapper_1, 4u>,
|
||||
}
|
||||
|
||||
struct S {
|
||||
a : tint_array_wrapper;
|
||||
b : tint_array_wrapper_1;
|
||||
c : tint_array_wrapper_2;
|
||||
a : tint_array_wrapper,
|
||||
b : tint_array_wrapper_1,
|
||||
c : tint_array_wrapper_2,
|
||||
}
|
||||
|
||||
fn f(s : S) -> i32 {
|
||||
|
@ -338,7 +338,7 @@ fn f2() {
|
|||
type T0 = i32;
|
||||
|
||||
struct tint_array_wrapper {
|
||||
arr : array<i32, 1u>;
|
||||
arr : array<i32, 1u>,
|
||||
}
|
||||
|
||||
type T1 = tint_array_wrapper;
|
||||
|
@ -346,7 +346,7 @@ type T1 = tint_array_wrapper;
|
|||
type T2 = i32;
|
||||
|
||||
struct tint_array_wrapper_1 {
|
||||
arr : array<i32, 2u>;
|
||||
arr : array<i32, 2u>,
|
||||
}
|
||||
|
||||
fn f1(a : tint_array_wrapper_1) {
|
||||
|
@ -355,7 +355,7 @@ fn f1(a : tint_array_wrapper_1) {
|
|||
type T3 = i32;
|
||||
|
||||
struct tint_array_wrapper_2 {
|
||||
arr : array<i32, 3u>;
|
||||
arr : array<i32, 3u>,
|
||||
}
|
||||
|
||||
fn f2() {
|
||||
|
@ -387,7 +387,7 @@ type T0 = i32;
|
|||
)";
|
||||
auto* expect = R"(
|
||||
struct tint_array_wrapper {
|
||||
arr : array<i32, 3u>;
|
||||
arr : array<i32, 3u>,
|
||||
}
|
||||
|
||||
fn f2() {
|
||||
|
@ -397,7 +397,7 @@ fn f2() {
|
|||
type T3 = i32;
|
||||
|
||||
struct tint_array_wrapper_1 {
|
||||
arr : array<i32, 2u>;
|
||||
arr : array<i32, 2u>,
|
||||
}
|
||||
|
||||
fn f1(a : tint_array_wrapper_1) {
|
||||
|
@ -406,7 +406,7 @@ fn f1(a : tint_array_wrapper_1) {
|
|||
type T2 = i32;
|
||||
|
||||
struct tint_array_wrapper_2 {
|
||||
arr : array<i32, 1u>;
|
||||
arr : array<i32, 1u>,
|
||||
}
|
||||
|
||||
type T1 = tint_array_wrapper_2;
|
||||
|
|
|
@ -177,7 +177,7 @@ TEST_F(ZeroInitWorkgroupMemoryTest,
|
|||
var<workgroup> v : i32;
|
||||
|
||||
struct Params {
|
||||
@builtin(local_invocation_index) local_idx : u32;
|
||||
@builtin(local_invocation_index) local_idx : u32,
|
||||
};
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
|
@ -190,7 +190,7 @@ var<workgroup> v : i32;
|
|||
|
||||
struct Params {
|
||||
@builtin(local_invocation_index)
|
||||
local_idx : u32;
|
||||
local_idx : u32,
|
||||
}
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
|
@ -217,7 +217,7 @@ fn f(params : Params) {
|
|||
}
|
||||
|
||||
struct Params {
|
||||
@builtin(local_invocation_index) local_idx : u32;
|
||||
@builtin(local_invocation_index) local_idx : u32,
|
||||
};
|
||||
|
||||
var<workgroup> v : i32;
|
||||
|
@ -234,7 +234,7 @@ fn f(params : Params) {
|
|||
|
||||
struct Params {
|
||||
@builtin(local_invocation_index)
|
||||
local_idx : u32;
|
||||
local_idx : u32,
|
||||
}
|
||||
|
||||
var<workgroup> v : i32;
|
||||
|
@ -304,8 +304,8 @@ TEST_F(ZeroInitWorkgroupMemoryTest,
|
|||
MultipleWorkgroupVar_ExistingLocalIndex_Size1) {
|
||||
auto* src = R"(
|
||||
struct S {
|
||||
x : i32;
|
||||
y : array<i32, 8>;
|
||||
x : i32,
|
||||
y : array<i32, 8>,
|
||||
};
|
||||
|
||||
var<workgroup> a : i32;
|
||||
|
@ -323,8 +323,8 @@ fn f(@builtin(local_invocation_index) local_idx : u32) {
|
|||
)";
|
||||
auto* expect = R"(
|
||||
struct S {
|
||||
x : i32;
|
||||
y : array<i32, 8>;
|
||||
x : i32,
|
||||
y : array<i32, 8>,
|
||||
}
|
||||
|
||||
var<workgroup> a : i32;
|
||||
|
@ -381,8 +381,8 @@ var<workgroup> b : S;
|
|||
var<workgroup> c : array<S, 32>;
|
||||
|
||||
struct S {
|
||||
x : i32;
|
||||
y : array<i32, 8>;
|
||||
x : i32,
|
||||
y : array<i32, 8>,
|
||||
};
|
||||
)";
|
||||
auto* expect = R"(
|
||||
|
@ -418,8 +418,8 @@ var<workgroup> b : S;
|
|||
var<workgroup> c : array<S, 32>;
|
||||
|
||||
struct S {
|
||||
x : i32;
|
||||
y : array<i32, 8>;
|
||||
x : i32,
|
||||
y : array<i32, 8>,
|
||||
}
|
||||
)";
|
||||
|
||||
|
@ -432,8 +432,8 @@ TEST_F(ZeroInitWorkgroupMemoryTest,
|
|||
MultipleWorkgroupVar_ExistingLocalIndex_Size_2_3) {
|
||||
auto* src = R"(
|
||||
struct S {
|
||||
x : i32;
|
||||
y : array<i32, 8>;
|
||||
x : i32,
|
||||
y : array<i32, 8>,
|
||||
};
|
||||
|
||||
var<workgroup> a : i32;
|
||||
|
@ -451,8 +451,8 @@ fn f(@builtin(local_invocation_index) local_idx : u32) {
|
|||
)";
|
||||
auto* expect = R"(
|
||||
struct S {
|
||||
x : i32;
|
||||
y : array<i32, 8>;
|
||||
x : i32,
|
||||
y : array<i32, 8>,
|
||||
}
|
||||
|
||||
var<workgroup> a : i32;
|
||||
|
@ -496,8 +496,8 @@ TEST_F(ZeroInitWorkgroupMemoryTest,
|
|||
MultipleWorkgroupVar_ExistingLocalIndex_Size_2_3_X) {
|
||||
auto* src = R"(
|
||||
struct S {
|
||||
x : i32;
|
||||
y : array<i32, 8>;
|
||||
x : i32,
|
||||
y : array<i32, 8>,
|
||||
};
|
||||
|
||||
var<workgroup> a : i32;
|
||||
|
@ -518,8 +518,8 @@ fn f(@builtin(local_invocation_index) local_idx : u32) {
|
|||
auto* expect =
|
||||
R"(
|
||||
struct S {
|
||||
x : i32;
|
||||
y : array<i32, 8>;
|
||||
x : i32,
|
||||
y : array<i32, 8>,
|
||||
}
|
||||
|
||||
var<workgroup> a : i32;
|
||||
|
@ -565,9 +565,9 @@ TEST_F(ZeroInitWorkgroupMemoryTest,
|
|||
MultipleWorkgroupVar_ExistingLocalIndex_Size_5u_X_10u) {
|
||||
auto* src = R"(
|
||||
struct S {
|
||||
x : array<array<i32, 8>, 10>;
|
||||
y : array<i32, 8>;
|
||||
z : array<array<array<i32, 8>, 10>, 20>;
|
||||
x : array<array<i32, 8>, 10>,
|
||||
y : array<i32, 8>,
|
||||
z : array<array<array<i32, 8>, 10>, 20>,
|
||||
};
|
||||
|
||||
var<workgroup> a : i32;
|
||||
|
@ -588,9 +588,9 @@ fn f(@builtin(local_invocation_index) local_idx : u32) {
|
|||
auto* expect =
|
||||
R"(
|
||||
struct S {
|
||||
x : array<array<i32, 8>, 10>;
|
||||
y : array<i32, 8>;
|
||||
z : array<array<array<i32, 8>, 10>, 20>;
|
||||
x : array<array<i32, 8>, 10>,
|
||||
y : array<i32, 8>,
|
||||
z : array<array<array<i32, 8>, 10>, 20>,
|
||||
}
|
||||
|
||||
var<workgroup> a : i32;
|
||||
|
@ -654,8 +654,8 @@ fn f(@builtin(local_invocation_index) local_idx : u32) {
|
|||
TEST_F(ZeroInitWorkgroupMemoryTest, MultipleWorkgroupVar_InjectedLocalIndex) {
|
||||
auto* src = R"(
|
||||
struct S {
|
||||
x : i32;
|
||||
y : array<i32, 8>;
|
||||
x : i32,
|
||||
y : array<i32, 8>,
|
||||
};
|
||||
|
||||
var<workgroup> a : i32;
|
||||
|
@ -673,8 +673,8 @@ fn f(@builtin(local_invocation_id) local_invocation_id : vec3<u32>) {
|
|||
)";
|
||||
auto* expect = R"(
|
||||
struct S {
|
||||
x : i32;
|
||||
y : array<i32, 8>;
|
||||
x : i32,
|
||||
y : array<i32, 8>,
|
||||
}
|
||||
|
||||
var<workgroup> a : i32;
|
||||
|
@ -731,8 +731,8 @@ var<workgroup> b : S;
|
|||
var<workgroup> c : array<S, 32>;
|
||||
|
||||
struct S {
|
||||
x : i32;
|
||||
y : array<i32, 8>;
|
||||
x : i32,
|
||||
y : array<i32, 8>,
|
||||
};
|
||||
)";
|
||||
auto* expect = R"(
|
||||
|
@ -768,8 +768,8 @@ var<workgroup> b : S;
|
|||
var<workgroup> c : array<S, 32>;
|
||||
|
||||
struct S {
|
||||
x : i32;
|
||||
y : array<i32, 8>;
|
||||
x : i32,
|
||||
y : array<i32, 8>,
|
||||
}
|
||||
)";
|
||||
|
||||
|
@ -781,8 +781,8 @@ struct S {
|
|||
TEST_F(ZeroInitWorkgroupMemoryTest, MultipleWorkgroupVar_MultipleEntryPoints) {
|
||||
auto* src = R"(
|
||||
struct S {
|
||||
x : i32;
|
||||
y : array<i32, 8>;
|
||||
x : i32,
|
||||
y : array<i32, 8>,
|
||||
};
|
||||
|
||||
var<workgroup> a : i32;
|
||||
|
@ -810,8 +810,8 @@ fn f3() {
|
|||
)";
|
||||
auto* expect = R"(
|
||||
struct S {
|
||||
x : i32;
|
||||
y : array<i32, 8>;
|
||||
x : i32,
|
||||
y : array<i32, 8>,
|
||||
}
|
||||
|
||||
var<workgroup> a : i32;
|
||||
|
@ -904,8 +904,8 @@ var<workgroup> b : S;
|
|||
var<workgroup> c : array<S, 32>;
|
||||
|
||||
struct S {
|
||||
x : i32;
|
||||
y : array<i32, 8>;
|
||||
x : i32,
|
||||
y : array<i32, 8>,
|
||||
};
|
||||
)";
|
||||
auto* expect = R"(
|
||||
|
@ -967,8 +967,8 @@ var<workgroup> b : S;
|
|||
var<workgroup> c : array<S, 32>;
|
||||
|
||||
struct S {
|
||||
x : i32;
|
||||
y : array<i32, 8>;
|
||||
x : i32,
|
||||
y : array<i32, 8>,
|
||||
}
|
||||
)";
|
||||
|
||||
|
@ -1132,11 +1132,11 @@ var<workgroup> u : atomic<u32>;
|
|||
TEST_F(ZeroInitWorkgroupMemoryTest, WorkgroupStructOfAtomics) {
|
||||
auto* src = R"(
|
||||
struct S {
|
||||
a : i32;
|
||||
i : atomic<i32>;
|
||||
b : f32;
|
||||
u : atomic<u32>;
|
||||
c : u32;
|
||||
a : i32,
|
||||
i : atomic<i32>,
|
||||
b : f32,
|
||||
u : atomic<u32>,
|
||||
c : u32,
|
||||
};
|
||||
|
||||
var<workgroup> w : S;
|
||||
|
@ -1148,11 +1148,11 @@ fn f() {
|
|||
)";
|
||||
auto* expect = R"(
|
||||
struct S {
|
||||
a : i32;
|
||||
i : atomic<i32>;
|
||||
b : f32;
|
||||
u : atomic<u32>;
|
||||
c : u32;
|
||||
a : i32,
|
||||
i : atomic<i32>,
|
||||
b : f32,
|
||||
u : atomic<u32>,
|
||||
c : u32,
|
||||
}
|
||||
|
||||
var<workgroup> w : S;
|
||||
|
@ -1186,11 +1186,11 @@ fn f() {
|
|||
var<workgroup> w : S;
|
||||
|
||||
struct S {
|
||||
a : i32;
|
||||
i : atomic<i32>;
|
||||
b : f32;
|
||||
u : atomic<u32>;
|
||||
c : u32;
|
||||
a : i32,
|
||||
i : atomic<i32>,
|
||||
b : f32,
|
||||
u : atomic<u32>,
|
||||
c : u32,
|
||||
};
|
||||
)";
|
||||
auto* expect = R"(
|
||||
|
@ -1210,11 +1210,11 @@ fn f(@builtin(local_invocation_index) local_invocation_index : u32) {
|
|||
var<workgroup> w : S;
|
||||
|
||||
struct S {
|
||||
a : i32;
|
||||
i : atomic<i32>;
|
||||
b : f32;
|
||||
u : atomic<u32>;
|
||||
c : u32;
|
||||
a : i32,
|
||||
i : atomic<i32>,
|
||||
b : f32,
|
||||
u : atomic<u32>,
|
||||
c : u32,
|
||||
}
|
||||
)";
|
||||
|
||||
|
@ -1282,11 +1282,11 @@ var<workgroup> w : array<atomic<u32>, 4>;
|
|||
TEST_F(ZeroInitWorkgroupMemoryTest, WorkgroupArrayOfStructOfAtomics) {
|
||||
auto* src = R"(
|
||||
struct S {
|
||||
a : i32;
|
||||
i : atomic<i32>;
|
||||
b : f32;
|
||||
u : atomic<u32>;
|
||||
c : u32;
|
||||
a : i32,
|
||||
i : atomic<i32>,
|
||||
b : f32,
|
||||
u : atomic<u32>,
|
||||
c : u32,
|
||||
};
|
||||
|
||||
var<workgroup> w : array<S, 4>;
|
||||
|
@ -1298,11 +1298,11 @@ fn f() {
|
|||
)";
|
||||
auto* expect = R"(
|
||||
struct S {
|
||||
a : i32;
|
||||
i : atomic<i32>;
|
||||
b : f32;
|
||||
u : atomic<u32>;
|
||||
c : u32;
|
||||
a : i32,
|
||||
i : atomic<i32>,
|
||||
b : f32,
|
||||
u : atomic<u32>,
|
||||
c : u32,
|
||||
}
|
||||
|
||||
var<workgroup> w : array<S, 4>;
|
||||
|
@ -1338,11 +1338,11 @@ fn f() {
|
|||
var<workgroup> w : array<S, 4>;
|
||||
|
||||
struct S {
|
||||
a : i32;
|
||||
i : atomic<i32>;
|
||||
b : f32;
|
||||
u : atomic<u32>;
|
||||
c : u32;
|
||||
a : i32,
|
||||
i : atomic<i32>,
|
||||
b : f32,
|
||||
u : atomic<u32>,
|
||||
c : u32,
|
||||
};
|
||||
)";
|
||||
auto* expect = R"(
|
||||
|
@ -1363,11 +1363,11 @@ fn f(@builtin(local_invocation_index) local_invocation_index : u32) {
|
|||
var<workgroup> w : array<S, 4>;
|
||||
|
||||
struct S {
|
||||
a : i32;
|
||||
i : atomic<i32>;
|
||||
b : f32;
|
||||
u : atomic<u32>;
|
||||
c : u32;
|
||||
a : i32,
|
||||
i : atomic<i32>,
|
||||
b : f32,
|
||||
u : atomic<u32>,
|
||||
c : u32,
|
||||
}
|
||||
)";
|
||||
|
||||
|
|
|
@ -590,7 +590,7 @@ bool GeneratorImpl::EmitStructType(const ast::Struct* str) {
|
|||
|
||||
// Note: u32 is the smallest primitive we currently support. When WGSL
|
||||
// supports smaller types, this will need to be updated.
|
||||
line() << UniqueIdentifier("padding") << " : u32;";
|
||||
line() << UniqueIdentifier("padding") << " : u32,";
|
||||
};
|
||||
|
||||
increment_indent();
|
||||
|
@ -629,7 +629,7 @@ bool GeneratorImpl::EmitStructType(const ast::Struct* str) {
|
|||
if (!EmitType(out, mem->type)) {
|
||||
return false;
|
||||
}
|
||||
out << ";";
|
||||
out << ",";
|
||||
}
|
||||
decrement_indent();
|
||||
|
||||
|
|
|
@ -44,8 +44,8 @@ TEST_F(WgslGeneratorImplTest, EmitTypeDecl_Struct) {
|
|||
ASSERT_TRUE(gen.EmitTypeDecl(s)) << gen.error();
|
||||
ASSERT_TRUE(gen.EmitTypeDecl(alias)) << gen.error();
|
||||
EXPECT_EQ(gen.result(), R"(struct A {
|
||||
a : f32;
|
||||
b : i32;
|
||||
a : f32,
|
||||
b : i32,
|
||||
}
|
||||
type B = A;
|
||||
)");
|
||||
|
|
|
@ -209,7 +209,7 @@ TEST_F(WgslGeneratorImplTest,
|
|||
|
||||
ASSERT_TRUE(gen.Generate()) << gen.error();
|
||||
EXPECT_EQ(gen.result(), R"(struct Data {
|
||||
d : f32;
|
||||
d : f32,
|
||||
}
|
||||
|
||||
@binding(0) @group(0) var<storage, read_write> data : Data;
|
||||
|
|
|
@ -78,7 +78,7 @@ TEST_F(WgslGeneratorImplTest, Emit_GlobalsInterleaved) {
|
|||
EXPECT_EQ(gen.result(), R"( var<private> a0 : f32;
|
||||
|
||||
struct S0 {
|
||||
a : i32;
|
||||
a : i32,
|
||||
}
|
||||
|
||||
fn func() -> f32 {
|
||||
|
@ -88,7 +88,7 @@ TEST_F(WgslGeneratorImplTest, Emit_GlobalsInterleaved) {
|
|||
var<private> a1 : f32;
|
||||
|
||||
struct S1 {
|
||||
a : i32;
|
||||
a : i32,
|
||||
}
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
|
|
|
@ -162,11 +162,11 @@ TEST_F(WgslGeneratorImplTest, EmitType_StructOffsetDecl) {
|
|||
ASSERT_TRUE(gen.EmitStructType(s)) << gen.error();
|
||||
EXPECT_EQ(gen.result(), R"(struct S {
|
||||
@size(8)
|
||||
padding : u32;
|
||||
a : i32;
|
||||
padding : u32,
|
||||
a : i32,
|
||||
@size(4)
|
||||
padding_1 : u32;
|
||||
b : f32;
|
||||
padding_1 : u32,
|
||||
b : f32,
|
||||
}
|
||||
)");
|
||||
}
|
||||
|
@ -183,11 +183,11 @@ TEST_F(WgslGeneratorImplTest, EmitType_StructOffsetDecl_WithSymbolCollisions) {
|
|||
ASSERT_TRUE(gen.EmitStructType(s)) << gen.error();
|
||||
EXPECT_EQ(gen.result(), R"(struct S {
|
||||
@size(8)
|
||||
padding : u32;
|
||||
tint_0_padding : i32;
|
||||
padding : u32,
|
||||
tint_0_padding : i32,
|
||||
@size(4)
|
||||
padding_1 : u32;
|
||||
tint_2_padding : f32;
|
||||
padding_1 : u32,
|
||||
tint_2_padding : f32,
|
||||
}
|
||||
)");
|
||||
}
|
||||
|
@ -203,9 +203,9 @@ TEST_F(WgslGeneratorImplTest, EmitType_StructAlignDecl) {
|
|||
ASSERT_TRUE(gen.EmitStructType(s)) << gen.error();
|
||||
EXPECT_EQ(gen.result(), R"(struct S {
|
||||
@align(8)
|
||||
a : i32;
|
||||
a : i32,
|
||||
@align(16)
|
||||
b : f32;
|
||||
b : f32,
|
||||
}
|
||||
)");
|
||||
}
|
||||
|
@ -221,9 +221,9 @@ TEST_F(WgslGeneratorImplTest, EmitType_StructSizeDecl) {
|
|||
ASSERT_TRUE(gen.EmitStructType(s)) << gen.error();
|
||||
EXPECT_EQ(gen.result(), R"(struct S {
|
||||
@size(16)
|
||||
a : i32;
|
||||
a : i32,
|
||||
@size(32)
|
||||
b : f32;
|
||||
b : f32,
|
||||
}
|
||||
)");
|
||||
}
|
||||
|
@ -238,9 +238,9 @@ TEST_F(WgslGeneratorImplTest, EmitType_Struct_WithAttribute) {
|
|||
|
||||
ASSERT_TRUE(gen.EmitStructType(s)) << gen.error();
|
||||
EXPECT_EQ(gen.result(), R"(struct S {
|
||||
a : i32;
|
||||
a : i32,
|
||||
@align(8)
|
||||
b : f32;
|
||||
b : f32,
|
||||
}
|
||||
)");
|
||||
}
|
||||
|
@ -256,9 +256,9 @@ TEST_F(WgslGeneratorImplTest, EmitType_Struct_WithEntryPointAttributes) {
|
|||
ASSERT_TRUE(gen.EmitStructType(s)) << gen.error();
|
||||
EXPECT_EQ(gen.result(), R"(struct S {
|
||||
@builtin(vertex_index)
|
||||
a : u32;
|
||||
a : u32,
|
||||
@location(2)
|
||||
b : f32;
|
||||
b : f32,
|
||||
}
|
||||
)");
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
type ArrayType = array<vec4<i32>, 4>;
|
||||
|
||||
struct S {
|
||||
arr : ArrayType;
|
||||
arr : ArrayType,
|
||||
};
|
||||
|
||||
var<private> src_private : ArrayType;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
type ArrayType = array<vec4<i32>, 4>;
|
||||
|
||||
struct S {
|
||||
arr : ArrayType;
|
||||
arr : ArrayType,
|
||||
}
|
||||
|
||||
var<private> src_private : ArrayType;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
type ArrayType = array<vec4<i32>, 4>;
|
||||
|
||||
struct S {
|
||||
arr : ArrayType;
|
||||
arr : ArrayType,
|
||||
};
|
||||
|
||||
var<private> src_private : ArrayType;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
type ArrayType = array<vec4<i32>, 4>;
|
||||
|
||||
struct S {
|
||||
arr : ArrayType;
|
||||
arr : ArrayType,
|
||||
}
|
||||
|
||||
var<private> src_private : ArrayType;
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
type ArrayType = array<vec4<i32>, 4>;
|
||||
|
||||
struct S {
|
||||
arr : ArrayType;
|
||||
arr : ArrayType,
|
||||
};
|
||||
|
||||
struct S_nested {
|
||||
arr : array<array<array<i32, 2>, 3>, 4>;
|
||||
arr : array<array<array<i32, 2>, 3>, 4>,
|
||||
};
|
||||
|
||||
var<private> src_private : ArrayType;
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
type ArrayType = array<vec4<i32>, 4>;
|
||||
|
||||
struct S {
|
||||
arr : ArrayType;
|
||||
arr : ArrayType,
|
||||
}
|
||||
|
||||
struct S_nested {
|
||||
arr : array<array<array<i32, 2>, 3>, 4>;
|
||||
arr : array<array<array<i32, 2>, 3>, 4>,
|
||||
}
|
||||
|
||||
var<private> src_private : ArrayType;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
type ArrayType = array<i32, 4>;
|
||||
|
||||
struct S {
|
||||
arr : array<i32, 4>;
|
||||
arr : array<i32, 4>,
|
||||
};
|
||||
|
||||
fn foo() {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
type ArrayType = array<i32, 4>;
|
||||
|
||||
struct S {
|
||||
arr : array<i32, 4>;
|
||||
arr : array<i32, 4>,
|
||||
}
|
||||
|
||||
fn foo() {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
type ArrayType = array<vec4<i32>, 4>;
|
||||
|
||||
struct S {
|
||||
arr : ArrayType;
|
||||
arr : ArrayType,
|
||||
};
|
||||
|
||||
var<private> src_private : ArrayType;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
type ArrayType = array<vec4<i32>, 4>;
|
||||
|
||||
struct S {
|
||||
arr : ArrayType;
|
||||
arr : ArrayType,
|
||||
}
|
||||
|
||||
var<private> src_private : ArrayType;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
; type ARR_A = @stride(8) array<f32, 2>;
|
||||
; type ARR_B = @stride(128) array<@stride(16) array<ARR_A, 4>, 3>;
|
||||
; struct S {
|
||||
; a : ARR_B;
|
||||
; a : ARR_B,
|
||||
; };
|
||||
; @group(0) @binding(0) var<storage, read_write> s : S;
|
||||
;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
struct strided_arr {
|
||||
@size(8)
|
||||
el : f32;
|
||||
el : f32,
|
||||
}
|
||||
|
||||
type Arr = array<strided_arr, 2u>;
|
||||
|
@ -9,13 +9,13 @@ type Arr_1 = array<Arr, 3u>;
|
|||
|
||||
struct strided_arr_1 {
|
||||
@size(128)
|
||||
el : Arr_1;
|
||||
el : Arr_1,
|
||||
}
|
||||
|
||||
type Arr_2 = array<strided_arr_1, 4u>;
|
||||
|
||||
struct S {
|
||||
a : Arr_2;
|
||||
a : Arr_2,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage, read_write> s : S;
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
struct Time {
|
||||
value : f32;
|
||||
value : f32,
|
||||
}
|
||||
|
||||
struct Uniforms {
|
||||
scale : f32;
|
||||
offsetX : f32;
|
||||
offsetY : f32;
|
||||
scalar : f32;
|
||||
scalarOffset : f32;
|
||||
scale : f32,
|
||||
offsetX : f32,
|
||||
offsetY : f32,
|
||||
scalar : f32,
|
||||
scalarOffset : f32,
|
||||
}
|
||||
|
||||
@binding(0) @group(0) var<uniform> time : Time;
|
||||
|
@ -16,9 +16,9 @@ struct Uniforms {
|
|||
|
||||
struct VertexOutput {
|
||||
@builtin(position)
|
||||
Position : vec4<f32>;
|
||||
Position : vec4<f32>,
|
||||
@location(0)
|
||||
v_color : vec4<f32>;
|
||||
v_color : vec4<f32>,
|
||||
}
|
||||
|
||||
@stage(vertex)
|
||||
|
|
|
@ -5,8 +5,8 @@ var<private> offsets : array<f32, 3> = array<f32, 3>(0.0, 1.384615421, 3.2307691
|
|||
var<private> weights : array<f32, 3> = array<f32, 3>(0.227027029, 0.31621623, 0.07027027);
|
||||
|
||||
struct BloomUniforms {
|
||||
radius : f32;
|
||||
dim : f32;
|
||||
radius : f32,
|
||||
dim : f32,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<uniform> bloom : BloomUniforms;
|
||||
|
@ -17,7 +17,7 @@ struct BloomUniforms {
|
|||
|
||||
struct FragmentInput {
|
||||
@location(0)
|
||||
texCoord : vec2<f32>;
|
||||
texCoord : vec2<f32>,
|
||||
}
|
||||
|
||||
fn getGaussianBlur(texCoord : vec2<f32>) -> vec4<f32> {
|
||||
|
|
|
@ -1,54 +1,54 @@
|
|||
struct Camera {
|
||||
projection : mat4x4<f32>;
|
||||
inverseProjection : mat4x4<f32>;
|
||||
view : mat4x4<f32>;
|
||||
position : vec3<f32>;
|
||||
time : f32;
|
||||
outputSize : vec2<f32>;
|
||||
zNear : f32;
|
||||
zFar : f32;
|
||||
projection : mat4x4<f32>,
|
||||
inverseProjection : mat4x4<f32>,
|
||||
view : mat4x4<f32>,
|
||||
position : vec3<f32>,
|
||||
time : f32,
|
||||
outputSize : vec2<f32>,
|
||||
zNear : f32,
|
||||
zFar : f32,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<uniform> camera : Camera;
|
||||
|
||||
struct ClusterBounds {
|
||||
minAABB : vec3<f32>;
|
||||
maxAABB : vec3<f32>;
|
||||
minAABB : vec3<f32>,
|
||||
maxAABB : vec3<f32>,
|
||||
}
|
||||
|
||||
struct Clusters {
|
||||
bounds : array<ClusterBounds, 27648>;
|
||||
bounds : array<ClusterBounds, 27648>,
|
||||
}
|
||||
|
||||
@group(0) @binding(1) var<storage, read> clusters : Clusters;
|
||||
|
||||
struct ClusterLights {
|
||||
offset : u32;
|
||||
count : u32;
|
||||
offset : u32,
|
||||
count : u32,
|
||||
}
|
||||
|
||||
struct ClusterLightGroup {
|
||||
offset : atomic<u32>;
|
||||
lights : array<ClusterLights, 27648>;
|
||||
indices : array<u32, 1769472>;
|
||||
offset : atomic<u32>,
|
||||
lights : array<ClusterLights, 27648>,
|
||||
indices : array<u32, 1769472>,
|
||||
}
|
||||
|
||||
@group(0) @binding(2) var<storage, read_write> clusterLights : ClusterLightGroup;
|
||||
|
||||
struct Light {
|
||||
position : vec3<f32>;
|
||||
range : f32;
|
||||
color : vec3<f32>;
|
||||
intensity : f32;
|
||||
position : vec3<f32>,
|
||||
range : f32,
|
||||
color : vec3<f32>,
|
||||
intensity : f32,
|
||||
}
|
||||
|
||||
struct GlobalLights {
|
||||
ambient : vec3<f32>;
|
||||
dirColor : vec3<f32>;
|
||||
dirIntensity : f32;
|
||||
dirDirection : vec3<f32>;
|
||||
lightCount : u32;
|
||||
lights : array<Light>;
|
||||
ambient : vec3<f32>,
|
||||
dirColor : vec3<f32>,
|
||||
dirIntensity : f32,
|
||||
dirDirection : vec3<f32>,
|
||||
lightCount : u32,
|
||||
lights : array<Light>,
|
||||
}
|
||||
|
||||
@group(0) @binding(3) var<storage, read> globalLights : GlobalLights;
|
||||
|
|
|
@ -1,49 +1,49 @@
|
|||
struct Tables {
|
||||
edges : array<u32, 256>;
|
||||
tris : array<i32, 4096>;
|
||||
edges : array<u32, 256>,
|
||||
tris : array<i32, 4096>,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage> tables : Tables;
|
||||
|
||||
struct IsosurfaceVolume {
|
||||
min : vec3<f32>;
|
||||
max : vec3<f32>;
|
||||
step : vec3<f32>;
|
||||
size : vec3<u32>;
|
||||
threshold : f32;
|
||||
values : array<f32>;
|
||||
min : vec3<f32>,
|
||||
max : vec3<f32>,
|
||||
step : vec3<f32>,
|
||||
size : vec3<u32>,
|
||||
threshold : f32,
|
||||
values : array<f32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(1) var<storage, write> volume : IsosurfaceVolume;
|
||||
|
||||
struct PositionBuffer {
|
||||
values : array<f32>;
|
||||
values : array<f32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(2) var<storage, write> positionsOut : PositionBuffer;
|
||||
|
||||
struct NormalBuffer {
|
||||
values : array<f32>;
|
||||
values : array<f32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(3) var<storage, write> normalsOut : NormalBuffer;
|
||||
|
||||
struct IndexBuffer {
|
||||
tris : array<u32>;
|
||||
tris : array<u32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(4) var<storage, write> indicesOut : IndexBuffer;
|
||||
|
||||
struct DrawIndirectArgs {
|
||||
vc : u32;
|
||||
vertexCount : atomic<u32>;
|
||||
firstVertex : u32;
|
||||
firstInstance : u32;
|
||||
indexCount : atomic<u32>;
|
||||
indexedInstanceCount : u32;
|
||||
indexedFirstIndex : u32;
|
||||
indexedBaseVertex : u32;
|
||||
indexedFirstInstance : u32;
|
||||
vc : u32,
|
||||
vertexCount : atomic<u32>,
|
||||
firstVertex : u32,
|
||||
firstInstance : u32,
|
||||
indexCount : atomic<u32>,
|
||||
indexedInstanceCount : u32,
|
||||
indexedFirstIndex : u32,
|
||||
indexedBaseVertex : u32,
|
||||
indexedFirstInstance : u32,
|
||||
}
|
||||
|
||||
@group(0) @binding(5) var<storage, read_write> drawOut : DrawIndirectArgs;
|
||||
|
|
|
@ -13,22 +13,22 @@ fn rand() -> f32 {
|
|||
// Vertex shader
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
struct RenderParams {
|
||||
modelViewProjectionMatrix : mat4x4<f32>;
|
||||
right : vec3<f32>;
|
||||
up : vec3<f32>;
|
||||
modelViewProjectionMatrix : mat4x4<f32>,
|
||||
right : vec3<f32>,
|
||||
up : vec3<f32>,
|
||||
};
|
||||
@binding(0) @group(0) var<uniform> render_params : RenderParams;
|
||||
|
||||
struct VertexInput {
|
||||
@location(0) position : vec3<f32>;
|
||||
@location(1) color : vec4<f32>;
|
||||
@location(2) quad_pos : vec2<f32>; // -1..+1
|
||||
@location(0) position : vec3<f32>,
|
||||
@location(1) color : vec4<f32>,
|
||||
@location(2) quad_pos : vec2<f32>, // -1..+1
|
||||
};
|
||||
|
||||
struct VertexOutput {
|
||||
@builtin(position) position : vec4<f32>;
|
||||
@location(0) color : vec4<f32>;
|
||||
@location(1) quad_pos : vec2<f32>; // -1..+1
|
||||
@builtin(position) position : vec4<f32>,
|
||||
@location(0) color : vec4<f32>,
|
||||
@location(1) quad_pos : vec2<f32>, // -1..+1
|
||||
};
|
||||
|
||||
@stage(vertex)
|
||||
|
@ -57,19 +57,19 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|||
// Simulation Compute shader
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
struct SimulationParams {
|
||||
deltaTime : f32;
|
||||
seed : vec4<f32>;
|
||||
deltaTime : f32,
|
||||
seed : vec4<f32>,
|
||||
};
|
||||
|
||||
struct Particle {
|
||||
position : vec3<f32>;
|
||||
lifetime : f32;
|
||||
color : vec4<f32>;
|
||||
velocity : vec3<f32>;
|
||||
position : vec3<f32>,
|
||||
lifetime : f32,
|
||||
color : vec4<f32>,
|
||||
velocity : vec3<f32>,
|
||||
};
|
||||
|
||||
struct Particles {
|
||||
particles : array<Particle>;
|
||||
particles : array<Particle>,
|
||||
};
|
||||
|
||||
@binding(0) @group(0) var<uniform> sim_params : SimulationParams;
|
||||
|
@ -129,11 +129,11 @@ fn simulate(@builtin(global_invocation_id) GlobalInvocationID : vec3<u32>) {
|
|||
}
|
||||
|
||||
struct UBO {
|
||||
width : u32;
|
||||
width : u32,
|
||||
};
|
||||
|
||||
struct Buffer {
|
||||
weights : array<f32>;
|
||||
weights : array<f32>,
|
||||
};
|
||||
|
||||
@binding(3) @group(0) var<uniform> ubo : UBO;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
let shadowDepthTextureSize : f32 = 1024.0;
|
||||
|
||||
struct Scene {
|
||||
lightViewProjMatrix : mat4x4<f32>;
|
||||
cameraViewProjMatrix : mat4x4<f32>;
|
||||
lightPos : vec3<f32>;
|
||||
lightViewProjMatrix : mat4x4<f32>,
|
||||
cameraViewProjMatrix : mat4x4<f32>,
|
||||
lightPos : vec3<f32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<uniform> scene : Scene;
|
||||
|
@ -14,11 +14,11 @@ struct Scene {
|
|||
|
||||
struct FragmentInput {
|
||||
@location(0)
|
||||
shadowPos : vec3<f32>;
|
||||
shadowPos : vec3<f32>,
|
||||
@location(1)
|
||||
fragPos : vec3<f32>;
|
||||
fragPos : vec3<f32>,
|
||||
@location(2)
|
||||
fragNorm : vec3<f32>;
|
||||
fragNorm : vec3<f32>,
|
||||
}
|
||||
|
||||
let albedo : vec3<f32> = vec3<f32>(0.899999976, 0.899999976, 0.899999976);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
struct SB {
|
||||
data : array<i32>;
|
||||
data : array<i32>,
|
||||
};
|
||||
|
||||
@group(0) @binding(0) var<storage, read_write> buffer : SB;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
struct Input {
|
||||
@location(0) color: vec4<f32>;
|
||||
@location(0) color: vec4<f32>,
|
||||
};
|
||||
|
||||
struct Output {
|
||||
@location(0) color: vec4<f32>;
|
||||
@location(0) color: vec4<f32>,
|
||||
};
|
||||
|
||||
@stage(fragment)
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
struct Input {
|
||||
@location(0) position: vec4<f32>;
|
||||
@location(0) position: vec4<f32>,
|
||||
};
|
||||
|
||||
struct Output {
|
||||
@builtin(position) position : vec4<f32>;
|
||||
@builtin(position) position : vec4<f32>,
|
||||
};
|
||||
|
||||
@stage(vertex)
|
||||
|
|
|
@ -10,45 +10,45 @@ fn sRGBToLinear(srgb : vec3<f32>) -> vec3<f32> {
|
|||
}
|
||||
|
||||
struct Camera {
|
||||
projection : mat4x4<f32>;
|
||||
inverseProjection : mat4x4<f32>;
|
||||
view : mat4x4<f32>;
|
||||
position : vec3<f32>;
|
||||
time : f32;
|
||||
outputSize : vec2<f32>;
|
||||
zNear : f32;
|
||||
zFar : f32;
|
||||
projection : mat4x4<f32>,
|
||||
inverseProjection : mat4x4<f32>,
|
||||
view : mat4x4<f32>,
|
||||
position : vec3<f32>,
|
||||
time : f32,
|
||||
outputSize : vec2<f32>,
|
||||
zNear : f32,
|
||||
zFar : f32,
|
||||
}
|
||||
|
||||
@binding(0) @group(0) var<uniform> camera : Camera;
|
||||
|
||||
struct ClusterLights {
|
||||
offset : u32;
|
||||
count : u32;
|
||||
offset : u32,
|
||||
count : u32,
|
||||
}
|
||||
|
||||
struct ClusterLightGroup {
|
||||
offset : u32;
|
||||
lights : array<ClusterLights, 27648>;
|
||||
indices : array<u32, 1769472>;
|
||||
offset : u32,
|
||||
lights : array<ClusterLights, 27648>,
|
||||
indices : array<u32, 1769472>,
|
||||
}
|
||||
|
||||
@binding(1) @group(0) var<storage, read> clusterLights : ClusterLightGroup;
|
||||
|
||||
struct Light {
|
||||
position : vec3<f32>;
|
||||
range : f32;
|
||||
color : vec3<f32>;
|
||||
intensity : f32;
|
||||
position : vec3<f32>,
|
||||
range : f32,
|
||||
color : vec3<f32>,
|
||||
intensity : f32,
|
||||
}
|
||||
|
||||
struct GlobalLights {
|
||||
ambient : vec3<f32>;
|
||||
dirColor : vec3<f32>;
|
||||
dirIntensity : f32;
|
||||
dirDirection : vec3<f32>;
|
||||
lightCount : u32;
|
||||
lights : array<Light>;
|
||||
ambient : vec3<f32>,
|
||||
dirColor : vec3<f32>,
|
||||
dirIntensity : f32,
|
||||
dirDirection : vec3<f32>,
|
||||
lightCount : u32,
|
||||
lights : array<Light>,
|
||||
}
|
||||
|
||||
@binding(2) @group(0) var<storage, read> globalLights : GlobalLights;
|
||||
|
@ -78,7 +78,7 @@ fn getClusterIndex(fragCoord : vec4<f32>) -> u32 {
|
|||
@binding(5) @group(0) var shadowSampler : sampler_comparison;
|
||||
|
||||
struct LightShadowTable {
|
||||
light : array<i32>;
|
||||
light : array<i32>,
|
||||
}
|
||||
|
||||
@binding(6) @group(0) var<storage, read> lightShadowTable : LightShadowTable;
|
||||
|
@ -88,12 +88,12 @@ var<private> shadowSampleOffsets : array<vec2<f32>, 16> = array<vec2<f32>, 16>(v
|
|||
let shadowSampleCount = 16u;
|
||||
|
||||
struct ShadowProperties {
|
||||
viewport : vec4<f32>;
|
||||
viewProj : mat4x4<f32>;
|
||||
viewport : vec4<f32>,
|
||||
viewProj : mat4x4<f32>,
|
||||
}
|
||||
|
||||
struct LightShadows {
|
||||
properties : array<ShadowProperties>;
|
||||
properties : array<ShadowProperties>,
|
||||
}
|
||||
|
||||
@binding(7) @group(0) var<storage, read> shadow : LightShadows;
|
||||
|
@ -157,33 +157,33 @@ fn pointLightVisibility(lightIndex : u32, worldPos : vec3<f32>, pointToLight : v
|
|||
|
||||
struct VertexOutput {
|
||||
@builtin(position)
|
||||
position : vec4<f32>;
|
||||
position : vec4<f32>,
|
||||
@location(0)
|
||||
worldPos : vec3<f32>;
|
||||
worldPos : vec3<f32>,
|
||||
@location(1)
|
||||
view : vec3<f32>;
|
||||
view : vec3<f32>,
|
||||
@location(2)
|
||||
texcoord : vec2<f32>;
|
||||
texcoord : vec2<f32>,
|
||||
@location(3)
|
||||
texcoord2 : vec2<f32>;
|
||||
texcoord2 : vec2<f32>,
|
||||
@location(4)
|
||||
color : vec4<f32>;
|
||||
color : vec4<f32>,
|
||||
@location(5)
|
||||
instanceColor : vec4<f32>;
|
||||
instanceColor : vec4<f32>,
|
||||
@location(6)
|
||||
normal : vec3<f32>;
|
||||
normal : vec3<f32>,
|
||||
@location(7)
|
||||
tangent : vec3<f32>;
|
||||
tangent : vec3<f32>,
|
||||
@location(8)
|
||||
bitangent : vec3<f32>;
|
||||
bitangent : vec3<f32>,
|
||||
}
|
||||
|
||||
struct Material {
|
||||
baseColorFactor : vec4<f32>;
|
||||
emissiveFactor : vec3<f32>;
|
||||
occlusionStrength : f32;
|
||||
metallicRoughnessFactor : vec2<f32>;
|
||||
alphaCutoff : f32;
|
||||
baseColorFactor : vec4<f32>,
|
||||
emissiveFactor : vec3<f32>,
|
||||
occlusionStrength : f32,
|
||||
metallicRoughnessFactor : vec2<f32>,
|
||||
alphaCutoff : f32,
|
||||
}
|
||||
|
||||
@binding(8) @group(0) var<uniform> material : Material;
|
||||
|
@ -209,15 +209,15 @@ struct Material {
|
|||
@binding(18) @group(0) var emissiveSampler : sampler;
|
||||
|
||||
struct SurfaceInfo {
|
||||
baseColor : vec4<f32>;
|
||||
albedo : vec3<f32>;
|
||||
metallic : f32;
|
||||
roughness : f32;
|
||||
normal : vec3<f32>;
|
||||
f0 : vec3<f32>;
|
||||
ao : f32;
|
||||
emissive : vec3<f32>;
|
||||
v : vec3<f32>;
|
||||
baseColor : vec4<f32>,
|
||||
albedo : vec3<f32>,
|
||||
metallic : f32,
|
||||
roughness : f32,
|
||||
normal : vec3<f32>,
|
||||
f0 : vec3<f32>,
|
||||
ao : f32,
|
||||
emissive : vec3<f32>,
|
||||
v : vec3<f32>,
|
||||
}
|
||||
|
||||
fn GetSurfaceInfo(input : VertexOutput) -> SurfaceInfo {
|
||||
|
@ -258,11 +258,11 @@ let LightType_Spot = 1u;
|
|||
let LightType_Directional = 2u;
|
||||
|
||||
struct PuctualLight {
|
||||
lightType : u32;
|
||||
pointToLight : vec3<f32>;
|
||||
range : f32;
|
||||
color : vec3<f32>;
|
||||
intensity : f32;
|
||||
lightType : u32,
|
||||
pointToLight : vec3<f32>,
|
||||
range : f32,
|
||||
color : vec3<f32>,
|
||||
intensity : f32,
|
||||
}
|
||||
|
||||
fn FresnelSchlick(cosTheta : f32, F0 : vec3<f32>) -> vec3<f32> {
|
||||
|
@ -325,9 +325,9 @@ fn lightRadiance(light : PuctualLight, surface : SurfaceInfo) -> vec3<f32> {
|
|||
|
||||
struct FragmentOutput {
|
||||
@location(0)
|
||||
color : vec4<f32>;
|
||||
color : vec4<f32>,
|
||||
@location(1)
|
||||
emissive : vec4<f32>;
|
||||
emissive : vec4<f32>,
|
||||
}
|
||||
|
||||
@stage(fragment)
|
||||
|
|
|
@ -1,60 +1,60 @@
|
|||
struct VertexInput {
|
||||
@location(0)
|
||||
position : vec4<f32>;
|
||||
position : vec4<f32>,
|
||||
@location(1)
|
||||
normal : vec3<f32>;
|
||||
normal : vec3<f32>,
|
||||
@location(2)
|
||||
tangent : vec4<f32>;
|
||||
tangent : vec4<f32>,
|
||||
@location(3)
|
||||
texcoord : vec2<f32>;
|
||||
texcoord : vec2<f32>,
|
||||
@location(6)
|
||||
joints : vec4<u32>;
|
||||
joints : vec4<u32>,
|
||||
@location(7)
|
||||
weights : vec4<f32>;
|
||||
weights : vec4<f32>,
|
||||
@location(8)
|
||||
instance0 : vec4<f32>;
|
||||
instance0 : vec4<f32>,
|
||||
@location(9)
|
||||
instance1 : vec4<f32>;
|
||||
instance1 : vec4<f32>,
|
||||
@location(10)
|
||||
instance2 : vec4<f32>;
|
||||
instance2 : vec4<f32>,
|
||||
@location(11)
|
||||
instance3 : vec4<f32>;
|
||||
instance3 : vec4<f32>,
|
||||
@location(12)
|
||||
instanceColor : vec4<f32>;
|
||||
instanceColor : vec4<f32>,
|
||||
}
|
||||
|
||||
struct VertexOutput {
|
||||
@builtin(position)
|
||||
position : vec4<f32>;
|
||||
position : vec4<f32>,
|
||||
@location(0)
|
||||
worldPos : vec3<f32>;
|
||||
worldPos : vec3<f32>,
|
||||
@location(1)
|
||||
view : vec3<f32>;
|
||||
view : vec3<f32>,
|
||||
@location(2)
|
||||
texcoord : vec2<f32>;
|
||||
texcoord : vec2<f32>,
|
||||
@location(3)
|
||||
texcoord2 : vec2<f32>;
|
||||
texcoord2 : vec2<f32>,
|
||||
@location(4)
|
||||
color : vec4<f32>;
|
||||
color : vec4<f32>,
|
||||
@location(5)
|
||||
instanceColor : vec4<f32>;
|
||||
instanceColor : vec4<f32>,
|
||||
@location(6)
|
||||
normal : vec3<f32>;
|
||||
normal : vec3<f32>,
|
||||
@location(7)
|
||||
tangent : vec3<f32>;
|
||||
tangent : vec3<f32>,
|
||||
@location(8)
|
||||
bitangent : vec3<f32>;
|
||||
bitangent : vec3<f32>,
|
||||
}
|
||||
|
||||
struct Camera {
|
||||
projection : mat4x4<f32>;
|
||||
inverseProjection : mat4x4<f32>;
|
||||
view : mat4x4<f32>;
|
||||
position : vec3<f32>;
|
||||
time : f32;
|
||||
outputSize : vec2<f32>;
|
||||
zNear : f32;
|
||||
zFar : f32;
|
||||
projection : mat4x4<f32>,
|
||||
inverseProjection : mat4x4<f32>,
|
||||
view : mat4x4<f32>,
|
||||
position : vec3<f32>,
|
||||
time : f32,
|
||||
outputSize : vec2<f32>,
|
||||
zNear : f32,
|
||||
zFar : f32,
|
||||
}
|
||||
|
||||
@binding(0) @group(0) var<uniform> camera : Camera;
|
||||
|
@ -64,7 +64,7 @@ fn getInstanceMatrix(input : VertexInput) -> mat4x4<f32> {
|
|||
}
|
||||
|
||||
struct Joints {
|
||||
matrices : array<mat4x4<f32>>;
|
||||
matrices : array<mat4x4<f32>>,
|
||||
}
|
||||
|
||||
@binding(1) @group(0) var<storage, read> joint : Joints;
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
struct Inner {
|
||||
a : vec3<i32>;
|
||||
b : i32;
|
||||
c : vec3<u32>;
|
||||
d : u32;
|
||||
e : vec3<f32>;
|
||||
f : f32;
|
||||
g : mat2x3<f32>;
|
||||
h : mat3x2<f32>;
|
||||
i : array<vec4<i32>, 4>;
|
||||
a : vec3<i32>,
|
||||
b : i32,
|
||||
c : vec3<u32>,
|
||||
d : u32,
|
||||
e : vec3<f32>,
|
||||
f : f32,
|
||||
g : mat2x3<f32>,
|
||||
h : mat3x2<f32>,
|
||||
i : array<vec4<i32>, 4>,
|
||||
};
|
||||
|
||||
struct S {
|
||||
arr : array<Inner>;
|
||||
arr : array<Inner>,
|
||||
};
|
||||
|
||||
@binding(0) @group(0) var<storage, read> s : S;
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
struct Inner {
|
||||
a : vec3<i32>;
|
||||
b : i32;
|
||||
c : vec3<u32>;
|
||||
d : u32;
|
||||
e : vec3<f32>;
|
||||
f : f32;
|
||||
g : mat2x3<f32>;
|
||||
h : mat3x2<f32>;
|
||||
i : array<vec4<i32>, 4>;
|
||||
a : vec3<i32>,
|
||||
b : i32,
|
||||
c : vec3<u32>,
|
||||
d : u32,
|
||||
e : vec3<f32>,
|
||||
f : f32,
|
||||
g : mat2x3<f32>,
|
||||
h : mat3x2<f32>,
|
||||
i : array<vec4<i32>, 4>,
|
||||
}
|
||||
|
||||
struct S {
|
||||
arr : array<Inner>;
|
||||
arr : array<Inner>,
|
||||
}
|
||||
|
||||
@binding(0) @group(0) var<storage, read> s : S;
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
struct Inner {
|
||||
a : vec3<i32>;
|
||||
b : i32;
|
||||
c : vec3<u32>;
|
||||
d : u32;
|
||||
e : vec3<f32>;
|
||||
f : f32;
|
||||
g : mat2x3<f32>;
|
||||
h : mat3x2<f32>;
|
||||
i : array<vec4<i32>, 4>;
|
||||
a : vec3<i32>,
|
||||
b : i32,
|
||||
c : vec3<u32>,
|
||||
d : u32,
|
||||
e : vec3<f32>,
|
||||
f : f32,
|
||||
g : mat2x3<f32>,
|
||||
h : mat3x2<f32>,
|
||||
i : array<vec4<i32>, 4>,
|
||||
};
|
||||
|
||||
struct S {
|
||||
arr : array<Inner>;
|
||||
arr : array<Inner>,
|
||||
};
|
||||
|
||||
@binding(0) @group(0) var<storage, read_write> s : S;
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
struct Inner {
|
||||
a : vec3<i32>;
|
||||
b : i32;
|
||||
c : vec3<u32>;
|
||||
d : u32;
|
||||
e : vec3<f32>;
|
||||
f : f32;
|
||||
g : mat2x3<f32>;
|
||||
h : mat3x2<f32>;
|
||||
i : array<vec4<i32>, 4>;
|
||||
a : vec3<i32>,
|
||||
b : i32,
|
||||
c : vec3<u32>,
|
||||
d : u32,
|
||||
e : vec3<f32>,
|
||||
f : f32,
|
||||
g : mat2x3<f32>,
|
||||
h : mat3x2<f32>,
|
||||
i : array<vec4<i32>, 4>,
|
||||
}
|
||||
|
||||
struct S {
|
||||
arr : array<Inner>;
|
||||
arr : array<Inner>,
|
||||
}
|
||||
|
||||
@binding(0) @group(0) var<storage, read_write> s : S;
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
struct Inner {
|
||||
x : i32;
|
||||
x : i32,
|
||||
};
|
||||
|
||||
struct S {
|
||||
a : vec3<i32>;
|
||||
b : i32;
|
||||
c : vec3<u32>;
|
||||
d : u32;
|
||||
e : vec3<f32>;
|
||||
f : f32;
|
||||
g : mat2x3<f32>;
|
||||
h : mat3x2<f32>;
|
||||
i : Inner;
|
||||
j : array<Inner, 4>;
|
||||
a : vec3<i32>,
|
||||
b : i32,
|
||||
c : vec3<u32>,
|
||||
d : u32,
|
||||
e : vec3<f32>,
|
||||
f : f32,
|
||||
g : mat2x3<f32>,
|
||||
h : mat3x2<f32>,
|
||||
i : Inner,
|
||||
j : array<Inner, 4>,
|
||||
};
|
||||
|
||||
@binding(0) @group(0) var<storage, read> s : S;
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
struct Inner {
|
||||
x : i32;
|
||||
x : i32,
|
||||
}
|
||||
|
||||
struct S {
|
||||
a : vec3<i32>;
|
||||
b : i32;
|
||||
c : vec3<u32>;
|
||||
d : u32;
|
||||
e : vec3<f32>;
|
||||
f : f32;
|
||||
g : mat2x3<f32>;
|
||||
h : mat3x2<f32>;
|
||||
i : Inner;
|
||||
j : array<Inner, 4>;
|
||||
a : vec3<i32>,
|
||||
b : i32,
|
||||
c : vec3<u32>,
|
||||
d : u32,
|
||||
e : vec3<f32>,
|
||||
f : f32,
|
||||
g : mat2x3<f32>,
|
||||
h : mat3x2<f32>,
|
||||
i : Inner,
|
||||
j : array<Inner, 4>,
|
||||
}
|
||||
|
||||
@binding(0) @group(0) var<storage, read> s : S;
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
struct Inner {
|
||||
x : i32;
|
||||
x : i32,
|
||||
};
|
||||
|
||||
struct S {
|
||||
a : vec3<i32>;
|
||||
b : i32;
|
||||
c : vec3<u32>;
|
||||
d : u32;
|
||||
e : vec3<f32>;
|
||||
f : f32;
|
||||
g : mat2x3<f32>;
|
||||
h : mat3x2<f32>;
|
||||
i : Inner;
|
||||
j : array<Inner, 4>;
|
||||
a : vec3<i32>,
|
||||
b : i32,
|
||||
c : vec3<u32>,
|
||||
d : u32,
|
||||
e : vec3<f32>,
|
||||
f : f32,
|
||||
g : mat2x3<f32>,
|
||||
h : mat3x2<f32>,
|
||||
i : Inner,
|
||||
j : array<Inner, 4>,
|
||||
};
|
||||
|
||||
@binding(0) @group(0) var<storage, write> s : S;
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
struct Inner {
|
||||
x : i32;
|
||||
x : i32,
|
||||
}
|
||||
|
||||
struct S {
|
||||
a : vec3<i32>;
|
||||
b : i32;
|
||||
c : vec3<u32>;
|
||||
d : u32;
|
||||
e : vec3<f32>;
|
||||
f : f32;
|
||||
g : mat2x3<f32>;
|
||||
h : mat3x2<f32>;
|
||||
i : Inner;
|
||||
j : array<Inner, 4>;
|
||||
a : vec3<i32>,
|
||||
b : i32,
|
||||
c : vec3<u32>,
|
||||
d : u32,
|
||||
e : vec3<f32>,
|
||||
f : f32,
|
||||
g : mat2x3<f32>,
|
||||
h : mat3x2<f32>,
|
||||
i : Inner,
|
||||
j : array<Inner, 4>,
|
||||
}
|
||||
|
||||
@binding(0) @group(0) var<storage, write> s : S;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
struct S {
|
||||
f : f32;
|
||||
f : f32,
|
||||
};
|
||||
|
||||
@group(0) @binding(0)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
struct S {
|
||||
f : f32;
|
||||
f : f32,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage, read> in : array<S>;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
struct Inner {
|
||||
f : f32;
|
||||
f : f32,
|
||||
};
|
||||
struct S {
|
||||
inner : Inner;
|
||||
inner : Inner,
|
||||
};
|
||||
|
||||
@group(0) @binding(0)
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
struct Inner {
|
||||
f : f32;
|
||||
f : f32,
|
||||
}
|
||||
|
||||
struct S {
|
||||
inner : Inner;
|
||||
inner : Inner,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage, read> in : S;
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
struct Inner {
|
||||
a : vec3<i32>;
|
||||
b : i32;
|
||||
c : vec3<u32>;
|
||||
d : u32;
|
||||
e : vec3<f32>;
|
||||
f : f32;
|
||||
g : vec2<i32>;
|
||||
h : vec2<i32>;
|
||||
i : mat2x3<f32>;
|
||||
@align(16) j : mat3x2<f32>;
|
||||
@align(16) k : array<vec4<i32>, 4>;
|
||||
a : vec3<i32>,
|
||||
b : i32,
|
||||
c : vec3<u32>,
|
||||
d : u32,
|
||||
e : vec3<f32>,
|
||||
f : f32,
|
||||
g : vec2<i32>,
|
||||
h : vec2<i32>,
|
||||
i : mat2x3<f32>,
|
||||
@align(16) j : mat3x2<f32>,
|
||||
@align(16) k : array<vec4<i32>, 4>,
|
||||
};
|
||||
|
||||
struct S {
|
||||
arr : array<Inner, 8>;
|
||||
arr : array<Inner, 8>,
|
||||
};
|
||||
|
||||
@binding(0) @group(0) var<uniform> s : S;
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
struct Inner {
|
||||
a : vec3<i32>;
|
||||
b : i32;
|
||||
c : vec3<u32>;
|
||||
d : u32;
|
||||
e : vec3<f32>;
|
||||
f : f32;
|
||||
g : vec2<i32>;
|
||||
h : vec2<i32>;
|
||||
i : mat2x3<f32>;
|
||||
a : vec3<i32>,
|
||||
b : i32,
|
||||
c : vec3<u32>,
|
||||
d : u32,
|
||||
e : vec3<f32>,
|
||||
f : f32,
|
||||
g : vec2<i32>,
|
||||
h : vec2<i32>,
|
||||
i : mat2x3<f32>,
|
||||
@align(16)
|
||||
j : mat3x2<f32>;
|
||||
j : mat3x2<f32>,
|
||||
@align(16)
|
||||
k : array<vec4<i32>, 4>;
|
||||
k : array<vec4<i32>, 4>,
|
||||
}
|
||||
|
||||
struct S {
|
||||
arr : array<Inner, 8>;
|
||||
arr : array<Inner, 8>,
|
||||
}
|
||||
|
||||
@binding(0) @group(0) var<uniform> s : S;
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
struct Inner {
|
||||
@size(16) x : i32;
|
||||
@size(16) x : i32,
|
||||
};
|
||||
|
||||
struct S {
|
||||
a : vec3<i32>;
|
||||
b : i32;
|
||||
c : vec3<u32>;
|
||||
d : u32;
|
||||
e : vec3<f32>;
|
||||
f : f32;
|
||||
g : vec2<i32>;
|
||||
h : vec2<i32>;
|
||||
i : mat2x3<f32>;
|
||||
j : mat3x2<f32>;
|
||||
@align(16) k : Inner;
|
||||
@align(16) l : array<Inner, 4>;
|
||||
a : vec3<i32>,
|
||||
b : i32,
|
||||
c : vec3<u32>,
|
||||
d : u32,
|
||||
e : vec3<f32>,
|
||||
f : f32,
|
||||
g : vec2<i32>,
|
||||
h : vec2<i32>,
|
||||
i : mat2x3<f32>,
|
||||
j : mat3x2<f32>,
|
||||
@align(16) k : Inner,
|
||||
@align(16) l : array<Inner, 4>,
|
||||
};
|
||||
|
||||
@binding(0) @group(0) var<uniform> s : S;
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
struct Inner {
|
||||
@size(16)
|
||||
x : i32;
|
||||
x : i32,
|
||||
}
|
||||
|
||||
struct S {
|
||||
a : vec3<i32>;
|
||||
b : i32;
|
||||
c : vec3<u32>;
|
||||
d : u32;
|
||||
e : vec3<f32>;
|
||||
f : f32;
|
||||
g : vec2<i32>;
|
||||
h : vec2<i32>;
|
||||
i : mat2x3<f32>;
|
||||
j : mat3x2<f32>;
|
||||
a : vec3<i32>,
|
||||
b : i32,
|
||||
c : vec3<u32>,
|
||||
d : u32,
|
||||
e : vec3<f32>,
|
||||
f : f32,
|
||||
g : vec2<i32>,
|
||||
h : vec2<i32>,
|
||||
i : mat2x3<f32>,
|
||||
j : mat3x2<f32>,
|
||||
@align(16)
|
||||
k : Inner;
|
||||
k : Inner,
|
||||
@align(16)
|
||||
l : array<Inner, 4>;
|
||||
l : array<Inner, 4>,
|
||||
}
|
||||
|
||||
@binding(0) @group(0) var<uniform> s : S;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
struct Inner {
|
||||
f : f32;
|
||||
f : f32,
|
||||
};
|
||||
struct S {
|
||||
inner : Inner;
|
||||
inner : Inner,
|
||||
};
|
||||
|
||||
@group(0) @binding(0)
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
struct Inner {
|
||||
f : f32;
|
||||
f : f32,
|
||||
}
|
||||
|
||||
struct S {
|
||||
inner : Inner;
|
||||
inner : Inner,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<uniform> u : S;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
struct VertexInputs0 {
|
||||
@builtin(vertex_index) vertex_index : u32;
|
||||
@location(0) loc0 : i32;
|
||||
@builtin(vertex_index) vertex_index : u32,
|
||||
@location(0) loc0 : i32,
|
||||
};
|
||||
struct VertexInputs1 {
|
||||
@location(2) loc1 : u32;
|
||||
@location(3) loc3 : vec4<f32>;
|
||||
@location(2) loc1 : u32,
|
||||
@location(3) loc3 : vec4<f32>,
|
||||
};
|
||||
|
||||
@stage(vertex)
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
struct VertexInputs0 {
|
||||
@builtin(vertex_index)
|
||||
vertex_index : u32;
|
||||
vertex_index : u32,
|
||||
@location(0)
|
||||
loc0 : i32;
|
||||
loc0 : i32,
|
||||
}
|
||||
|
||||
struct VertexInputs1 {
|
||||
@location(2)
|
||||
loc1 : u32;
|
||||
loc1 : u32,
|
||||
@location(3)
|
||||
loc3 : vec4<f32>;
|
||||
loc3 : vec4<f32>,
|
||||
}
|
||||
|
||||
@stage(vertex)
|
||||
|
|
|
@ -8,47 +8,47 @@ _ = (vec4<f32>( 2.));
|
|||
|
||||
}
|
||||
struct Uniforms {
|
||||
numTriangles : u32;
|
||||
gridSize : u32;
|
||||
puuuuuuuuuuuuuuuuad1 : u32;
|
||||
pad2 : u32;
|
||||
bbMin : vec3<f32>;
|
||||
bbMax : vec3<f32>;
|
||||
numTriangles : u32,
|
||||
gridSize : u32,
|
||||
puuuuuuuuuuuuuuuuad1 : u32,
|
||||
pad2 : u32,
|
||||
bbMin : vec3<f32>,
|
||||
bbMax : vec3<f32>,
|
||||
};
|
||||
|
||||
struct Dbg {
|
||||
offsetCounter : atomic<u32>;
|
||||
pad0 : u32;
|
||||
pad1 : u32;
|
||||
pad2 : u32;
|
||||
value0 : u32;
|
||||
value1 : u32;
|
||||
value2 : u32;
|
||||
value3 : u32;
|
||||
value_f32_0 : f32;
|
||||
value_f32_1 : f32;
|
||||
value_f32_2 : f32;
|
||||
value_f32_3 : f32;
|
||||
offsetCounter : atomic<u32>,
|
||||
pad0 : u32,
|
||||
pad1 : u32,
|
||||
pad2 : u32,
|
||||
value0 : u32,
|
||||
value1 : u32,
|
||||
value2 : u32,
|
||||
value3 : u32,
|
||||
value_f32_0 : f32,
|
||||
value_f32_1 : f32,
|
||||
value_f32_2 : f32,
|
||||
value_f32_3 : f32,
|
||||
};
|
||||
|
||||
struct F32s {
|
||||
values : array<f32>;
|
||||
values : array<f32>,
|
||||
};
|
||||
|
||||
struct U32s {
|
||||
values : array<u32>;
|
||||
values : array<u32>,
|
||||
};
|
||||
|
||||
struct I32s {
|
||||
values : array<i32>;
|
||||
values : array<i32>,
|
||||
};
|
||||
|
||||
struct AU32s {
|
||||
values : array<atomic<u32>>;
|
||||
values : array<atomic<u32>>,
|
||||
};
|
||||
|
||||
struct AI32s {
|
||||
values : array<atomic<i32>>;
|
||||
values : array<atomic<i32>>,
|
||||
};
|
||||
|
||||
@binding(0) @group(0) var<uniform> uniforms : Uniforms;
|
||||
|
|
|
@ -5,47 +5,47 @@ fn marg8uintin() {
|
|||
}
|
||||
|
||||
struct Uniforms {
|
||||
numTriangles : u32;
|
||||
gridSize : u32;
|
||||
puuuuuuuuuuuuuuuuad1 : u32;
|
||||
pad2 : u32;
|
||||
bbMin : vec3<f32>;
|
||||
bbMax : vec3<f32>;
|
||||
numTriangles : u32,
|
||||
gridSize : u32,
|
||||
puuuuuuuuuuuuuuuuad1 : u32,
|
||||
pad2 : u32,
|
||||
bbMin : vec3<f32>,
|
||||
bbMax : vec3<f32>,
|
||||
}
|
||||
|
||||
struct Dbg {
|
||||
offsetCounter : atomic<u32>;
|
||||
pad0 : u32;
|
||||
pad1 : u32;
|
||||
pad2 : u32;
|
||||
value0 : u32;
|
||||
value1 : u32;
|
||||
value2 : u32;
|
||||
value3 : u32;
|
||||
value_f32_0 : f32;
|
||||
value_f32_1 : f32;
|
||||
value_f32_2 : f32;
|
||||
value_f32_3 : f32;
|
||||
offsetCounter : atomic<u32>,
|
||||
pad0 : u32,
|
||||
pad1 : u32,
|
||||
pad2 : u32,
|
||||
value0 : u32,
|
||||
value1 : u32,
|
||||
value2 : u32,
|
||||
value3 : u32,
|
||||
value_f32_0 : f32,
|
||||
value_f32_1 : f32,
|
||||
value_f32_2 : f32,
|
||||
value_f32_3 : f32,
|
||||
}
|
||||
|
||||
struct F32s {
|
||||
values : array<f32>;
|
||||
values : array<f32>,
|
||||
}
|
||||
|
||||
struct U32s {
|
||||
values : array<u32>;
|
||||
values : array<u32>,
|
||||
}
|
||||
|
||||
struct I32s {
|
||||
values : array<i32>;
|
||||
values : array<i32>,
|
||||
}
|
||||
|
||||
struct AU32s {
|
||||
values : array<atomic<u32>>;
|
||||
values : array<atomic<u32>>,
|
||||
}
|
||||
|
||||
struct AI32s {
|
||||
values : array<atomic<i32>>;
|
||||
values : array<atomic<i32>>,
|
||||
}
|
||||
|
||||
@binding(0) @group(0) var<uniform> uniforms : Uniforms;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
struct A {
|
||||
a : i32;
|
||||
a : i32,
|
||||
};
|
||||
|
||||
struct B {
|
||||
b : i32;
|
||||
b : i32,
|
||||
};
|
||||
|
||||
fn f(a : A) -> B {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
struct A {
|
||||
a : i32;
|
||||
a : i32,
|
||||
}
|
||||
|
||||
struct B {
|
||||
b : i32;
|
||||
b : i32,
|
||||
}
|
||||
|
||||
fn f(a : A) -> B {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
struct S {
|
||||
f : f32;
|
||||
f : f32,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage, read> arr : array<S>;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
struct S {
|
||||
f : f32;
|
||||
f : f32,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage, read> arr : array<S>;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
struct Uniforms {
|
||||
u_scale : vec2<f32>;
|
||||
u_offset : vec2<f32>;
|
||||
u_scale : vec2<f32>,
|
||||
u_offset : vec2<f32>,
|
||||
};
|
||||
@binding(0) @group(0) var<uniform> uniforms : Uniforms;
|
||||
|
||||
struct VertexOutputs {
|
||||
@location(0) texcoords : vec2<f32>;
|
||||
@builtin(position) position : vec4<f32>;
|
||||
@location(0) texcoords : vec2<f32>,
|
||||
@builtin(position) position : vec4<f32>,
|
||||
};
|
||||
|
||||
@stage(vertex) fn vs_main(
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
struct Uniforms {
|
||||
u_scale : vec2<f32>;
|
||||
u_offset : vec2<f32>;
|
||||
u_scale : vec2<f32>,
|
||||
u_offset : vec2<f32>,
|
||||
}
|
||||
|
||||
@binding(0) @group(0) var<uniform> uniforms : Uniforms;
|
||||
|
||||
struct VertexOutputs {
|
||||
@location(0)
|
||||
texcoords : vec2<f32>;
|
||||
texcoords : vec2<f32>,
|
||||
@builtin(position)
|
||||
position : vec4<f32>;
|
||||
position : vec4<f32>,
|
||||
}
|
||||
|
||||
@stage(vertex)
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
struct UBO {
|
||||
dynamic_idx: i32;
|
||||
dynamic_idx: i32,
|
||||
};
|
||||
@group(0) @binding(0) var<uniform> ubo: UBO;
|
||||
struct S {
|
||||
data: array<i32, 64>;
|
||||
data: array<i32, 64>,
|
||||
};
|
||||
struct Result {
|
||||
out: i32;
|
||||
out: i32,
|
||||
};
|
||||
@group(0) @binding(1) var<storage, read_write> result: Result;
|
||||
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
struct UBO {
|
||||
dynamic_idx : i32;
|
||||
dynamic_idx : i32,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<uniform> ubo : UBO;
|
||||
|
||||
struct S {
|
||||
data : array<i32, 64>;
|
||||
data : array<i32, 64>,
|
||||
}
|
||||
|
||||
struct Result {
|
||||
out : i32;
|
||||
out : i32,
|
||||
}
|
||||
|
||||
@group(0) @binding(1) var<storage, read_write> result : Result;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
struct UBO {
|
||||
dynamic_idx: i32;
|
||||
dynamic_idx: i32,
|
||||
};
|
||||
@group(0) @binding(0) var<uniform> ubo: UBO;
|
||||
struct S {
|
||||
data: array<i32, 64>;
|
||||
data: array<i32, 64>,
|
||||
};
|
||||
struct Result {
|
||||
out: i32;
|
||||
out: i32,
|
||||
};
|
||||
@group(0) @binding(1) var<storage, read_write> result: Result;
|
||||
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
struct UBO {
|
||||
dynamic_idx : i32;
|
||||
dynamic_idx : i32,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<uniform> ubo : UBO;
|
||||
|
||||
struct S {
|
||||
data : array<i32, 64>;
|
||||
data : array<i32, 64>,
|
||||
}
|
||||
|
||||
struct Result {
|
||||
out : i32;
|
||||
out : i32,
|
||||
}
|
||||
|
||||
@group(0) @binding(1) var<storage, read_write> result : Result;
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
struct UBO {
|
||||
dynamic_idx: i32;
|
||||
dynamic_idx: i32,
|
||||
};
|
||||
@group(0) @binding(0) var<uniform> ubo: UBO;
|
||||
struct Result {
|
||||
out: i32;
|
||||
out: i32,
|
||||
};
|
||||
@group(0) @binding(2) var<storage, read_write> result: Result;
|
||||
|
||||
struct SSBO {
|
||||
data: array<i32, 4>;
|
||||
data: array<i32, 4>,
|
||||
};
|
||||
@group(0) @binding(1) var<storage, read_write> ssbo: SSBO;
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue