From 6b1e5f552bd49fbc002cb0582a4c3bd8137e8499 Mon Sep 17 00:00:00 2001 From: James Price Date: Wed, 19 Jan 2022 18:11:17 +0000 Subject: [PATCH] wgsl: Do not require a semicolon after a struct Don't generate them either, which generated a lot of test churn. Fixed: tint:1380 Change-Id: I0a7cfdd2ef0ffe8e7fda111fbc57997b36b949e0 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/77165 Auto-Submit: James Price Reviewed-by: Ben Clayton Kokoro: Kokoro --- docs/origin-trial-changes.md | 1 + src/reader/spirv/function_memory_test.cc | 2 +- .../spirv/parser_impl_function_decl_test.cc | 2 +- .../spirv/parser_impl_module_var_test.cc | 118 ++++++------- .../spirv/parser_impl_named_types_test.cc | 2 +- src/reader/wgsl/parser_impl.cc | 5 +- src/reader/wgsl/parser_impl_error_msg_test.cc | 7 - .../wgsl/parser_impl_global_decl_test.cc | 17 +- .../parser_impl_primary_expression_test.cc | 4 +- src/reader/wgsl/parser_impl_test.cc | 21 +++ .../add_spirv_block_decoration_test.cc | 48 +++--- .../array_length_from_uniform_test.cc | 36 ++-- src/transform/binding_remapper_test.cc | 12 +- src/transform/calculate_array_length_test.cc | 14 +- .../canonicalize_entry_point_io_test.cc | 160 +++++++++--------- src/transform/decompose_memory_access_test.cc | 32 ++-- .../decompose_strided_matrix_test.cc | 20 +-- src/transform/first_index_offset_test.cc | 12 +- .../localize_struct_array_assignment_test.cc | 60 +++---- ...ule_scope_var_to_entry_point_param_test.cc | 26 +-- .../multiplanar_external_texture_test.cc | 18 +- .../num_workgroups_from_uniform_test.cc | 24 +-- src/transform/pad_array_elements_test.cc | 54 +++--- .../promote_initializers_to_const_var_test.cc | 16 +- src/transform/remove_phonies_test.cc | 2 +- src/transform/robustness_test.cc | 20 +-- src/transform/simplify_pointers_test.cc | 6 +- src/transform/unshadow_test.cc | 2 +- src/transform/vertex_pulling_test.cc | 38 ++--- src/transform/wrap_arrays_in_structs_test.cc | 40 ++--- .../zero_init_workgroup_memory_test.cc | 18 +- src/writer/wgsl/generator_impl.cc | 2 +- .../wgsl/generator_impl_alias_type_test.cc | 2 +- .../wgsl/generator_impl_function_test.cc | 2 +- .../wgsl/generator_impl_global_decl_test.cc | 4 +- src/writer/wgsl/generator_impl_type_test.cc | 12 +- .../assign_to_function_var.wgsl.expected.wgsl | 2 +- .../assign_to_private_var.wgsl.expected.wgsl | 2 +- .../assign_to_storage_var.wgsl.expected.wgsl | 4 +- .../assign_to_subexpr.wgsl.expected.wgsl | 2 +- ...assign_to_workgroup_var.wgsl.expected.wgsl | 2 +- test/benchmark/particles.wgsl.expected.wgsl | 16 +- .../simple_compute.wgsl.expected.wgsl | 2 +- .../simple_fragment.wgsl.expected.wgsl | 4 +- .../simple_vertex.wgsl.expected.wgsl | 4 +- .../dynamic_index/read.wgsl.expected.wgsl | 4 +- .../dynamic_index/write.wgsl.expected.wgsl | 4 +- .../static_index/read.wgsl.expected.wgsl | 4 +- .../static_index/write.wgsl.expected.wgsl | 4 +- .../types/runtime_array.wgsl.expected.wgsl | 2 +- .../storage/types/struct.wgsl.expected.wgsl | 4 +- .../dynamic_index/read.wgsl.expected.wgsl | 4 +- .../static_index/read.wgsl.expected.wgsl | 4 +- .../uniform/types/struct.wgsl.expected.wgsl | 4 +- test/bug/chromium/1251009.wgsl.expected.wgsl | 4 +- test/bug/chromium/1273230.wgsl.expected.wgsl | 14 +- test/bug/chromium/1273451.wgsl.expected.wgsl | 4 +- test/bug/dawn/947.wgsl.expected.wgsl | 4 +- .../read/function.wgsl.expected.wgsl | 6 +- .../read/private.wgsl.expected.wgsl | 6 +- .../read/storage.wgsl.expected.wgsl | 6 +- .../read/uniform.wgsl.expected.wgsl | 4 +- .../read/workgroup.wgsl.expected.wgsl | 6 +- .../write/function.wgsl.expected.wgsl | 6 +- .../function_via_param.wgsl.expected.wgsl | 6 +- .../write/private.wgsl.expected.wgsl | 6 +- .../private_via_param.wgsl.expected.wgsl | 6 +- .../write/storage.wgsl.expected.wgsl | 6 +- .../write/workgroup.wgsl.expected.wgsl | 6 +- .../1206.wgsl.expected.wgsl | 6 +- .../local_assign_scalar_x.wgsl.expected.wgsl | 2 +- .../local_assign_scalar_xy.wgsl.expected.wgsl | 2 +- .../local_assign_scalar_y.wgsl.expected.wgsl | 2 +- .../local_assign_vector.wgsl.expected.wgsl | 2 +- .../module_assign_scalar_x.wgsl.expected.wgsl | 2 +- ...module_assign_scalar_xy.wgsl.expected.wgsl | 2 +- .../module_assign_scalar_y.wgsl.expected.wgsl | 2 +- .../module_assign_vector.wgsl.expected.wgsl | 2 +- test/bug/tint/1046.wgsl.expected.wgsl | 10 +- test/bug/tint/1076.wgsl.expected.wgsl | 2 +- test/bug/tint/1088.spvasm.expected.wgsl | 4 +- test/bug/tint/1113.wgsl.expected.wgsl | 14 +- test/bug/tint/1121.wgsl.expected.wgsl | 12 +- test/bug/tint/1136.wgsl.expected.wgsl | 2 +- test/bug/tint/221.wgsl.expected.wgsl | 2 +- test/bug/tint/294.wgsl.expected.wgsl | 4 +- test/bug/tint/369.wgsl.expected.wgsl | 2 +- test/bug/tint/403.wgsl.expected.wgsl | 4 +- test/bug/tint/492.wgsl.expected.wgsl | 2 +- test/bug/tint/534.wgsl.expected.wgsl | 4 +- test/bug/tint/744.wgsl.expected.wgsl | 4 +- test/bug/tint/749.spvasm.expected.wgsl | 6 +- test/bug/tint/757.wgsl.expected.wgsl | 4 +- test/bug/tint/824.wgsl.expected.wgsl | 2 +- test/bug/tint/827.wgsl.expected.wgsl | 2 +- test/bug/tint/870.spvasm.expected.wgsl | 4 +- test/bug/tint/913.wgsl.expected.wgsl | 4 +- test/bug/tint/914.wgsl.expected.wgsl | 4 +- test/bug/tint/922.wgsl.expected.wgsl | 14 +- test/bug/tint/926.wgsl.expected.wgsl | 2 +- test/bug/tint/942.wgsl.expected.wgsl | 4 +- test/bug/tint/943.spvasm.expected.wgsl | 8 +- test/bug/tint/948.wgsl.expected.wgsl | 4 +- test/bug/tint/949.wgsl.expected.wgsl | 8 +- test/bug/tint/951.spvasm.expected.wgsl | 6 +- test/bug/tint/959.wgsl.expected.wgsl | 2 +- test/bug/tint/977.spvasm.expected.wgsl | 8 +- test/bug/tint/978.wgsl.expected.wgsl | 4 +- test/bug/tint/980.wgsl.expected.wgsl | 2 +- test/bug/tint/993.wgsl.expected.wgsl | 6 +- test/bug/tint/998.wgsl.expected.wgsl | 6 +- .../mul/mat3x2-vec3/f32.wgsl.expected.wgsl | 2 +- .../mul/mat3x3-vec3/f32.wgsl.expected.wgsl | 2 +- .../mul/vec3-mat3x3/f32.wgsl.expected.wgsl | 2 +- .../mul/vec3-mat4x3/f32.wgsl.expected.wgsl | 2 +- .../literals/-inf.spvasm.expected.wgsl | 2 +- .../literals/inf.spvasm.expected.wgsl | 2 +- .../literals/nan.spvasm.expected.wgsl | 2 +- .../read/packed_vec3/f32.wgsl.expected.wgsl | 2 +- .../read/packed_vec3/i32.wgsl.expected.wgsl | 2 +- .../read/packed_vec3/u32.wgsl.expected.wgsl | 2 +- .../swizzle/read/vec3/f32.wgsl.expected.wgsl | 2 +- .../swizzle/read/vec3/i32.wgsl.expected.wgsl | 2 +- .../swizzle/read/vec3/u32.wgsl.expected.wgsl | 2 +- .../write/packed_vec3/f32.wgsl.expected.wgsl | 2 +- .../write/packed_vec3/i32.wgsl.expected.wgsl | 2 +- .../write/packed_vec3/u32.wgsl.expected.wgsl | 2 +- .../swizzle/write/vec3/f32.wgsl.expected.wgsl | 2 +- .../swizzle/write/vec3/i32.wgsl.expected.wgsl | 2 +- .../swizzle/write/vec3/u32.wgsl.expected.wgsl | 2 +- .../zero_init/array/struct.wgsl.expected.wgsl | 2 +- .../zero_init/struct/array.wgsl.expected.wgsl | 2 +- .../struct/scalar.wgsl.expected.wgsl | 2 +- .../double/struct.wgsl.expected.wgsl | 4 +- .../prefix/lower/struct.wgsl.expected.wgsl | 4 +- .../prefix/upper/struct.wgsl.expected.wgsl | 4 +- .../complex_via_let.wgsl.expected.wgsl | 2 +- .../arrayLength/deprecated.wgsl.expected.wgsl | 2 +- .../arrayLength/simple.wgsl.expected.wgsl | 2 +- .../arrayLength/via_let.wgsl.expected.wgsl | 2 +- .../via_let_complex.wgsl.expected.wgsl | 2 +- .../gen/arrayLength/1588cd.wgsl.expected.wgsl | 2 +- .../gen/arrayLength/61b1c7.wgsl.expected.wgsl | 2 +- .../gen/arrayLength/a0f5ca.wgsl.expected.wgsl | 2 +- .../gen/arrayLength/cdd123.wgsl.expected.wgsl | 2 +- .../gen/arrayLength/cfca0a.wgsl.expected.wgsl | 2 +- .../gen/arrayLength/eb510f.wgsl.expected.wgsl | 2 +- .../gen/atomicAdd/8a199a.wgsl.expected.wgsl | 2 +- .../gen/atomicAdd/d32fe4.wgsl.expected.wgsl | 2 +- .../gen/atomicAnd/152966.wgsl.expected.wgsl | 2 +- .../gen/atomicAnd/85a8d9.wgsl.expected.wgsl | 2 +- .../12871c.wgsl.expected.wgsl | 2 +- .../6673da.wgsl.expected.wgsl | 2 +- .../atomicExchange/d59712.wgsl.expected.wgsl | 2 +- .../atomicExchange/f2e22f.wgsl.expected.wgsl | 2 +- .../gen/atomicLoad/0806ad.wgsl.expected.wgsl | 2 +- .../gen/atomicLoad/fe6cc3.wgsl.expected.wgsl | 2 +- .../gen/atomicMax/51b9be.wgsl.expected.wgsl | 2 +- .../gen/atomicMax/92aa72.wgsl.expected.wgsl | 2 +- .../gen/atomicMin/8e38dc.wgsl.expected.wgsl | 2 +- .../gen/atomicMin/c67a74.wgsl.expected.wgsl | 2 +- .../gen/atomicOr/5e95d4.wgsl.expected.wgsl | 2 +- .../gen/atomicOr/8d96a0.wgsl.expected.wgsl | 2 +- .../gen/atomicStore/cdc29e.wgsl.expected.wgsl | 2 +- .../gen/atomicStore/d1e9a6.wgsl.expected.wgsl | 2 +- .../gen/atomicSub/051100.wgsl.expected.wgsl | 2 +- .../gen/atomicSub/15bfc9.wgsl.expected.wgsl | 2 +- .../gen/atomicXor/54510e.wgsl.expected.wgsl | 2 +- .../gen/atomicXor/c1b78c.wgsl.expected.wgsl | 2 +- .../ignore/runtime_array.wgsl.expected.wgsl | 2 +- .../ignore/storage_buffer.wgsl.expected.wgsl | 2 +- .../ignore/uniform_buffer.wgsl.expected.wgsl | 2 +- .../depth_ms.spvasm.expected.wgsl | 2 +- .../textureLoad/depth_ms.spvasm.expected.wgsl | 2 +- .../depth_ms.spvasm.expected.wgsl | 2 +- .../storage/mat2x2/f32.wgsl.expected.wgsl | 2 +- .../mat2x2/stride/16.spvasm.expected.wgsl | 2 +- test/let/global/global.wgsl.expected.wgsl | 2 +- test/let/inferred/function.wgsl.expected.wgsl | 2 +- .../global/struct_field.spvasm.expected.wgsl | 2 +- .../global/struct_field.wgsl.expected.wgsl | 2 +- .../load/local/ptr_storage.wgsl.expected.wgsl | 2 +- .../load/local/ptr_uniform.wgsl.expected.wgsl | 2 +- .../local/struct_field.spvasm.expected.wgsl | 2 +- .../local/struct_field.wgsl.expected.wgsl | 2 +- .../global/struct_field.spvasm.expected.wgsl | 2 +- .../local/struct_field.spvasm.expected.wgsl | 2 +- test/samples/compute_boids.wgsl.expected.wgsl | 6 +- test/samples/cube.wgsl.expected.wgsl | 6 +- .../simple_vertex.spvasm.expected.wgsl | 2 +- ...e_input_builtins_struct.wgsl.expected.wgsl | 2 +- .../compute_input_mixed.wgsl.expected.wgsl | 4 +- ...t_input_builtins_struct.wgsl.expected.wgsl | 2 +- ..._input_locations_struct.wgsl.expected.wgsl | 2 +- .../fragment_input_mixed.wgsl.expected.wgsl | 4 +- ..._output_builtins_struct.wgsl.expected.wgsl | 2 +- ...output_locations_struct.wgsl.expected.wgsl | 2 +- .../fragment_output_mixed.wgsl.expected.wgsl | 2 +- ...nterpolate_input_struct.wgsl.expected.wgsl | 2 +- .../interpolate_integers.wgsl.expected.wgsl | 2 +- ...terpolate_return_struct.wgsl.expected.wgsl | 2 +- ...invariant_struct_member.wgsl.expected.wgsl | 2 +- ...struct_different_stages.wgsl.expected.wgsl | 2 +- ..._struct_helper_function.wgsl.expected.wgsl | 2 +- ...d_struct_storage_buffer.wgsl.expected.wgsl | 2 +- ...x_input_builtins_struct.wgsl.expected.wgsl | 2 +- ..._input_locations_struct.wgsl.expected.wgsl | 2 +- .../vertex_input_mixed.wgsl.expected.wgsl | 4 +- ..._output_builtins_struct.wgsl.expected.wgsl | 2 +- ...output_locations_struct.wgsl.expected.wgsl | 2 +- .../shadowing/function/var.wgsl.expected.wgsl | 2 +- test/shadowing/struct/let.wgsl.expected.wgsl | 2 +- .../shadowing/struct/param.wgsl.expected.wgsl | 2 +- test/shadowing/struct/var.wgsl.expected.wgsl | 2 +- .../in_for_loop_body.wgsl.expected.wgsl | 6 +- .../in_for_loop_continuing.wgsl.expected.wgsl | 6 +- .../in_for_loop_init.wgsl.expected.wgsl | 6 +- ...g_with_side_effect_func.wgsl.expected.wgsl | 8 +- .../struct_array.wgsl.expected.wgsl | 6 +- .../struct_array_array.wgsl.expected.wgsl | 6 +- .../struct_array_struct.wgsl.expected.wgsl | 8 +- ...ruct_array_struct_array.wgsl.expected.wgsl | 8 +- .../struct_dynamic_array.wgsl.expected.wgsl | 6 +- ...amic_array_struct_array.wgsl.expected.wgsl | 8 +- .../struct_matrix.wgsl.expected.wgsl | 4 +- .../struct_multiple_arrays.wgsl.expected.wgsl | 6 +- .../struct_struct_array.wgsl.expected.wgsl | 8 +- .../struct_vector.wgsl.expected.wgsl | 4 +- .../vector_assign.wgsl.expected.wgsl | 4 +- .../via_pointer.wgsl.expected.wgsl | 6 +- .../via_pointer_arg.wgsl.expected.wgsl | 6 +- ...dr_of_non_constructable.wgsl.expected.wgsl | 2 +- .../addr_of_runtime_array.wgsl.expected.wgsl | 2 +- .../phony/storage_buffer.wgsl.expected.wgsl | 2 +- .../phony/uniform_buffer.wgsl.expected.wgsl | 2 +- .../condition/struct_ctor.wgsl.expected.wgsl | 2 +- .../continuing/struct_ctor.wgsl.expected.wgsl | 2 +- .../struct_ctor.wgsl.expected.wgsl | 2 +- .../type_constructor.wgsl.expected.wgsl | 8 +- ...tion_scope_declarations.wgsl.expected.wgsl | 2 +- .../types/module_scope_let.wgsl.expected.wgsl | 2 +- .../types/module_scope_var.wgsl.expected.wgsl | 2 +- ..._scope_var_initializers.wgsl.expected.wgsl | 2 +- test/types/parameters.wgsl.expected.wgsl | 2 +- test/types/return_types.wgsl.expected.wgsl | 2 +- test/types/struct_members.wgsl.expected.wgsl | 4 +- test/var/inferred/function.wgsl.expected.wgsl | 2 +- .../function/struct.wgsl.expected.wgsl | 2 +- .../private/struct.wgsl.expected.wgsl | 2 +- .../workgroup/struct.wgsl.expected.wgsl | 2 +- 250 files changed, 796 insertions(+), 791 deletions(-) diff --git a/docs/origin-trial-changes.md b/docs/origin-trial-changes.md index cf4e66827f..a4acf8cec2 100644 --- a/docs/origin-trial-changes.md +++ b/docs/origin-trial-changes.md @@ -19,6 +19,7 @@ The following features have been deprecated and will be removed in M102: * Added builtins `degrees()` and `radians()` for converting between degrees and radians. [tint:1329](https://crbug.com/tint/1329) * `let` arrays and matrices can now be dynamically indexed. [tint:1352](https://crbug.com/tint/1352) * Storage and Uniform buffer types no longer have to be structures. [tint:1372](crbug.com/tint/1372) +* A struct declaration does not have to be followed by a semicolon. [tint:1380](crbug.com/tint/1380) ### Fixes diff --git a/src/reader/spirv/function_memory_test.cc b/src/reader/spirv/function_memory_test.cc index f8c8c98aea..189fdbe15c 100644 --- a/src/reader/spirv/function_memory_test.cc +++ b/src/reader/spirv/function_memory_test.cc @@ -955,7 +955,7 @@ TEST_F(SpvParserMemoryTest, RemapStorageBuffer_TypesAndVarDeclarations) { struct S { field0 : u32; field1 : RTArr; -}; +} [[group(0), binding(0)]] var myvar : S; )")); diff --git a/src/reader/spirv/parser_impl_function_decl_test.cc b/src/reader/spirv/parser_impl_function_decl_test.cc index 47563d1f9b..b3eecc1690 100644 --- a/src/reader/spirv/parser_impl_function_decl_test.cc +++ b/src/reader/spirv/parser_impl_function_decl_test.cc @@ -126,7 +126,7 @@ OpFunctionEnd)"; struct main_out { [[builtin(position)]] x_2_1 : vec4; -}; +} )")) << program_ast; EXPECT_THAT(program_ast, HasSubstr(R"( diff --git a/src/reader/spirv/parser_impl_module_var_test.cc b/src/reader/spirv/parser_impl_module_var_test.cc index 5d93620859..4c7ab3ad0e 100644 --- a/src/reader/spirv/parser_impl_module_var_test.cc +++ b/src/reader/spirv/parser_impl_module_var_test.cc @@ -473,7 +473,7 @@ fn main_1() { struct main_out { [[builtin(position)]] gl_Position : vec4; -}; +} [[stage(vertex)]] fn main() -> main_out { @@ -533,7 +533,7 @@ fn main_1() { struct main_out { [[builtin(position)]] gl_Position : vec4; -}; +} [[stage(vertex)]] fn main() -> main_out { @@ -592,7 +592,7 @@ fn main_1() { struct main_out { [[builtin(position)]] gl_Position : vec4; -}; +} [[stage(vertex)]] fn main() -> main_out { @@ -651,7 +651,7 @@ fn main_1() { struct main_out { [[builtin(position)]] x_2_1 : vec4; -}; +} [[stage(vertex)]] fn main() -> main_out { @@ -709,7 +709,7 @@ fn main_1() { struct main_out { [[builtin(position)]] x_2_1 : vec4; -}; +} [[stage(vertex)]] fn main() -> main_out { @@ -767,7 +767,7 @@ fn main_1() { struct main_out { [[builtin(position)]] x_2_1 : vec4; -}; +} [[stage(vertex)]] fn main() -> main_out { @@ -803,7 +803,7 @@ fn main_1() { struct main_out { [[builtin(position)]] x_2_1 : vec4; -}; +} [[stage(vertex)]] fn main() -> main_out { @@ -1405,7 +1405,7 @@ struct S { field0 : u32; field1 : f32; field2 : Arr; -}; +} [[group(0), binding(0)]] var x_1 : S; )")) << module_str; @@ -1435,7 +1435,7 @@ TEST_F(SpvModuleScopeVarParserTest, ColMajorDecoration_Dropped) { const auto module_str = test::ToString(p->program()); EXPECT_THAT(module_str, HasSubstr(R"(struct S { field0 : mat3x2; -}; +} [[group(0), binding(0)]] var myvar : S; )")) << module_str; @@ -1464,7 +1464,7 @@ TEST_F(SpvModuleScopeVarParserTest, MatrixStrideDecoration_Natural_Dropped) { const auto module_str = test::ToString(p->program()); EXPECT_THAT(module_str, HasSubstr(R"(struct S { field0 : mat3x2; -}; +} [[group(0), binding(0)]] var myvar : S; )")) << module_str; @@ -1494,7 +1494,7 @@ TEST_F(SpvModuleScopeVarParserTest, MatrixStrideDecoration) { EXPECT_THAT(module_str, HasSubstr(R"(struct S { [[stride(64), internal(disable_validation__ignore_stride)]] field0 : mat3x2; -}; +} [[group(0), binding(0)]] var myvar : S; )")) << module_str; @@ -1547,7 +1547,7 @@ TEST_F(SpvModuleScopeVarParserTest, StorageBuffer_NonWritable_AllMembers) { EXPECT_THAT(module_str, HasSubstr(R"(struct S { field0 : f32; field1 : f32; -}; +} [[group(0), binding(0)]] var x_1 : S; )")) << module_str; @@ -1576,7 +1576,7 @@ TEST_F(SpvModuleScopeVarParserTest, StorageBuffer_NonWritable_NotAllMembers) { EXPECT_THAT(module_str, HasSubstr(R"(struct S { field0 : f32; field1 : f32; -}; +} [[group(0), binding(0)]] var x_1 : S; )")) << module_str; @@ -1608,7 +1608,7 @@ TEST_F( EXPECT_THAT(module_str, HasSubstr(R"(struct S { field0 : f32; field1 : f32; -}; +} [[group(0), binding(0)]] var x_1 : S; )")) << module_str; @@ -2364,7 +2364,7 @@ fn main_1() { struct main_out { [[builtin(sample_mask)]] x_1_1 : u32; -}; +} [[stage(fragment)]] fn main() -> main_out { @@ -2401,7 +2401,7 @@ fn main_1() { struct main_out { [[builtin(sample_mask)]] x_1_1 : u32; -}; +} [[stage(fragment)]] fn main() -> main_out { @@ -2438,7 +2438,7 @@ fn main_1() { struct main_out { [[builtin(sample_mask)]] x_1_1 : u32; -}; +} [[stage(fragment)]] fn main() -> main_out { @@ -2474,7 +2474,7 @@ fn main_1() { struct main_out { [[builtin(sample_mask)]] x_1_1 : u32; -}; +} [[stage(fragment)]] fn main() -> main_out { @@ -2511,7 +2511,7 @@ fn main_1() { struct main_out { [[builtin(sample_mask)]] x_1_1 : u32; -}; +} [[stage(fragment)]] fn main() -> main_out { @@ -2548,7 +2548,7 @@ fn main_1() { struct main_out { [[builtin(sample_mask)]] x_1_1 : u32; -}; +} [[stage(fragment)]] fn main() -> main_out { @@ -2631,7 +2631,7 @@ fn main_1() { struct main_out { [[builtin(sample_mask)]] x_1_1 : u32; -}; +} [[stage(fragment)]] fn main() -> main_out { @@ -2689,7 +2689,7 @@ fn main_1() { struct main_out { [[builtin(position)]] x_4_1 : vec4; -}; +} [[stage(vertex)]] fn main([[builtin(vertex_index)]] x_1_param : u32) -> main_out { @@ -2727,7 +2727,7 @@ fn main_1() { struct main_out { [[builtin(position)]] x_4_1 : vec4; -}; +} [[stage(vertex)]] fn main([[builtin(vertex_index)]] x_1_param : u32) -> main_out { @@ -2764,7 +2764,7 @@ fn main_1() { struct main_out { [[builtin(position)]] x_4_1 : vec4; -}; +} [[stage(vertex)]] fn main([[builtin(vertex_index)]] x_1_param : u32) -> main_out { @@ -2800,7 +2800,7 @@ fn main_1() { struct main_out { [[builtin(position)]] x_4_1 : vec4; -}; +} [[stage(vertex)]] fn main([[builtin(vertex_index)]] x_1_param : u32) -> main_out { @@ -2838,7 +2838,7 @@ fn main_1() { struct main_out { [[builtin(position)]] x_4_1 : vec4; -}; +} [[stage(vertex)]] fn main([[builtin(vertex_index)]] x_1_param : u32) -> main_out { @@ -2875,7 +2875,7 @@ fn main_1() { struct main_out { [[builtin(position)]] x_4_1 : vec4; -}; +} [[stage(vertex)]] fn main([[builtin(vertex_index)]] x_1_param : u32) -> main_out { @@ -2960,7 +2960,7 @@ fn main_1() { struct main_out { [[builtin(position)]] position_1 : vec4; -}; +} [[stage(vertex)]] fn main([[builtin(instance_index)]] x_1_param : u32) -> main_out { @@ -2998,7 +2998,7 @@ fn main_1() { struct main_out { [[builtin(position)]] position_1 : vec4; -}; +} [[stage(vertex)]] fn main([[builtin(instance_index)]] x_1_param : u32) -> main_out { @@ -3035,7 +3035,7 @@ fn main_1() { struct main_out { [[builtin(position)]] position_1 : vec4; -}; +} [[stage(vertex)]] fn main([[builtin(instance_index)]] x_1_param : u32) -> main_out { @@ -3095,7 +3095,7 @@ fn main_1() { struct main_out { [[builtin(position)]] position_1 : vec4; -}; +} [[stage(vertex)]] fn main([[builtin(instance_index)]] x_1_param : u32) -> main_out { @@ -3133,7 +3133,7 @@ fn main_1() { struct main_out { [[builtin(position)]] position_1 : vec4; -}; +} [[stage(vertex)]] fn main([[builtin(instance_index)]] x_1_param : u32) -> main_out { @@ -3170,7 +3170,7 @@ fn main_1() { struct main_out { [[builtin(position)]] position_1 : vec4; -}; +} [[stage(vertex)]] fn main([[builtin(instance_index)]] x_1_param : u32) -> main_out { @@ -3734,7 +3734,7 @@ struct main_out { x_2_1 : u32; [[location(6)]] x_4_1 : u32; -}; +} [[stage(fragment)]] fn main([[location(0)]] x_1_param : u32, [[location(30)]] x_3_param : u32) -> main_out { @@ -3786,7 +3786,7 @@ fn main_1() { struct main_out { [[builtin(position)]] x_4_1 : vec4; -}; +} [[stage(vertex)]] fn main([[builtin(instance_index)]] x_1_param : u32) -> main_out { @@ -3836,7 +3836,7 @@ fn main_1() { struct main_out { [[builtin(position)]] x_4_1 : vec4; -}; +} [[stage(vertex)]] fn main([[builtin(instance_index)]] x_1_param : u32) -> main_out { @@ -3962,7 +3962,7 @@ fn main_1() { struct main_out { [[builtin(sample_mask)]] x_1_1 : u32; -}; +} [[stage(fragment)]] fn main() -> main_out { @@ -4008,7 +4008,7 @@ fn main_1() { struct main_out { [[builtin(sample_mask)]] x_1_1 : u32; -}; +} [[stage(fragment)]] fn main() -> main_out { @@ -4052,7 +4052,7 @@ fn main_1() { struct main_out { [[builtin(frag_depth)]] x_1_1 : f32; -}; +} [[stage(fragment)]] fn main() -> main_out { @@ -4086,7 +4086,7 @@ fn main_1() { struct main_out { [[builtin(position)]] gl_Position : vec4; -}; +} [[stage(vertex)]] fn main() -> main_out { @@ -4156,7 +4156,7 @@ fn main_1() { struct main_out { [[builtin(position)]] gl_Position : vec4; -}; +} [[stage(vertex)]] fn main() -> main_out { @@ -4213,7 +4213,7 @@ fn main_1() { struct main_out { [[builtin(position)]] x_2_1 : vec4; -}; +} [[stage(vertex)]] fn main([[location(4)]] x_1_param : f32, [[location(5)]] x_1_param_1 : f32, [[location(6)]] x_1_param_2 : f32) -> main_out { @@ -4271,7 +4271,7 @@ fn main_1() { struct main_out { [[builtin(position)]] x_2_1 : vec4; -}; +} [[stage(vertex)]] fn main([[location(9)]] x_1_param : vec4, [[location(10)]] x_1_param_1 : vec4) -> main_out { @@ -4325,7 +4325,7 @@ TEST_F(SpvModuleScopeVarParserTest, Input_FlattenStruct_LocOnVariable) { const std::string expected = R"(struct Communicators { alice : f32; bob : vec4; -}; +} var x_1 : Communicators; @@ -4338,7 +4338,7 @@ fn main_1() { struct main_out { [[builtin(position)]] x_2_1 : vec4; -}; +} [[stage(vertex)]] fn main([[location(9)]] x_1_param : f32, [[location(10)]] x_1_param_1 : vec4) -> main_out { @@ -4397,7 +4397,7 @@ fn main_1() { struct main_out { [[builtin(position)]] x_2_1 : vec4; -}; +} [[stage(vertex)]] fn main([[location(7)]] x_1_param : vec4, [[location(8)]] x_1_param_1 : vec4, [[location(9)]] x_1_param_2 : vec4, [[location(10)]] x_1_param_3 : vec4) -> main_out { @@ -4464,7 +4464,7 @@ struct main_out { x_1_3 : f32; [[builtin(position)]] x_2_1 : vec4; -}; +} [[stage(vertex)]] fn main() -> main_out { @@ -4523,7 +4523,7 @@ struct main_out { x_1_2 : vec4; [[builtin(position)]] x_2_1 : vec4; -}; +} [[stage(vertex)]] fn main() -> main_out { @@ -4575,7 +4575,7 @@ TEST_F(SpvModuleScopeVarParserTest, Output_FlattenStruct_LocOnVariable) { const std::string expected = R"(struct Communicators { alice : f32; bob : vec4; -}; +} var x_1 : Communicators; @@ -4592,7 +4592,7 @@ struct main_out { x_1_2 : vec4; [[builtin(position)]] x_2_1 : vec4; -}; +} [[stage(vertex)]] fn main() -> main_out { @@ -4648,7 +4648,7 @@ TEST_F(SpvModuleScopeVarParserTest, FlattenStruct_LocOnMembers) { const std::string expected = R"(struct Communicators { alice : f32; bob : vec4; -}; +} var x_1 : Communicators; @@ -4667,7 +4667,7 @@ struct main_out { x_3_1 : f32; [[location(11)]] x_3_2 : vec4; -}; +} [[stage(vertex)]] fn main([[location(9)]] x_1_param : f32, [[location(11)]] x_1_param_1 : vec4) -> main_out { @@ -4748,7 +4748,7 @@ fn main_1() { struct main_out { [[builtin(position)]] x_10_1 : vec4; -}; +} [[stage(vertex)]] fn main([[location(1), interpolate(flat)]] x_1_param : u32, [[location(2), interpolate(flat)]] x_2_param : vec2, [[location(3), interpolate(flat)]] x_3_param : i32, [[location(4), interpolate(flat)]] x_4_param : vec2, [[location(5), interpolate(flat)]] x_5_param : f32, [[location(6), interpolate(flat)]] x_6_param : vec2) -> main_out { @@ -4845,7 +4845,7 @@ struct main_out { x_6_1 : vec2; [[builtin(position)]] x_10_1 : vec4; -}; +} [[stage(vertex)]] fn main() -> main_out { @@ -4889,7 +4889,7 @@ TEST_F(SpvModuleScopeVarParserTest, R"(struct S { field0 : f32; field1 : f32; -}; +} var x_1 : array; @@ -5035,7 +5035,7 @@ TEST_F(SpvModuleScopeVarParserTest, field3 : f32; field4 : f32; field5 : f32; -}; +} var x_1 : S; @@ -5134,7 +5134,7 @@ struct main_out { x_5_1 : f32; [[location(6), interpolate(linear, sample)]] x_6_1 : f32; -}; +} [[stage(fragment)]] fn main() -> main_out { @@ -5192,7 +5192,7 @@ TEST_F(SpvModuleScopeVarParserTest, field3 : f32; field4 : f32; field5 : f32; -}; +} var x_1 : S; @@ -5213,7 +5213,7 @@ struct main_out { x_1_5 : f32; [[location(6), interpolate(linear, sample)]] x_1_6 : f32; -}; +} [[stage(fragment)]] fn main() -> main_out { diff --git a/src/reader/spirv/parser_impl_named_types_test.cc b/src/reader/spirv/parser_impl_named_types_test.cc index c9a951c6c3..f59322242a 100644 --- a/src/reader/spirv/parser_impl_named_types_test.cc +++ b/src/reader/spirv/parser_impl_named_types_test.cc @@ -56,7 +56,7 @@ TEST_F(SpvParserTest, NamedTypes_Dup_EmitBoth) { EXPECT_THAT(test::ToString(p->program()), HasSubstr(R"(struct S { field0 : u32; field1 : u32; -}; +} struct S_1 { field0 : u32; diff --git a/src/reader/wgsl/parser_impl.cc b/src/reader/wgsl/parser_impl.cc index 719e1b942c..cdc9b8727c 100644 --- a/src/reader/wgsl/parser_impl.cc +++ b/src/reader/wgsl/parser_impl.cc @@ -349,7 +349,7 @@ void ParserImpl::translation_unit() { // | global_variable_decl SEMICLON // | global_constant_decl SEMICOLON // | type_alias SEMICOLON -// | struct_decl SEMICOLON +// | struct_decl // | function_decl Expect ParserImpl::expect_global_decl() { if (match(Token::Type::kSemicolon) || match(Token::Type::kEOF)) @@ -404,9 +404,6 @@ Expect ParserImpl::expect_global_decl() { return Failure::kErrored; if (str.matched) { - if (!expect("struct declaration", Token::Type::kSemicolon)) - return Failure::kErrored; - builder_.AST().AddTypeDecl(str.value); return true; } diff --git a/src/reader/wgsl/parser_impl_error_msg_test.cc b/src/reader/wgsl/parser_impl_error_msg_test.cc index 6d1ff74977..29f5a7ea93 100644 --- a/src/reader/wgsl/parser_impl_error_msg_test.cc +++ b/src/reader/wgsl/parser_impl_error_msg_test.cc @@ -636,13 +636,6 @@ TEST_F(ParserImplErrorTest, GlobalDeclStructDeclMissingIdentifier) { " ^\n"); } -TEST_F(ParserImplErrorTest, GlobalDeclStructDeclMissingSemicolon) { - EXPECT("struct S {}", - "test.wgsl:1:12 error: expected ';' for struct declaration\n" - "struct S {}\n" - " ^\n"); -} - TEST_F(ParserImplErrorTest, GlobalDeclStructDeclMissingLBrace) { EXPECT("struct S };", "test.wgsl:1:10 error: expected '{' for struct declaration\n" diff --git a/src/reader/wgsl/parser_impl_global_decl_test.cc b/src/reader/wgsl/parser_impl_global_decl_test.cc index 175947c951..d880e4aeba 100644 --- a/src/reader/wgsl/parser_impl_global_decl_test.cc +++ b/src/reader/wgsl/parser_impl_global_decl_test.cc @@ -93,7 +93,7 @@ TEST_F(ParserImplTest, GlobalDecl_TypeAlias) { TEST_F(ParserImplTest, GlobalDecl_TypeAlias_StructIdent) { auto p = parser(R"(struct A { a : f32; -}; +} type B = A;)"); p->expect_global_decl(); 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(); @@ -167,7 +167,7 @@ TEST_F(ParserImplTest, GlobalDecl_ParsesStruct) { } TEST_F(ParserImplTest, GlobalDecl_Struct_WithStride) { - auto p = parser("struct A { data: [[stride(4)]] array; };"); + auto p = parser("struct A { data: [[stride(4)]] array; }"); p->expect_global_decl(); ASSERT_FALSE(p->has_error()) << p->error(); @@ -195,7 +195,7 @@ TEST_F(ParserImplTest, GlobalDecl_Struct_WithStride) { // TODO(crbug.com/tint/1324): DEPRECATED: Remove when [[block]] is removed. TEST_F(ParserImplTest, GlobalDecl_Struct_WithDecoration) { - auto p = parser("[[block]] struct A { data: f32; };"); + auto p = parser("[[block]] struct A { data: f32; }"); p->expect_global_decl(); ASSERT_FALSE(p->has_error()) << p->error(); @@ -212,19 +212,12 @@ TEST_F(ParserImplTest, GlobalDecl_Struct_WithDecoration) { } TEST_F(ParserImplTest, GlobalDecl_Struct_Invalid) { - auto p = parser("A {};"); + auto p = parser("A {}"); p->expect_global_decl(); ASSERT_TRUE(p->has_error()); EXPECT_EQ(p->error(), "1:1: unexpected token"); } -TEST_F(ParserImplTest, GlobalDecl_StructMissing_Semi) { - auto p = parser("struct A {}"); - p->expect_global_decl(); - ASSERT_TRUE(p->has_error()); - EXPECT_EQ(p->error(), "1:12: expected ';' for struct declaration"); -} - } // namespace } // namespace wgsl } // namespace reader diff --git a/src/reader/wgsl/parser_impl_primary_expression_test.cc b/src/reader/wgsl/parser_impl_primary_expression_test.cc index 97fc0d1ec0..868e39b136 100644 --- a/src/reader/wgsl/parser_impl_primary_expression_test.cc +++ b/src/reader/wgsl/parser_impl_primary_expression_test.cc @@ -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) )"); diff --git a/src/reader/wgsl/parser_impl_test.cc b/src/reader/wgsl/parser_impl_test.cc index 155113de2a..269cc9b84c 100644 --- a/src/reader/wgsl/parser_impl_test.cc +++ b/src/reader/wgsl/parser_impl_test.cc @@ -37,6 +37,27 @@ fn main() -> [[location(0)]] vec4 { ASSERT_EQ(1u, program.AST().Functions().size()); } +TEST_F(ParserImplTest, Parses_ExtraSemicolons) { + auto p = parser(R"( +; +struct S { + a : f32; +};; +; +fn foo() -> S { + ; + return S();;; + ; +};; +; +)"); + ASSERT_TRUE(p->Parse()) << p->error(); + + Program program = p->program(); + ASSERT_EQ(1u, program.AST().Functions().size()); + ASSERT_EQ(1u, program.AST().TypeDecls().size()); +} + TEST_F(ParserImplTest, HandlesError) { auto p = parser(R"( fn main() -> { // missing return type diff --git a/src/transform/add_spirv_block_decoration_test.cc b/src/transform/add_spirv_block_decoration_test.cc index 74e4b33386..e504c500d2 100644 --- a/src/transform/add_spirv_block_decoration_test.cc +++ b/src/transform/add_spirv_block_decoration_test.cc @@ -38,7 +38,7 @@ TEST_F(AddSpirvBlockDecorationTest, Noop_UsedForPrivateVar) { auto* src = R"( struct S { f : f32; -}; +} var p : S; @@ -59,7 +59,7 @@ TEST_F(AddSpirvBlockDecorationTest, Noop_UsedForShaderIO) { struct S { [[location(0)]] f : f32; -}; +} [[stage(fragment)]] fn main() -> S { @@ -87,7 +87,7 @@ fn main() { [[internal(spirv_block)]] struct u_block { inner : f32; -}; +} [[group(0), binding(0)]] var u : u_block; @@ -116,7 +116,7 @@ fn main() { [[internal(spirv_block)]] struct u_block { inner : array, 4u>; -}; +} [[group(0), binding(0)]] var u : u_block; @@ -149,7 +149,7 @@ type Numbers = array, 4u>; [[internal(spirv_block)]] struct u_block { inner : array, 4u>; -}; +} [[group(0), binding(0)]] var u : u_block; @@ -182,7 +182,7 @@ fn main() { [[internal(spirv_block)]] struct S { f : f32; -}; +} [[group(0), binding(0)]] var u : S; @@ -218,12 +218,12 @@ fn main() { auto* expect = R"( struct Inner { f : f32; -}; +} [[internal(spirv_block)]] struct Outer { i : Inner; -}; +} [[group(0), binding(0)]] var u : Outer; @@ -263,19 +263,19 @@ fn main() { auto* expect = R"( struct Inner { f : f32; -}; +} [[internal(spirv_block)]] struct Outer { i : Inner; -}; +} [[group(0), binding(0)]] var u0 : Outer; [[internal(spirv_block)]] struct u1_block { inner : Inner; -}; +} [[group(0), binding(1)]] var u1 : u1_block; @@ -315,18 +315,18 @@ fn main() { auto* expect = R"( struct Inner { f : f32; -}; +} struct Outer { i : Inner; -}; +} var p : Outer; [[internal(spirv_block)]] struct u_block { inner : Inner; -}; +} [[group(0), binding(1)]] var u : u_block; @@ -371,19 +371,19 @@ fn main() { auto* expect = R"( struct Inner { f : f32; -}; +} [[internal(spirv_block)]] struct S { i : Inner; -}; +} [[group(0), binding(0)]] var u0 : S; [[internal(spirv_block)]] struct u1_block { inner : Inner; -}; +} [[group(0), binding(1)]] var u1 : u1_block; @@ -420,12 +420,12 @@ fn main() { auto* expect = R"( struct S { f : f32; -}; +} [[internal(spirv_block)]] struct u_block { inner : S; -}; +} [[group(0), binding(0)]] var u : u_block; @@ -463,12 +463,12 @@ fn main() { auto* expect = R"( struct S { f : f32; -}; +} [[internal(spirv_block)]] struct u0_block { inner : S; -}; +} [[group(0), binding(0)]] var u0 : u0_block; @@ -516,14 +516,14 @@ fn main() { auto* expect = R"( struct Inner { f : f32; -}; +} type MyInner = Inner; [[internal(spirv_block)]] struct Outer { i : MyInner; -}; +} type MyOuter = Outer; @@ -532,7 +532,7 @@ type MyOuter = Outer; [[internal(spirv_block)]] struct u1_block { inner : Inner; -}; +} [[group(0), binding(1)]] var u1 : u1_block; diff --git a/src/transform/array_length_from_uniform_test.cc b/src/transform/array_length_from_uniform_test.cc index 77fb0c3d75..b9139a99ce 100644 --- a/src/transform/array_length_from_uniform_test.cc +++ b/src/transform/array_length_from_uniform_test.cc @@ -63,7 +63,7 @@ fn main() { auto* expect = R"( struct tint_symbol { buffer_size : array, 1u>; -}; +} [[group(0), binding(30)]] var tint_symbol_1 : tint_symbol; @@ -106,14 +106,14 @@ fn main() { auto* expect = R"( struct tint_symbol { buffer_size : array, 1u>; -}; +} [[group(0), binding(30)]] var tint_symbol_1 : tint_symbol; struct SB { x : i32; arr : array; -}; +} [[group(0), binding(0)]] var sb : SB; @@ -149,7 +149,7 @@ fn main() { auto* expect = R"( struct tint_symbol { buffer_size : array, 1u>; -}; +} [[group(0), binding(30)]] var tint_symbol_1 : tint_symbol; @@ -193,7 +193,7 @@ fn main() { auto* expect = R"( struct tint_symbol { buffer_size : array, 1u>; -}; +} [[group(0), binding(30)]] var tint_symbol_1 : tint_symbol; @@ -201,7 +201,7 @@ struct SB { x : i32; y : f32; arr : [[stride(64)]] array; -}; +} [[group(0), binding(0)]] var sb : SB; @@ -259,24 +259,24 @@ fn main() { auto* expect = R"( struct tint_symbol { buffer_size : array, 2u>; -}; +} [[group(0), binding(30)]] var tint_symbol_1 : tint_symbol; struct SB1 { x : i32; arr1 : array; -}; +} struct SB2 { x : i32; arr2 : array>; -}; +} struct SB4 { x : i32; arr4 : array>; -}; +} [[group(0), binding(2)]] var sb1 : SB1; @@ -348,24 +348,24 @@ fn main() { auto* expect = R"( struct tint_symbol { buffer_size : array, 1u>; -}; +} [[group(0), binding(30)]] var tint_symbol_1 : tint_symbol; struct SB1 { x : i32; arr1 : array; -}; +} struct SB2 { x : i32; arr2 : array>; -}; +} struct SB4 { x : i32; arr4 : array>; -}; +} [[group(0), binding(2)]] var sb1 : SB1; @@ -407,7 +407,7 @@ TEST_F(ArrayLengthFromUniformTest, NoArrayLengthCalls) { struct SB { x : i32; arr : array; -}; +} [[group(0), binding(0)]] var sb : SB; @@ -457,19 +457,19 @@ fn main() { auto* expect = R"( struct tint_symbol { buffer_size : array, 1u>; -}; +} [[group(0), binding(30)]] var tint_symbol_1 : tint_symbol; struct SB1 { x : i32; arr1 : array; -}; +} struct SB2 { x : i32; arr2 : array>; -}; +} [[group(0), binding(2)]] var sb1 : SB1; diff --git a/src/transform/binding_remapper_test.cc b/src/transform/binding_remapper_test.cc index 87e205aaf8..de85cb0e93 100644 --- a/src/transform/binding_remapper_test.cc +++ b/src/transform/binding_remapper_test.cc @@ -28,7 +28,7 @@ TEST_F(BindingRemapperTest, NoRemappings) { auto* src = R"( struct S { a : f32; -}; +} [[group(2), binding(1)]] var a : S; @@ -67,7 +67,7 @@ fn f() { auto* expect = R"( struct S { a : f32; -}; +} [[group(1), binding(2)]] var a : S; @@ -111,7 +111,7 @@ fn f() { auto* expect = R"( struct S { a : f32; -}; +} [[group(2), binding(1)]] var a : S; @@ -215,7 +215,7 @@ fn f() { auto* expect = R"( struct S { a : f32; -}; +} [[group(4), binding(5)]] var a : S; @@ -264,7 +264,7 @@ fn f() { auto* expect = R"( struct S { i : i32; -}; +} [[internal(disable_validation__binding_point_collision), group(1), binding(1)]] var a : S; @@ -321,7 +321,7 @@ fn f2() { auto* expect = R"( struct S { i : i32; -}; +} [[group(1), binding(1)]] var a : S; diff --git a/src/transform/calculate_array_length_test.cc b/src/transform/calculate_array_length_test.cc index 4b42bf9084..83e0ac7f9b 100644 --- a/src/transform/calculate_array_length_test.cc +++ b/src/transform/calculate_array_length_test.cc @@ -85,7 +85,7 @@ fn main() { struct SB { x : i32; arr : array; -}; +} [[internal(intrinsic_buffer_size)]] fn tint_symbol([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, result : ptr) @@ -161,7 +161,7 @@ fn main() { struct SB { x : i32; arr : array; -}; +} [[internal(intrinsic_buffer_size)]] fn tint_symbol([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, result : ptr) @@ -235,7 +235,7 @@ struct SB { x : i32; y : f32; arr : [[stride(64)]] array; -}; +} [[internal(intrinsic_buffer_size)]] fn tint_symbol([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, result : ptr) @@ -281,7 +281,7 @@ fn main() { struct SB { x : i32; arr : array; -}; +} [[internal(intrinsic_buffer_size)]] fn tint_symbol([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, result : ptr) @@ -345,7 +345,7 @@ fn tint_symbol_6([[internal(disable_validation__ignore_constructible_function_pa struct SB1 { x : i32; arr1 : array; -}; +} [[internal(intrinsic_buffer_size)]] fn tint_symbol([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB1, result : ptr) @@ -353,7 +353,7 @@ fn tint_symbol([[internal(disable_validation__ignore_constructible_function_para struct SB2 { x : i32; arr2 : array>; -}; +} [[internal(intrinsic_buffer_size)]] fn tint_symbol_3([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB2, result : ptr) @@ -412,7 +412,7 @@ fn main() { struct SB { x : i32; arr : array; -}; +} [[internal(intrinsic_buffer_size)]] fn tint_symbol([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, result : ptr) diff --git a/src/transform/canonicalize_entry_point_io_test.cc b/src/transform/canonicalize_entry_point_io_test.cc index e2daa978e6..3c16ee5b0a 100644 --- a/src/transform/canonicalize_entry_point_io_test.cc +++ b/src/transform/canonicalize_entry_point_io_test.cc @@ -121,7 +121,7 @@ struct tint_symbol_1 { loc1 : f32; [[location(2)]] loc2 : vec4; -}; +} fn frag_main_inner(loc1 : f32, loc2 : vec4, coord : vec4) { var col : f32 = (coord.x * loc1); @@ -159,7 +159,7 @@ struct tint_symbol_1 { loc2 : vec4; [[builtin(position)]] coord : vec4; -}; +} fn frag_main_inner(loc1 : f32, loc2 : vec4, coord : vec4) { var col : f32 = (coord.x * loc1); @@ -195,7 +195,7 @@ type myf32 = f32; struct tint_symbol_1 { [[location(1)]] loc1 : f32; -}; +} fn frag_main_inner(loc1 : myf32) { var x : myf32 = loc1; @@ -244,12 +244,12 @@ fn frag_main([[location(0)]] loc0 : f32, struct FragBuiltins { coord : vec4; -}; +} struct FragLocations { loc1 : f32; loc2 : vec4; -}; +} fn frag_main_inner(loc0 : f32, locations : FragLocations, builtins : FragBuiltins) { var col : f32 = ((builtins.coord.x * locations.loc1) + loc0); @@ -290,12 +290,12 @@ fn frag_main([[location(0)]] loc0 : f32, auto* expect = R"( struct FragBuiltins { coord : vec4; -}; +} struct FragLocations { loc1 : f32; loc2 : vec4; -}; +} struct tint_symbol_1 { [[location(0)]] @@ -304,7 +304,7 @@ struct tint_symbol_1 { loc1 : f32; [[location(2)]] loc2 : vec4; -}; +} fn frag_main_inner(loc0 : f32, locations : FragLocations, builtins : FragBuiltins) { var col : f32 = ((builtins.coord.x * locations.loc1) + loc0); @@ -345,12 +345,12 @@ fn frag_main([[location(0)]] loc0 : f32, auto* expect = R"( struct FragBuiltins { coord : vec4; -}; +} struct FragLocations { loc1 : f32; loc2 : vec4; -}; +} struct tint_symbol_1 { [[location(0)]] @@ -361,7 +361,7 @@ struct tint_symbol_1 { loc2 : vec4; [[builtin(position)]] coord : vec4; -}; +} fn frag_main_inner(loc0 : f32, locations : FragLocations, builtins : FragBuiltins) { var col : f32 = ((builtins.coord.x * locations.loc1) + loc0); @@ -423,7 +423,7 @@ fn frag_main() -> [[builtin(frag_depth)]] f32 { struct tint_symbol { [[builtin(frag_depth)]] value : f32; -}; +} fn frag_main_inner() -> f32 { return 1.0; @@ -458,7 +458,7 @@ fn frag_main() -> [[builtin(frag_depth)]] f32 { struct tint_symbol { [[builtin(frag_depth)]] value : f32; -}; +} fn frag_main_inner() -> f32 { return 1.0; @@ -510,7 +510,7 @@ struct FragOutput { color : vec4; depth : f32; mask : u32; -}; +} fn frag_main_inner() -> FragOutput { var output : FragOutput; @@ -560,7 +560,7 @@ struct FragOutput { color : vec4; depth : f32; mask : u32; -}; +} struct tint_symbol { [[location(0)]] @@ -569,7 +569,7 @@ struct tint_symbol { depth : f32; [[builtin(sample_mask)]] mask : u32; -}; +} fn frag_main_inner() -> FragOutput { var output : FragOutput; @@ -621,7 +621,7 @@ struct FragOutput { color : vec4; depth : f32; mask : u32; -}; +} struct tint_symbol { [[location(0)]] @@ -630,7 +630,7 @@ struct tint_symbol { depth : f32; [[builtin(sample_mask)]] mask : u32; -}; +} fn frag_main_inner() -> FragOutput { var output : FragOutput; @@ -694,7 +694,7 @@ fn frag_main2(inputs : FragmentInput) { struct FragmentInput { value : f32; mul : f32; -}; +} fn foo(x : FragmentInput) -> f32 { return (x.value * x.mul); @@ -754,7 +754,7 @@ fn frag_main2(inputs : FragmentInput) { struct FragmentInput { value : f32; mul : f32; -}; +} fn foo(x : FragmentInput) -> f32 { return (x.value * x.mul); @@ -765,7 +765,7 @@ struct tint_symbol_1 { value : f32; [[location(1)]] mul : f32; -}; +} fn frag_main1_inner(inputs : FragmentInput) { var x : f32 = foo(inputs); @@ -781,7 +781,7 @@ struct tint_symbol_3 { value : f32; [[location(1)]] mul : f32; -}; +} fn frag_main2_inner(inputs : FragmentInput) { var x : f32 = foo(inputs); @@ -828,7 +828,7 @@ fn frag_main2(inputs : FragmentInput) { struct FragmentInput { value : f32; mul : f32; -}; +} fn foo(x : FragmentInput) -> f32 { return (x.value * x.mul); @@ -839,7 +839,7 @@ struct tint_symbol_1 { value : f32; [[location(1)]] mul : f32; -}; +} fn frag_main1_inner(inputs : FragmentInput) { var x : f32 = foo(inputs); @@ -855,7 +855,7 @@ struct tint_symbol_3 { value : f32; [[location(1)]] mul : f32; -}; +} fn frag_main2_inner(inputs : FragmentInput) { var x : f32 = foo(inputs); @@ -904,7 +904,7 @@ fn frag_main1(inputs : FragmentInput) { struct FragmentInput { col1 : f32; col2 : f32; -}; +} var global_inputs : FragmentInput; @@ -921,7 +921,7 @@ struct tint_symbol_1 { col1 : f32; [[location(1)]] col2 : f32; -}; +} fn frag_main1_inner(inputs : FragmentInput) { global_inputs = inputs; @@ -978,12 +978,12 @@ type myf32 = f32; struct FragmentInput { col1 : myf32; col2 : myf32; -}; +} struct FragmentOutput { col1 : myf32; col2 : myf32; -}; +} type MyFragmentInput = FragmentInput; @@ -998,14 +998,14 @@ struct tint_symbol_1 { col1 : f32; [[location(1)]] col2 : f32; -}; +} struct tint_symbol_2 { [[location(0)]] col1 : f32; [[location(1)]] col2 : f32; -}; +} fn frag_main_inner(inputs : MyFragmentInput) -> MyFragmentOutput { var x : myf32 = foo(inputs); @@ -1062,12 +1062,12 @@ struct VertexOut { loc1 : f32; loc2 : f32; loc3 : f32; -}; +} struct FragmentIn { loc1 : f32; loc2 : f32; -}; +} struct tint_symbol { [[location(1), interpolate(flat)]] @@ -1078,7 +1078,7 @@ struct tint_symbol { loc3 : f32; [[builtin(position)]] pos : vec4; -}; +} fn vert_main_inner() -> VertexOut { return VertexOut(); @@ -1102,7 +1102,7 @@ struct tint_symbol_2 { loc2 : f32; [[location(3), interpolate(perspective, centroid)]] loc3 : f32; -}; +} fn frag_main_inner(inputs : FragmentIn, loc3 : f32) { let x = ((inputs.loc1 + inputs.loc2) + loc3); @@ -1200,7 +1200,7 @@ struct VertexIn { u : u32; vi : vec4; vu : vec4; -}; +} struct VertexOut { i : i32; @@ -1208,14 +1208,14 @@ struct VertexOut { vi : vec4; vu : vec4; pos : vec4; -}; +} struct FragmentInterface { i : i32; u : u32; vi : vec4; vu : vec4; -}; +} fn vert_main_inner(in : VertexIn) -> VertexOut { return VertexOut(in.i, in.u, in.vi, in.vu, vec4()); @@ -1273,12 +1273,12 @@ fn main2() -> [[builtin(position), invariant]] vec4 { auto* expect = R"( struct VertexOut { pos : vec4; -}; +} struct tint_symbol { [[builtin(position), invariant]] pos : vec4; -}; +} fn main1_inner() -> VertexOut { return VertexOut(); @@ -1295,7 +1295,7 @@ fn main1() -> tint_symbol { struct tint_symbol_1 { [[builtin(position), invariant]] value : vec4; -}; +} fn main2_inner() -> vec4 { return vec4(); @@ -1344,12 +1344,12 @@ struct FragmentInput { coord : vec4; [[align(128)]] loc0 : f32; -}; +} struct FragmentOutput { [[size(16)]] value : f32; -}; +} struct tint_symbol_1 { [[location(0), interpolate(linear, sample)]] @@ -1358,12 +1358,12 @@ struct tint_symbol_1 { value : f32; [[builtin(position)]] coord : vec4; -}; +} struct tint_symbol_2 { [[location(1), interpolate(flat)]] value : f32; -}; +} fn frag_main_inner(inputs : FragmentInput) -> FragmentOutput { return FragmentOutput(((inputs.coord.x * inputs.value) + inputs.loc0)); @@ -1422,13 +1422,13 @@ struct VertexOutput { d : u32; a : f32; c : i32; -}; +} struct FragmentInputExtra { d : u32; pos : vec4; a : f32; -}; +} struct tint_symbol { [[location(0)]] @@ -1441,7 +1441,7 @@ struct tint_symbol { d : u32; [[builtin(position)]] pos : vec4; -}; +} fn vert_main_inner() -> VertexOutput { return VertexOutput(); @@ -1472,7 +1472,7 @@ struct tint_symbol_2 { pos : vec4; [[builtin(front_facing)]] ff : bool; -}; +} fn frag_main_inner(ff : bool, c : i32, inputs : FragmentInputExtra, b : u32) { } @@ -1502,7 +1502,7 @@ fn tint_symbol_1([[location(0)]] col : f32) { struct tint_symbol_2 { [[location(0)]] col : f32; -}; +} fn tint_symbol_1_inner(col : f32) { } @@ -1532,7 +1532,7 @@ fn frag_main() { struct tint_symbol { [[builtin(sample_mask)]] fixed_sample_mask : u32; -}; +} fn frag_main_inner() { } @@ -1566,7 +1566,7 @@ fn frag_main() { struct tint_symbol { [[builtin(sample_mask)]] fixed_sample_mask : u32; -}; +} fn frag_main_inner() { return; @@ -1601,7 +1601,7 @@ fn frag_main() -> [[builtin(sample_mask)]] u32 { struct tint_symbol { [[builtin(sample_mask)]] value : u32; -}; +} fn frag_main_inner() -> u32 { return 7u; @@ -1638,7 +1638,7 @@ struct tint_symbol { value : f32; [[builtin(sample_mask)]] fixed_sample_mask : u32; -}; +} fn frag_main_inner() -> f32 { return 1.0; @@ -1681,7 +1681,7 @@ struct Output { depth : f32; mask : u32; value : f32; -}; +} struct tint_symbol { [[location(0)]] @@ -1690,7 +1690,7 @@ struct tint_symbol { depth : f32; [[builtin(sample_mask)]] mask : u32; -}; +} fn frag_main_inner() -> Output { return Output(0.5, 7u, 1.0); @@ -1733,7 +1733,7 @@ fn frag_main() -> Output { struct Output { depth : f32; value : f32; -}; +} struct tint_symbol { [[location(0)]] @@ -1742,7 +1742,7 @@ struct tint_symbol { depth : f32; [[builtin(sample_mask)]] fixed_sample_mask : u32; -}; +} fn frag_main_inner() -> Output { return Output(0.5, 1.0); @@ -1793,7 +1793,7 @@ fn comp_main1() { struct tint_symbol { [[builtin(sample_mask)]] value : u32; -}; +} fn frag_main1_inner() -> u32 { return 7u; @@ -1812,7 +1812,7 @@ struct tint_symbol_1 { value : f32; [[builtin(sample_mask)]] fixed_sample_mask : u32; -}; +} fn frag_main2_inner() -> f32 { return 1.0; @@ -1830,7 +1830,7 @@ fn frag_main2() -> tint_symbol_1 { struct tint_symbol_2 { [[builtin(position)]] value : vec4; -}; +} fn vert_main1_inner() -> vec4 { return vec4(); @@ -1874,7 +1874,7 @@ fn frag_main() -> FragOut { struct FragOut { fixed_sample_mask : vec4; fixed_sample_mask_1 : vec4; -}; +} struct tint_symbol { [[location(0)]] @@ -1883,7 +1883,7 @@ struct tint_symbol { fixed_sample_mask_1 : vec4; [[builtin(sample_mask)]] fixed_sample_mask_2 : u32; -}; +} fn frag_main_inner() -> FragOut { return FragOut(); @@ -1956,7 +1956,7 @@ struct tint_symbol { value : vec4; [[builtin(pointsize)]] vertex_point_size : f32; -}; +} fn vert_main_inner() -> vec4 { return vec4(); @@ -1999,7 +1999,7 @@ fn vert_main() -> VertOut { struct VertOut { pos : vec4; -}; +} fn vert_main_inner() -> VertOut { return VertOut(); @@ -2036,14 +2036,14 @@ fn vert_main() -> VertOut { auto* expect = R"( struct VertOut { pos : vec4; -}; +} struct tint_symbol { [[builtin(position)]] pos : vec4; [[builtin(pointsize)]] vertex_point_size : f32; -}; +} fn vert_main_inner() -> VertOut { return VertOut(); @@ -2112,16 +2112,16 @@ var vertex_point_size_2 : f32; struct VertIn1 { collide : f32; -}; +} struct VertIn2 { collide : f32; -}; +} struct VertOut { vertex_point_size : f32; vertex_point_size_1 : vec4; -}; +} fn vert_main_inner(collide : VertIn1, collide_1 : VertIn2) -> VertOut { let x = (collide.collide + collide_1.collide); @@ -2170,23 +2170,23 @@ fn vert_main(collide : VertIn1, collide_1 : VertIn2) -> VertOut { auto* expect = R"( struct VertIn1 { collide : f32; -}; +} struct VertIn2 { collide : f32; -}; +} struct VertOut { vertex_point_size : vec4; vertex_point_size_1 : vec4; -}; +} struct tint_symbol_1 { [[location(0)]] collide : f32; [[location(1)]] collide_2 : f32; -}; +} struct tint_symbol_2 { [[location(0)]] @@ -2195,7 +2195,7 @@ struct tint_symbol_2 { vertex_point_size_1 : vec4; [[builtin(pointsize)]] vertex_point_size_2 : f32; -}; +} fn vert_main_inner(collide : VertIn1, collide_1 : VertIn2) -> VertOut { let x = (collide.collide + collide_1.collide); @@ -2246,23 +2246,23 @@ fn vert_main(collide : VertIn1, collide_1 : VertIn2) -> VertOut { auto* expect = R"( struct VertIn1 { collide : f32; -}; +} struct VertIn2 { collide : f32; -}; +} struct VertOut { vertex_point_size : vec4; vertex_point_size_1 : vec4; -}; +} struct tint_symbol_1 { [[location(0)]] collide : f32; [[location(1)]] collide_2 : f32; -}; +} struct tint_symbol_2 { [[location(0)]] @@ -2271,7 +2271,7 @@ struct tint_symbol_2 { vertex_point_size_1 : vec4; [[builtin(pointsize)]] vertex_point_size_2 : f32; -}; +} fn vert_main_inner(collide : VertIn1, collide_1 : VertIn2) -> VertOut { let x = (collide.collide + collide_1.collide); diff --git a/src/transform/decompose_memory_access_test.cc b/src/transform/decompose_memory_access_test.cc index 046d88ccc3..c28f48e1eb 100644 --- a/src/transform/decompose_memory_access_test.cc +++ b/src/transform/decompose_memory_access_test.cc @@ -102,7 +102,7 @@ struct SB { t : mat4x3; u : mat4x4; v : array, 2>; -}; +} [[group(0), binding(0)]] var sb : SB; @@ -298,7 +298,7 @@ struct UB { t : mat4x3; u : mat4x4; v : array, 2>; -}; +} [[group(0), binding(0)]] var ub : UB; @@ -494,7 +494,7 @@ struct SB { t : mat4x3; u : mat4x4; v : array, 2>; -}; +} [[group(0), binding(0)]] var sb : SB; @@ -686,7 +686,7 @@ struct SB { t : mat4x3; u : mat4x4; v : array, 2>; -}; +} [[group(0), binding(0)]] var sb : SB; @@ -844,7 +844,7 @@ struct SB { t : mat4x3; u : mat4x4; v : array, 2>; -}; +} [[group(0), binding(0)]] var sb : SB; @@ -1021,19 +1021,19 @@ struct S1 { a : i32; b : vec3; c : i32; -}; +} struct S2 { a : i32; b : [[stride(32)]] array; c : i32; -}; +} struct SB { [[size(128)]] a : i32; b : [[stride(256)]] array; -}; +} [[group(0), binding(0)]] var sb : SB; @@ -1087,19 +1087,19 @@ struct S1 { a : i32; b : vec3; c : i32; -}; +} struct S2 { a : i32; b : [[stride(32)]] array; c : i32; -}; +} struct SB { [[size(128)]] a : i32; b : [[stride(256)]] array; -}; +} [[group(0), binding(0)]] var sb : SB; @@ -1164,7 +1164,7 @@ struct S1 { a : i32; b : vec3; c : i32; -}; +} type A1 = S1; @@ -1174,7 +1174,7 @@ struct S2 { a : i32; b : A1_Array; c : i32; -}; +} type A2 = S2; @@ -1184,7 +1184,7 @@ struct SB { [[size(128)]] a : i32; b : A2_Array; -}; +} [[group(0), binding(0)]] var sb : SB; @@ -1248,7 +1248,7 @@ struct SB { padding : vec4; a : atomic; b : atomic; -}; +} [[group(0), binding(0)]] var sb : SB; @@ -1356,7 +1356,7 @@ struct S { padding : vec4; a : atomic; b : atomic; -}; +} var w : S; diff --git a/src/transform/decompose_strided_matrix_test.cc b/src/transform/decompose_strided_matrix_test.cc index 41555dc0af..db31c62c90 100644 --- a/src/transform/decompose_strided_matrix_test.cc +++ b/src/transform/decompose_strided_matrix_test.cc @@ -91,7 +91,7 @@ struct S { [[size(16)]] padding : u32; m : [[stride(32)]] array, 2u>; -}; +} [[group(0), binding(0)]] var s : S; @@ -152,7 +152,7 @@ struct S { [[size(16)]] padding : u32; m : [[stride(32)]] array, 2u>; -}; +} [[group(0), binding(0)]] var s : S; @@ -210,7 +210,7 @@ struct S { padding : u32; [[stride(8), internal(disable_validation__ignore_stride)]] m : mat2x2; -}; +} [[group(0), binding(0)]] var s : S; @@ -267,7 +267,7 @@ struct S { [[size(8)]] padding : u32; m : [[stride(32)]] array, 2u>; -}; +} [[group(0), binding(0)]] var s : S; @@ -328,7 +328,7 @@ struct S { [[size(16)]] padding : u32; m : [[stride(32)]] array, 2u>; -}; +} [[group(0), binding(0)]] var s : S; @@ -386,7 +386,7 @@ struct S { [[size(8)]] padding : u32; m : [[stride(32)]] array, 2u>; -}; +} [[group(0), binding(0)]] var s : S; @@ -447,7 +447,7 @@ struct S { [[size(8)]] padding : u32; m : [[stride(32)]] array, 2u>; -}; +} [[group(0), binding(0)]] var s : S; @@ -519,7 +519,7 @@ struct S { [[size(8)]] padding : u32; m : [[stride(32)]] array, 2u>; -}; +} [[group(0), binding(0)]] var s : S; @@ -588,7 +588,7 @@ struct S { padding : u32; [[stride(32), internal(disable_validation__ignore_stride)]] m : mat2x2; -}; +} var s : S; @@ -646,7 +646,7 @@ struct S { padding : u32; [[stride(32), internal(disable_validation__ignore_stride)]] m : mat2x2; -}; +} var s : S; diff --git a/src/transform/first_index_offset_test.cc b/src/transform/first_index_offset_test.cc index 8d537e0765..6368d29527 100644 --- a/src/transform/first_index_offset_test.cc +++ b/src/transform/first_index_offset_test.cc @@ -61,7 +61,7 @@ fn entry([[builtin(vertex_index)]] vert_idx : u32) -> [[builtin(position)]] vec4 auto* expect = R"( struct tint_symbol { first_vertex_index : u32; -}; +} [[binding(1), group(2)]] var tint_symbol_1 : tint_symbol; @@ -107,7 +107,7 @@ fn entry([[builtin(instance_index)]] inst_idx : u32) -> [[builtin(position)]] ve auto* expect = R"( struct tint_symbol { first_instance_index : u32; -}; +} [[binding(1), group(7)]] var tint_symbol_1 : tint_symbol; @@ -159,7 +159,7 @@ fn entry(inputs : Inputs) -> [[builtin(position)]] vec4 { struct tint_symbol { first_vertex_index : u32; first_instance_index : u32; -}; +} [[binding(1), group(2)]] var tint_symbol_1 : tint_symbol; @@ -172,7 +172,7 @@ struct Inputs { instance_idx : u32; [[builtin(vertex_index)]] vert_idx : u32; -}; +} [[stage(vertex)]] fn entry(inputs : Inputs) -> [[builtin(position)]] vec4 { @@ -216,7 +216,7 @@ fn entry([[builtin(vertex_index)]] vert_idx : u32) -> [[builtin(position)]] vec4 auto* expect = R"( struct tint_symbol { first_vertex_index : u32; -}; +} [[binding(1), group(2)]] var tint_symbol_1 : tint_symbol; @@ -279,7 +279,7 @@ fn entry_c([[builtin(instance_index)]] inst_idx : u32) -> [[builtin(position)]] struct tint_symbol { first_vertex_index : u32; first_instance_index : u32; -}; +} [[binding(1), group(2)]] var tint_symbol_1 : tint_symbol; diff --git a/src/transform/localize_struct_array_assignment_test.cc b/src/transform/localize_struct_array_assignment_test.cc index 197aa02dcd..2b3b0c9a82 100644 --- a/src/transform/localize_struct_array_assignment_test.cc +++ b/src/transform/localize_struct_array_assignment_test.cc @@ -70,15 +70,15 @@ fn main() { [[block]] struct Uniforms { i : u32; -}; +} struct InnerS { v : i32; -}; +} struct OuterS { a1 : array; -}; +} [[group(1), binding(4)]] var uniforms : Uniforms; @@ -132,19 +132,19 @@ fn main() { [[block]] struct Uniforms { i : u32; -}; +} struct InnerS { v : i32; -}; +} struct S1 { a : array; -}; +} struct OuterS { s2 : S1; -}; +} [[group(1), binding(4)]] var uniforms : Uniforms; @@ -196,15 +196,15 @@ fn main() { struct Uniforms { i : u32; j : u32; -}; +} struct InnerS { v : i32; -}; +} struct OuterS { a1 : array, 8>; -}; +} [[group(1), binding(4)]] var uniforms : Uniforms; @@ -258,19 +258,19 @@ fn main() { [[block]] struct Uniforms { i : u32; -}; +} struct InnerS { v : i32; -}; +} struct S1 { s2 : InnerS; -}; +} struct OuterS { a1 : array; -}; +} [[group(1), binding(4)]] var uniforms : Uniforms; @@ -326,19 +326,19 @@ fn main() { struct Uniforms { i : u32; j : u32; -}; +} struct InnerS { v : i32; -}; +} struct S1 { a2 : array; -}; +} struct OuterS { a1 : array; -}; +} [[group(1), binding(4)]] var uniforms : Uniforms; @@ -403,19 +403,19 @@ fn main() { struct Uniforms { i : u32; j : u32; -}; +} struct InnerS { v : i32; -}; +} struct S1 { a2 : array; -}; +} struct OuterS { a1 : array; -}; +} var nextIndex : u32; @@ -476,15 +476,15 @@ fn main() { [[block]] struct Uniforms { i : u32; -}; +} struct InnerS { v : i32; -}; +} struct OuterS { a1 : array; -}; +} [[group(1), binding(4)]] var uniforms : Uniforms; @@ -544,15 +544,15 @@ fn main() { [[block]] struct Uniforms { i : u32; -}; +} struct InnerS { v : i32; -}; +} struct OuterS { a1 : array; -}; +} [[group(1), binding(4)]] var uniforms : Uniforms; @@ -584,12 +584,12 @@ TEST_F(LocalizeStructArrayAssignmentTest, VectorAssignment) { [[block]] struct Uniforms { i : u32; -}; +} [[block]] struct OuterS { a1 : array; -}; +} [[group(1), binding(4)]] var uniforms : Uniforms; diff --git a/src/transform/module_scope_var_to_entry_point_param_test.cc b/src/transform/module_scope_var_to_entry_point_param_test.cc index 0f7d518a37..87507ce299 100644 --- a/src/transform/module_scope_var_to_entry_point_param_test.cc +++ b/src/transform/module_scope_var_to_entry_point_param_test.cc @@ -218,7 +218,7 @@ fn main() { auto* expect = R"( struct S { a : f32; -}; +} [[stage(compute), workgroup_size(1)]] fn main([[group(0), binding(0), internal(disable_validation__entry_point_parameter), internal(disable_validation__ignore_storage_class)]] tint_symbol : ptr, [[group(0), binding(1), internal(disable_validation__entry_point_parameter), internal(disable_validation__ignore_storage_class)]] tint_symbol_1 : ptr) { @@ -246,7 +246,7 @@ fn main() { auto* expect = R"( struct tint_symbol_1 { arr : array; -}; +} [[stage(compute), workgroup_size(1)]] fn main([[group(0), binding(0), internal(disable_validation__entry_point_parameter), internal(disable_validation__ignore_storage_class)]] tint_symbol : ptr) { @@ -275,7 +275,7 @@ fn main() { auto* expect = R"( struct tint_symbol_1 { arr : array; -}; +} type myarray = array; @@ -308,11 +308,11 @@ fn main() { auto* expect = R"( struct S { f : f32; -}; +} struct tint_symbol_1 { arr : array; -}; +} [[stage(compute), workgroup_size(1)]] fn main([[group(0), binding(0), internal(disable_validation__entry_point_parameter), internal(disable_validation__ignore_storage_class)]] tint_symbol : ptr) { @@ -360,7 +360,7 @@ fn main() { auto* expect = R"( struct S { a : f32; -}; +} fn no_uses() { } @@ -479,7 +479,7 @@ fn main() { auto* expect = R"( struct tint_symbol_2 { m : mat2x2; -}; +} [[stage(compute), workgroup_size(1)]] fn main([[internal(disable_validation__entry_point_parameter)]] tint_symbol_1 : ptr) { @@ -512,15 +512,15 @@ fn main() { auto* expect = R"( struct S1 { m : mat2x2; -}; +} struct S2 { s : S1; -}; +} struct tint_symbol_2 { m : array; -}; +} [[stage(compute), workgroup_size(1)]] fn main([[internal(disable_validation__entry_point_parameter)]] tint_symbol_1 : ptr) { @@ -556,12 +556,12 @@ fn main() { auto* expect = R"( struct S { m : mat2x2; -}; +} struct tint_symbol_3 { a : S; b : S; -}; +} [[stage(compute), workgroup_size(1)]] fn main([[internal(disable_validation__entry_point_parameter)]] tint_symbol_1 : ptr) { @@ -602,7 +602,7 @@ fn main() { auto* expect = R"( struct S { a : f32; -}; +} [[stage(compute), workgroup_size(1)]] fn main() { diff --git a/src/transform/multiplanar_external_texture_test.cc b/src/transform/multiplanar_external_texture_test.cc index 631d76bf5e..e4c1d558d2 100644 --- a/src/transform/multiplanar_external_texture_test.cc +++ b/src/transform/multiplanar_external_texture_test.cc @@ -84,7 +84,7 @@ struct ExternalTextureParams { ug : f32; vg : f32; ub : f32; -}; +} [[group(0), binding(1)]] var ext_tex_plane_1 : texture_2d; @@ -128,7 +128,7 @@ struct ExternalTextureParams { ug : f32; vg : f32; ub : f32; -}; +} [[group(0), binding(2)]] var ext_tex_plane_1 : texture_2d; @@ -181,7 +181,7 @@ struct ExternalTextureParams { ug : f32; vg : f32; ub : f32; -}; +} [[group(0), binding(1)]] var ext_tex_plane_1 : texture_2d; @@ -238,7 +238,7 @@ struct ExternalTextureParams { ug : f32; vg : f32; ub : f32; -}; +} [[group(0), binding(2)]] var ext_tex_plane_1 : texture_2d; @@ -311,7 +311,7 @@ struct ExternalTextureParams { ug : f32; vg : f32; ub : f32; -}; +} [[group(0), binding(4)]] var ext_tex_plane_1 : texture_2d; @@ -393,7 +393,7 @@ struct ExternalTextureParams { ug : f32; vg : f32; ub : f32; -}; +} fn textureSampleExternal(plane0 : texture_2d, plane1 : texture_2d, smp : sampler, coord : vec2, params : ExternalTextureParams) -> vec4 { if ((params.numPlanes == 1u)) { @@ -459,7 +459,7 @@ struct ExternalTextureParams { ug : f32; vg : f32; ub : f32; -}; +} fn textureSampleExternal(plane0 : texture_2d, plane1 : texture_2d, smp : sampler, coord : vec2, params : ExternalTextureParams) -> vec4 { if ((params.numPlanes == 1u)) { @@ -527,7 +527,7 @@ struct ExternalTextureParams { ug : f32; vg : f32; ub : f32; -}; +} fn textureSampleExternal(plane0 : texture_2d, plane1 : texture_2d, smp : sampler, coord : vec2, params : ExternalTextureParams) -> vec4 { if ((params.numPlanes == 1u)) { @@ -605,7 +605,7 @@ struct ExternalTextureParams { ug : f32; vg : f32; ub : f32; -}; +} fn textureSampleExternal(plane0 : texture_2d, plane1 : texture_2d, smp : sampler, coord : vec2, params : ExternalTextureParams) -> vec4 { if ((params.numPlanes == 1u)) { diff --git a/src/transform/num_workgroups_from_uniform_test.cc b/src/transform/num_workgroups_from_uniform_test.cc index 9d1b81d55a..ecb221a2f0 100644 --- a/src/transform/num_workgroups_from_uniform_test.cc +++ b/src/transform/num_workgroups_from_uniform_test.cc @@ -68,7 +68,7 @@ fn main([[builtin(num_workgroups)]] num_wgs : vec3) { auto* expect = R"( struct tint_symbol_2 { num_workgroups : vec3; -}; +} [[group(0), binding(30)]] var tint_symbol_3 : tint_symbol_2; @@ -110,13 +110,13 @@ fn main(in : Builtins) { auto* expect = R"( struct tint_symbol_2 { num_workgroups : vec3; -}; +} [[group(0), binding(30)]] var tint_symbol_3 : tint_symbol_2; struct Builtins { num_wgs : vec3; -}; +} fn main_inner(in : Builtins) { let groups_x = in.num_wgs.x; @@ -158,7 +158,7 @@ fn main(in : Builtins) { auto* expect = R"( struct tint_symbol_2 { num_workgroups : vec3; -}; +} [[group(0), binding(30)]] var tint_symbol_3 : tint_symbol_2; @@ -166,14 +166,14 @@ struct Builtins { gid : vec3; num_wgs : vec3; wgid : vec3; -}; +} struct tint_symbol_1 { [[builtin(global_invocation_id)]] gid : vec3; [[builtin(workgroup_id)]] wgid : vec3; -}; +} fn main_inner(in : Builtins) { let groups_x = in.num_wgs.x; @@ -233,19 +233,19 @@ fn main3([[builtin(num_workgroups)]] num_wgs : vec3) { auto* expect = R"( struct tint_symbol_6 { num_workgroups : vec3; -}; +} [[group(0), binding(30)]] var tint_symbol_7 : tint_symbol_6; struct Builtins1 { num_wgs : vec3; -}; +} struct Builtins2 { gid : vec3; num_wgs : vec3; wgid : vec3; -}; +} fn main1_inner(in : Builtins1) { let groups_x = in.num_wgs.x; @@ -263,7 +263,7 @@ struct tint_symbol_3 { gid : vec3; [[builtin(workgroup_id)]] wgid : vec3; -}; +} fn main2_inner(in : Builtins2) { let groups_x = in.num_wgs.x; @@ -313,14 +313,14 @@ fn main(in : Builtins) { struct Builtins { gid : vec3; wgid : vec3; -}; +} struct tint_symbol_1 { [[builtin(global_invocation_id)]] gid : vec3; [[builtin(workgroup_id)]] wgid : vec3; -}; +} fn main_inner(in : Builtins) { } diff --git a/src/transform/pad_array_elements_test.cc b/src/transform/pad_array_elements_test.cc index 7483f3f9ed..05ca2da0a0 100644 --- a/src/transform/pad_array_elements_test.cc +++ b/src/transform/pad_array_elements_test.cc @@ -52,7 +52,7 @@ var arr : [[stride(8)]] array; struct tint_padded_array_element { [[size(8)]] el : i32; -}; +} var arr : array; )"; @@ -72,11 +72,11 @@ struct S { struct tint_padded_array_element { [[size(8)]] el : i32; -}; +} struct S { rta : array; -}; +} )"; auto got = Run(src); @@ -97,7 +97,7 @@ fn f() { struct tint_padded_array_element { [[size(16)]] el : i32; -}; +} fn f() { var arr : array; @@ -122,7 +122,7 @@ fn f(a : [[stride(12)]] array) -> i32 { struct tint_padded_array_element { [[size(12)]] el : i32; -}; +} fn f(a : array) -> i32 { return a[2].el; @@ -175,7 +175,7 @@ fn f() { struct tint_padded_array_element { [[size(16)]] el : i32; -}; +} type Array = array; @@ -207,24 +207,24 @@ struct S { struct tint_padded_array_element { [[size(8)]] el : i32; -}; +} struct tint_padded_array_element_1 { [[size(8)]] el : i32; -}; +} struct tint_padded_array_element_2 { [[size(12)]] el : i32; -}; +} struct S { a : array; b : array; c : array; d : array; -}; +} )"; auto got = Run(src); @@ -244,38 +244,38 @@ struct S { struct tint_padded_array_element { [[size(512)]] el : i32; -}; +} struct tint_padded_array_element_2 { [[size(32)]] el : i32; -}; +} struct tint_padded_array_element_1 { [[size(512)]] el : array; -}; +} struct tint_padded_array_element_5 { [[size(8)]] el : i32; -}; +} struct tint_padded_array_element_4 { [[size(64)]] el : array; -}; +} struct tint_padded_array_element_3 { [[size(512)]] el : array; -}; +} struct S { a : array; b : array; c : array; -}; +} )"; auto got = Run(src); @@ -299,38 +299,38 @@ fn f(s : S) -> i32 { struct tint_padded_array_element { [[size(512)]] el : i32; -}; +} struct tint_padded_array_element_2 { [[size(32)]] el : i32; -}; +} struct tint_padded_array_element_1 { [[size(512)]] el : array; -}; +} struct tint_padded_array_element_5 { [[size(8)]] el : i32; -}; +} struct tint_padded_array_element_4 { [[size(64)]] el : array; -}; +} struct tint_padded_array_element_3 { [[size(512)]] el : array; -}; +} struct S { a : array; b : array; c : array; -}; +} fn f(s : S) -> i32 { return ((s.a[2].el + s.b[1].el[2].el) + s.c[3].el[1].el[2].el); @@ -365,7 +365,7 @@ type T0 = i32; struct tint_padded_array_element { [[size(8)]] el : i32; -}; +} type T1 = array; @@ -374,7 +374,7 @@ type T2 = i32; struct tint_padded_array_element_1 { [[size(8)]] el : i32; -}; +} fn f1(a : array) { } @@ -384,7 +384,7 @@ type T3 = i32; struct tint_padded_array_element_2 { [[size(8)]] el : i32; -}; +} fn f2() { var v : array; diff --git a/src/transform/promote_initializers_to_const_var_test.cc b/src/transform/promote_initializers_to_const_var_test.cc index b32d15367f..8e2dc254c6 100644 --- a/src/transform/promote_initializers_to_const_var_test.cc +++ b/src/transform/promote_initializers_to_const_var_test.cc @@ -67,7 +67,7 @@ struct S { a : i32; b : f32; c : vec3; -}; +} fn f() { let tint_symbol = S(1, 2.0, vec3()); @@ -126,7 +126,7 @@ struct S { a : i32; b : f32; c : vec3; -}; +} fn f() { var insert_after = 1; @@ -288,17 +288,17 @@ fn f() { auto* expect = R"( struct S1 { a : i32; -}; +} struct S2 { a : i32; b : S1; c : i32; -}; +} struct S3 { a : S2; -}; +} fn f() { let tint_symbol = S1(2); @@ -331,11 +331,11 @@ fn f() { auto* expect = R"( struct S1 { a : i32; -}; +} struct S2 { a : array; -}; +} fn f() { let tint_symbol = S1(1); @@ -358,7 +358,7 @@ struct S { a : i32; b : f32; c : i32; -}; +} fn f() { var local_arr = array(0.0, 1.0, 2.0, 3.0); diff --git a/src/transform/remove_phonies_test.cc b/src/transform/remove_phonies_test.cc index 837e34cf05..6d6c86d89e 100644 --- a/src/transform/remove_phonies_test.cc +++ b/src/transform/remove_phonies_test.cc @@ -204,7 +204,7 @@ fn f() { auto* expect = R"( struct S { arr : array; -}; +} [[group(0), binding(0)]] var s : S; diff --git a/src/transform/robustness_test.cc b/src/transform/robustness_test.cc index 4c0025e4d4..a471381a08 100644 --- a/src/transform/robustness_test.cc +++ b/src/transform/robustness_test.cc @@ -630,7 +630,7 @@ fn f() { struct S { a : f32; b : array; -}; +} [[group(0), binding(0)]] var s : S; @@ -794,7 +794,7 @@ fn f() { struct S { a : f32; b : array; -}; +} [[group(0), binding(0)]] var s : S; @@ -874,7 +874,7 @@ TEST_F(RobustnessTest, OmitNone) { struct S { a : array; b : array; -}; +} [[group(0), binding(0)]] var s : S; @@ -882,7 +882,7 @@ type UArr = [[stride(16)]] array; struct U { a : UArr; -}; +} [[group(1), binding(0)]] var u : U; @@ -937,7 +937,7 @@ TEST_F(RobustnessTest, OmitStorage) { struct S { a : array; b : array; -}; +} [[group(0), binding(0)]] var s : S; @@ -945,7 +945,7 @@ type UArr = [[stride(16)]] array; struct U { a : UArr; -}; +} [[group(1), binding(0)]] var u : U; @@ -1002,7 +1002,7 @@ TEST_F(RobustnessTest, OmitUniform) { struct S { a : array; b : array; -}; +} [[group(0), binding(0)]] var s : S; @@ -1010,7 +1010,7 @@ type UArr = [[stride(16)]] array; struct U { a : UArr; -}; +} [[group(1), binding(0)]] var u : U; @@ -1067,7 +1067,7 @@ TEST_F(RobustnessTest, OmitBoth) { struct S { a : array; b : array; -}; +} [[group(0), binding(0)]] var s : S; @@ -1075,7 +1075,7 @@ type UArr = [[stride(16)]] array; struct U { a : UArr; -}; +} [[group(1), binding(0)]] var u : U; diff --git a/src/transform/simplify_pointers_test.cc b/src/transform/simplify_pointers_test.cc index 0fdf806eb2..6b55d32694 100644 --- a/src/transform/simplify_pointers_test.cc +++ b/src/transform/simplify_pointers_test.cc @@ -168,7 +168,7 @@ fn matrix() { auto* expect = R"( struct S { i : i32; -}; +} fn arr() { var a : array; @@ -325,11 +325,11 @@ fn z() -> i32 { struct Inner { a : array; -}; +} struct Outer { a : array; -}; +} fn f() { var arr : array; diff --git a/src/transform/unshadow_test.cc b/src/transform/unshadow_test.cc index 2a4cbed454..ddba826c53 100644 --- a/src/transform/unshadow_test.cc +++ b/src/transform/unshadow_test.cc @@ -102,7 +102,7 @@ fn Y() { auto* expect = R"( struct a { m : i32; -}; +} fn X() { var a_1 = true; diff --git a/src/transform/vertex_pulling_test.cc b/src/transform/vertex_pulling_test.cc index b43d4a44bb..10b8ee8cd2 100644 --- a/src/transform/vertex_pulling_test.cc +++ b/src/transform/vertex_pulling_test.cc @@ -109,7 +109,7 @@ fn main() -> [[builtin(position)]] vec4 { auto* expect = R"( struct TintVertexData { tint_vertex_data : [[stride(4)]] array; -}; +} [[stage(vertex)]] fn main() -> [[builtin(position)]] vec4 { @@ -138,7 +138,7 @@ fn main([[location(0)]] var_a : f32) -> [[builtin(position)]] vec4 { auto* expect = R"( struct TintVertexData { tint_vertex_data : [[stride(4)]] array; -}; +} [[binding(0), group(4)]] var tint_pulling_vertex_buffer_0 : TintVertexData; @@ -176,7 +176,7 @@ fn main([[location(0)]] var_a : f32) -> [[builtin(position)]] vec4 { auto* expect = R"( struct TintVertexData { tint_vertex_data : [[stride(4)]] array; -}; +} [[binding(0), group(4)]] var tint_pulling_vertex_buffer_0 : TintVertexData; @@ -214,7 +214,7 @@ fn main([[location(0)]] var_a : f32) -> [[builtin(position)]] vec4 { auto* expect = R"( struct TintVertexData { tint_vertex_data : [[stride(4)]] array; -}; +} [[binding(0), group(5)]] var tint_pulling_vertex_buffer_0 : TintVertexData; @@ -257,14 +257,14 @@ fn main(inputs : Inputs) -> [[builtin(position)]] vec4 { auto* expect = R"( struct TintVertexData { tint_vertex_data : [[stride(4)]] array; -}; +} [[binding(0), group(4)]] var tint_pulling_vertex_buffer_0 : TintVertexData; struct Inputs { [[location(0)]] var_a : f32; -}; +} [[stage(vertex)]] fn main([[builtin(vertex_index)]] tint_pulling_vertex_index : u32) -> [[builtin(position)]] vec4 { @@ -305,7 +305,7 @@ fn main([[location(0)]] var_a : f32, auto* expect = R"( struct TintVertexData { tint_vertex_data : [[stride(4)]] array; -}; +} [[binding(0), group(4)]] var tint_pulling_vertex_buffer_0 : TintVertexData; @@ -365,7 +365,7 @@ fn main(inputs : Inputs) -> [[builtin(position)]] vec4 { auto* expect = R"( struct TintVertexData { tint_vertex_data : [[stride(4)]] array; -}; +} [[binding(0), group(4)]] var tint_pulling_vertex_buffer_0 : TintVertexData; @@ -376,7 +376,7 @@ struct tint_symbol { custom_vertex_index : u32; [[builtin(instance_index)]] custom_instance_index : u32; -}; +} struct Inputs { [[location(0)]] @@ -387,7 +387,7 @@ struct Inputs { custom_vertex_index : u32; [[builtin(instance_index)]] custom_instance_index : u32; -}; +} [[stage(vertex)]] fn main(tint_symbol_1 : tint_symbol) -> [[builtin(position)]] vec4 { @@ -447,7 +447,7 @@ fn main(inputs : Inputs, indices : Indices) -> [[builtin(position)]] vec4 { auto* expect = R"( struct TintVertexData { tint_vertex_data : [[stride(4)]] array; -}; +} [[binding(0), group(4)]] var tint_pulling_vertex_buffer_0 : TintVertexData; @@ -458,14 +458,14 @@ struct Inputs { var_a : f32; [[location(1)]] var_b : f32; -}; +} struct Indices { [[builtin(vertex_index)]] custom_vertex_index : u32; [[builtin(instance_index)]] custom_instance_index : u32; -}; +} [[stage(vertex)]] fn main(indices : Indices) -> [[builtin(position)]] vec4 { @@ -514,7 +514,7 @@ fn main([[location(0)]] var_a : f32, auto* expect = R"( struct TintVertexData { tint_vertex_data : [[stride(4)]] array; -}; +} [[binding(0), group(4)]] var tint_pulling_vertex_buffer_0 : TintVertexData; @@ -559,7 +559,7 @@ fn main([[location(0)]] var_a : vec2, auto* expect = R"( struct TintVertexData { tint_vertex_data : [[stride(4)]] array; -}; +} [[binding(0), group(4)]] var tint_pulling_vertex_buffer_0 : TintVertexData; @@ -615,7 +615,7 @@ fn main([[location(0)]] var_a : f32, auto* expect = R"( struct TintVertexData { tint_vertex_data_1 : [[stride(4)]] array; -}; +} [[binding(0), group(4)]] var tint_pulling_vertex_buffer_0_1 : TintVertexData; @@ -692,7 +692,7 @@ fn main( auto* expect = R"( struct TintVertexData { tint_vertex_data : [[stride(4)]] array; -}; +} [[binding(0), group(4)]] var tint_pulling_vertex_buffer_0 : TintVertexData; @@ -852,7 +852,7 @@ fn main( R"( struct TintVertexData { tint_vertex_data : [[stride(4)]] array; -}; +} [[binding(0), group(4)]] var tint_pulling_vertex_buffer_0 : TintVertexData; @@ -1011,7 +1011,7 @@ fn main( auto* expect = R"( struct TintVertexData { tint_vertex_data : [[stride(4)]] array; -}; +} [[binding(0), group(4)]] var tint_pulling_vertex_buffer_0 : TintVertexData; diff --git a/src/transform/wrap_arrays_in_structs_test.cc b/src/transform/wrap_arrays_in_structs_test.cc index a93f995726..21aa7c84c7 100644 --- a/src/transform/wrap_arrays_in_structs_test.cc +++ b/src/transform/wrap_arrays_in_structs_test.cc @@ -41,7 +41,7 @@ var arr : array; auto* expect = R"( struct tint_array_wrapper { arr : array; -}; +} var arr : tint_array_wrapper; )"; @@ -61,7 +61,7 @@ fn f() { auto* expect = R"( struct tint_array_wrapper { arr : array; -}; +} fn f() { var arr : tint_array_wrapper; @@ -83,7 +83,7 @@ fn f(a : array) -> i32 { auto* expect = R"( struct tint_array_wrapper { arr : array; -}; +} fn f(a : tint_array_wrapper) -> i32 { return a.arr[2]; @@ -104,7 +104,7 @@ fn f() -> array { auto* expect = R"( struct tint_array_wrapper { arr : array; -}; +} fn f() -> tint_array_wrapper { return tint_array_wrapper(array(1, 2, 3, 4)); @@ -133,13 +133,13 @@ fn f() { auto* expect = R"( struct tint_array_wrapper { arr : array; -}; +} type Inner = tint_array_wrapper; struct tint_array_wrapper_1 { arr : array; -}; +} type Array = tint_array_wrapper_1; @@ -169,17 +169,17 @@ struct S { auto* expect = R"( struct tint_array_wrapper { arr : array; -}; +} struct tint_array_wrapper_1 { arr : array; -}; +} struct S { a : tint_array_wrapper; b : tint_array_wrapper_1; c : tint_array_wrapper; -}; +} )"; auto got = Run(src); @@ -198,21 +198,21 @@ struct S { auto* expect = R"( struct tint_array_wrapper { arr : array; -}; +} struct tint_array_wrapper_1 { arr : array; -}; +} struct tint_array_wrapper_2 { arr : array; -}; +} struct S { a : tint_array_wrapper; b : tint_array_wrapper_1; c : tint_array_wrapper_2; -}; +} )"; auto got = Run(src); @@ -235,21 +235,21 @@ fn f(s : S) -> i32 { auto* expect = R"( struct tint_array_wrapper { arr : array; -}; +} struct tint_array_wrapper_1 { arr : array; -}; +} struct tint_array_wrapper_2 { arr : array; -}; +} struct S { a : tint_array_wrapper; b : tint_array_wrapper_1; c : tint_array_wrapper_2; -}; +} fn f(s : S) -> i32 { return ((s.a.arr[2] + s.b.arr[1].arr[2]) + s.c.arr[3].arr[1].arr[2]); @@ -283,7 +283,7 @@ type T0 = i32; struct tint_array_wrapper { arr : array; -}; +} type T1 = tint_array_wrapper; @@ -291,7 +291,7 @@ type T2 = i32; struct tint_array_wrapper_1 { arr : array; -}; +} fn f1(a : tint_array_wrapper_1) { } @@ -300,7 +300,7 @@ type T3 = i32; struct tint_array_wrapper_2 { arr : array; -}; +} fn f2() { var v : tint_array_wrapper_2; diff --git a/src/transform/zero_init_workgroup_memory_test.cc b/src/transform/zero_init_workgroup_memory_test.cc index f76e3a7fc2..166036e320 100644 --- a/src/transform/zero_init_workgroup_memory_test.cc +++ b/src/transform/zero_init_workgroup_memory_test.cc @@ -118,7 +118,7 @@ var v : i32; struct Params { [[builtin(local_invocation_index)]] local_idx : u32; -}; +} [[stage(compute), workgroup_size(1)]] fn f(params : Params) { @@ -187,7 +187,7 @@ fn f([[builtin(local_invocation_index)]] local_idx : u32) { struct S { x : i32; y : array; -}; +} var a : i32; @@ -251,7 +251,7 @@ fn f([[builtin(local_invocation_index)]] local_idx : u32) { struct S { x : i32; y : array; -}; +} var a : i32; @@ -318,7 +318,7 @@ fn f([[builtin(local_invocation_index)]] local_idx : u32) { struct S { x : i32; y : array; -}; +} var a : i32; @@ -389,7 +389,7 @@ struct S { x : array, 10>; y : array; z : array, 10>, 20>; -}; +} var a : i32; @@ -473,7 +473,7 @@ fn f([[builtin(local_invocation_id)]] local_invocation_id : vec3) { struct S { x : i32; y : array; -}; +} var a : i32; @@ -546,7 +546,7 @@ fn f3() { struct S { x : i32; y : array; -}; +} var a : i32; @@ -711,7 +711,7 @@ struct S { b : f32; u : atomic; c : u32; -}; +} var w : S; @@ -786,7 +786,7 @@ struct S { b : f32; u : atomic; c : u32; -}; +} var w : array; diff --git a/src/writer/wgsl/generator_impl.cc b/src/writer/wgsl/generator_impl.cc index a4c3ed9596..1295c76620 100644 --- a/src/writer/wgsl/generator_impl.cc +++ b/src/writer/wgsl/generator_impl.cc @@ -573,7 +573,7 @@ bool GeneratorImpl::EmitStructType(const ast::Struct* str) { } decrement_indent(); - line() << "};"; + line() << "}"; return true; } diff --git a/src/writer/wgsl/generator_impl_alias_type_test.cc b/src/writer/wgsl/generator_impl_alias_type_test.cc index 754849dc31..f1a2f479bc 100644 --- a/src/writer/wgsl/generator_impl_alias_type_test.cc +++ b/src/writer/wgsl/generator_impl_alias_type_test.cc @@ -46,7 +46,7 @@ TEST_F(WgslGeneratorImplTest, EmitTypeDecl_Struct) { EXPECT_EQ(gen.result(), R"(struct A { a : f32; b : i32; -}; +} type B = A; )"); } diff --git a/src/writer/wgsl/generator_impl_function_test.cc b/src/writer/wgsl/generator_impl_function_test.cc index 89dd681e21..3aebf94b86 100644 --- a/src/writer/wgsl/generator_impl_function_test.cc +++ b/src/writer/wgsl/generator_impl_function_test.cc @@ -213,7 +213,7 @@ TEST_F(WgslGeneratorImplTest, EXPECT_EQ(gen.result(), R"([[block]] struct Data { d : f32; -}; +} [[binding(0), group(0)]] var data : Data; diff --git a/src/writer/wgsl/generator_impl_global_decl_test.cc b/src/writer/wgsl/generator_impl_global_decl_test.cc index 3859db4f50..e22a75e675 100644 --- a/src/writer/wgsl/generator_impl_global_decl_test.cc +++ b/src/writer/wgsl/generator_impl_global_decl_test.cc @@ -79,7 +79,7 @@ TEST_F(WgslGeneratorImplTest, Emit_GlobalsInterleaved) { struct S0 { a : i32; - }; + } fn func() -> f32 { return a0; @@ -89,7 +89,7 @@ TEST_F(WgslGeneratorImplTest, Emit_GlobalsInterleaved) { struct S1 { a : i32; - }; + } [[stage(compute), workgroup_size(1)]] fn main() { diff --git a/src/writer/wgsl/generator_impl_type_test.cc b/src/writer/wgsl/generator_impl_type_test.cc index 236c1b1276..dd1355e154 100644 --- a/src/writer/wgsl/generator_impl_type_test.cc +++ b/src/writer/wgsl/generator_impl_type_test.cc @@ -168,7 +168,7 @@ TEST_F(WgslGeneratorImplTest, EmitType_StructOffsetDecl) { [[size(4)]] padding_1 : u32; b : f32; -}; +} )"); } @@ -189,7 +189,7 @@ TEST_F(WgslGeneratorImplTest, EmitType_StructOffsetDecl_WithSymbolCollisions) { [[size(4)]] padding_1 : u32; tint_2_padding : f32; -}; +} )"); } @@ -207,7 +207,7 @@ TEST_F(WgslGeneratorImplTest, EmitType_StructAlignDecl) { a : i32; [[align(16)]] b : f32; -}; +} )"); } @@ -225,7 +225,7 @@ TEST_F(WgslGeneratorImplTest, EmitType_StructSizeDecl) { a : i32; [[size(32)]] b : f32; -}; +} )"); } @@ -245,7 +245,7 @@ struct S { a : i32; [[align(8)]] b : f32; -}; +} )"); } @@ -269,7 +269,7 @@ struct S { a : u32; [[location(2)]] b : f32; -}; +} )"); } diff --git a/test/array/assign_to_function_var.wgsl.expected.wgsl b/test/array/assign_to_function_var.wgsl.expected.wgsl index 8d3a0c01b6..3951d8534b 100644 --- a/test/array/assign_to_function_var.wgsl.expected.wgsl +++ b/test/array/assign_to_function_var.wgsl.expected.wgsl @@ -2,7 +2,7 @@ type ArrayType = [[stride(16)]] array; struct S { arr : ArrayType; -}; +} var src_private : ArrayType; diff --git a/test/array/assign_to_private_var.wgsl.expected.wgsl b/test/array/assign_to_private_var.wgsl.expected.wgsl index c5e4e1fec8..56f7ba5473 100644 --- a/test/array/assign_to_private_var.wgsl.expected.wgsl +++ b/test/array/assign_to_private_var.wgsl.expected.wgsl @@ -2,7 +2,7 @@ type ArrayType = [[stride(16)]] array; struct S { arr : ArrayType; -}; +} var src_private : ArrayType; diff --git a/test/array/assign_to_storage_var.wgsl.expected.wgsl b/test/array/assign_to_storage_var.wgsl.expected.wgsl index cb0b54b289..dce03ab62d 100644 --- a/test/array/assign_to_storage_var.wgsl.expected.wgsl +++ b/test/array/assign_to_storage_var.wgsl.expected.wgsl @@ -2,11 +2,11 @@ type ArrayType = [[stride(16)]] array; struct S { arr : ArrayType; -}; +} struct S_nested { arr : array, 3>, 4>; -}; +} var src_private : ArrayType; diff --git a/test/array/assign_to_subexpr.wgsl.expected.wgsl b/test/array/assign_to_subexpr.wgsl.expected.wgsl index 6ab4099beb..6d1ab6829d 100644 --- a/test/array/assign_to_subexpr.wgsl.expected.wgsl +++ b/test/array/assign_to_subexpr.wgsl.expected.wgsl @@ -2,7 +2,7 @@ type ArrayType = array; struct S { arr : array; -}; +} fn foo() { let src : ArrayType = ArrayType(); diff --git a/test/array/assign_to_workgroup_var.wgsl.expected.wgsl b/test/array/assign_to_workgroup_var.wgsl.expected.wgsl index 0d3b5a3d72..a5a27e359d 100644 --- a/test/array/assign_to_workgroup_var.wgsl.expected.wgsl +++ b/test/array/assign_to_workgroup_var.wgsl.expected.wgsl @@ -2,7 +2,7 @@ type ArrayType = [[stride(16)]] array; struct S { arr : ArrayType; -}; +} var src_private : ArrayType; diff --git a/test/benchmark/particles.wgsl.expected.wgsl b/test/benchmark/particles.wgsl.expected.wgsl index 856f496891..0ab3f503da 100644 --- a/test/benchmark/particles.wgsl.expected.wgsl +++ b/test/benchmark/particles.wgsl.expected.wgsl @@ -10,7 +10,7 @@ struct RenderParams { modelViewProjectionMatrix : mat4x4; right : vec3; up : vec3; -}; +} [[binding(0), group(0)]] var render_params : RenderParams; @@ -21,7 +21,7 @@ struct VertexInput { color : vec4; [[location(2)]] quad_pos : vec2; -}; +} struct VertexOutput { [[builtin(position)]] @@ -30,7 +30,7 @@ struct VertexOutput { color : vec4; [[location(1)]] quad_pos : vec2; -}; +} [[stage(vertex)]] fn vs_main(in : VertexInput) -> VertexOutput { @@ -53,18 +53,18 @@ fn fs_main(in : VertexOutput) -> [[location(0)]] vec4 { struct SimulationParams { deltaTime : f32; seed : vec4; -}; +} struct Particle { position : vec3; lifetime : f32; color : vec4; velocity : vec3; -}; +} struct Particles { particles : array; -}; +} [[binding(0), group(0)]] var sim_params : SimulationParams; @@ -104,11 +104,11 @@ fn simulate([[builtin(global_invocation_id)]] GlobalInvocationID : vec3) { struct UBO { width : u32; -}; +} struct Buffer { weights : array; -}; +} [[binding(3), group(0)]] var ubo : UBO; diff --git a/test/benchmark/simple_compute.wgsl.expected.wgsl b/test/benchmark/simple_compute.wgsl.expected.wgsl index ac984105ef..a83b28f9cc 100644 --- a/test/benchmark/simple_compute.wgsl.expected.wgsl +++ b/test/benchmark/simple_compute.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct SB { data : array; -}; +} [[group(0), binding(0)]] var buffer : SB; diff --git a/test/benchmark/simple_fragment.wgsl.expected.wgsl b/test/benchmark/simple_fragment.wgsl.expected.wgsl index 1f4225e5a8..7236de2885 100644 --- a/test/benchmark/simple_fragment.wgsl.expected.wgsl +++ b/test/benchmark/simple_fragment.wgsl.expected.wgsl @@ -1,12 +1,12 @@ struct Input { [[location(0)]] color : vec4; -}; +} struct Output { [[location(0)]] color : vec4; -}; +} [[stage(fragment)]] fn main(in : Input) -> Output { diff --git a/test/benchmark/simple_vertex.wgsl.expected.wgsl b/test/benchmark/simple_vertex.wgsl.expected.wgsl index 7bc18b1d1c..fdce23ed1c 100644 --- a/test/benchmark/simple_vertex.wgsl.expected.wgsl +++ b/test/benchmark/simple_vertex.wgsl.expected.wgsl @@ -1,12 +1,12 @@ struct Input { [[location(0)]] position : vec4; -}; +} struct Output { [[builtin(position)]] position : vec4; -}; +} [[stage(vertex)]] fn main(in : Input) -> Output { diff --git a/test/buffer/storage/dynamic_index/read.wgsl.expected.wgsl b/test/buffer/storage/dynamic_index/read.wgsl.expected.wgsl index 0363eda378..bd24ab0516 100644 --- a/test/buffer/storage/dynamic_index/read.wgsl.expected.wgsl +++ b/test/buffer/storage/dynamic_index/read.wgsl.expected.wgsl @@ -8,11 +8,11 @@ struct Inner { g : mat2x3; h : mat3x2; i : [[stride(16)]] array, 4>; -}; +} struct S { arr : array; -}; +} [[binding(0), group(0)]] var s : S; diff --git a/test/buffer/storage/dynamic_index/write.wgsl.expected.wgsl b/test/buffer/storage/dynamic_index/write.wgsl.expected.wgsl index db3497d921..b015519c7a 100644 --- a/test/buffer/storage/dynamic_index/write.wgsl.expected.wgsl +++ b/test/buffer/storage/dynamic_index/write.wgsl.expected.wgsl @@ -8,11 +8,11 @@ struct Inner { g : mat2x3; h : mat3x2; i : [[stride(16)]] array, 4>; -}; +} struct S { arr : array; -}; +} [[binding(0), group(0)]] var s : S; diff --git a/test/buffer/storage/static_index/read.wgsl.expected.wgsl b/test/buffer/storage/static_index/read.wgsl.expected.wgsl index 8a9f17c277..56187c5484 100644 --- a/test/buffer/storage/static_index/read.wgsl.expected.wgsl +++ b/test/buffer/storage/static_index/read.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct Inner { x : i32; -}; +} struct S { a : vec3; @@ -13,7 +13,7 @@ struct S { h : mat3x2; i : Inner; j : [[stride(16)]] array; -}; +} [[binding(0), group(0)]] var s : S; diff --git a/test/buffer/storage/static_index/write.wgsl.expected.wgsl b/test/buffer/storage/static_index/write.wgsl.expected.wgsl index b4c8329896..46cdde8fd3 100644 --- a/test/buffer/storage/static_index/write.wgsl.expected.wgsl +++ b/test/buffer/storage/static_index/write.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct Inner { x : i32; -}; +} struct S { a : vec3; @@ -13,7 +13,7 @@ struct S { h : mat3x2; i : Inner; j : [[stride(16)]] array; -}; +} [[binding(0), group(0)]] var s : S; diff --git a/test/buffer/storage/types/runtime_array.wgsl.expected.wgsl b/test/buffer/storage/types/runtime_array.wgsl.expected.wgsl index 418c67d64f..2aca9cd0df 100644 --- a/test/buffer/storage/types/runtime_array.wgsl.expected.wgsl +++ b/test/buffer/storage/types/runtime_array.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct S { f : f32; -}; +} [[group(0), binding(0)]] var in : array; diff --git a/test/buffer/storage/types/struct.wgsl.expected.wgsl b/test/buffer/storage/types/struct.wgsl.expected.wgsl index f86c26b429..dd840d4072 100644 --- a/test/buffer/storage/types/struct.wgsl.expected.wgsl +++ b/test/buffer/storage/types/struct.wgsl.expected.wgsl @@ -1,10 +1,10 @@ struct Inner { f : f32; -}; +} struct S { inner : Inner; -}; +} [[group(0), binding(0)]] var in : S; diff --git a/test/buffer/uniform/dynamic_index/read.wgsl.expected.wgsl b/test/buffer/uniform/dynamic_index/read.wgsl.expected.wgsl index b5279f68cb..0dc8fdfdae 100644 --- a/test/buffer/uniform/dynamic_index/read.wgsl.expected.wgsl +++ b/test/buffer/uniform/dynamic_index/read.wgsl.expected.wgsl @@ -12,11 +12,11 @@ struct Inner { j : mat3x2; [[align(16)]] k : [[stride(16)]] array, 4>; -}; +} struct S { arr : array; -}; +} [[binding(0), group(0)]] var s : S; diff --git a/test/buffer/uniform/static_index/read.wgsl.expected.wgsl b/test/buffer/uniform/static_index/read.wgsl.expected.wgsl index 99c50f191c..f43ae3bbcb 100644 --- a/test/buffer/uniform/static_index/read.wgsl.expected.wgsl +++ b/test/buffer/uniform/static_index/read.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct Inner { x : i32; -}; +} struct S { a : vec3; @@ -17,7 +17,7 @@ struct S { k : Inner; [[align(16)]] l : [[stride(16)]] array; -}; +} [[binding(0), group(0)]] var s : S; diff --git a/test/buffer/uniform/types/struct.wgsl.expected.wgsl b/test/buffer/uniform/types/struct.wgsl.expected.wgsl index fed4de3d78..0e74bf8418 100644 --- a/test/buffer/uniform/types/struct.wgsl.expected.wgsl +++ b/test/buffer/uniform/types/struct.wgsl.expected.wgsl @@ -1,10 +1,10 @@ struct Inner { f : f32; -}; +} struct S { inner : Inner; -}; +} [[group(0), binding(0)]] var u : S; diff --git a/test/bug/chromium/1251009.wgsl.expected.wgsl b/test/bug/chromium/1251009.wgsl.expected.wgsl index 5de6e50c0e..c82715d8b8 100644 --- a/test/bug/chromium/1251009.wgsl.expected.wgsl +++ b/test/bug/chromium/1251009.wgsl.expected.wgsl @@ -3,14 +3,14 @@ struct VertexInputs0 { vertex_index : u32; [[location(0)]] loc0 : i32; -}; +} struct VertexInputs1 { [[location(2)]] loc1 : u32; [[location(3)]] loc3 : vec4; -}; +} [[stage(vertex)]] fn main(inputs0 : VertexInputs0, [[location(1)]] loc1 : u32, [[builtin(instance_index)]] instance_index : u32, inputs1 : VertexInputs1) -> [[builtin(position)]] vec4 { diff --git a/test/bug/chromium/1273230.wgsl.expected.wgsl b/test/bug/chromium/1273230.wgsl.expected.wgsl index 4e2d55b065..4708e0b0aa 100644 --- a/test/bug/chromium/1273230.wgsl.expected.wgsl +++ b/test/bug/chromium/1273230.wgsl.expected.wgsl @@ -36,7 +36,7 @@ struct Uniforms { pad2 : u32; bbMin : vec3; bbMax : vec3; -}; +} struct Dbg { offsetCounter : atomic; @@ -51,27 +51,27 @@ struct Dbg { value_f32_1 : f32; value_f32_2 : f32; value_f32_3 : f32; -}; +} struct F32s { values : [[stride(4)]] array; -}; +} struct U32s { values : [[stride(4)]] array; -}; +} struct I32s { values : [[stride(4)]] array; -}; +} struct AU32s { values : [[stride(4)]] array>; -}; +} struct AI32s { values : [[stride(4)]] array>; -}; +} [[binding(0), group(0)]] var uniforms : Uniforms; diff --git a/test/bug/chromium/1273451.wgsl.expected.wgsl b/test/bug/chromium/1273451.wgsl.expected.wgsl index 2289c10d94..d12f298808 100644 --- a/test/bug/chromium/1273451.wgsl.expected.wgsl +++ b/test/bug/chromium/1273451.wgsl.expected.wgsl @@ -1,10 +1,10 @@ struct A { a : i32; -}; +} struct B { b : i32; -}; +} fn f(a : A) -> B { return B(); diff --git a/test/bug/dawn/947.wgsl.expected.wgsl b/test/bug/dawn/947.wgsl.expected.wgsl index b4178629b8..a7e4f69a40 100644 --- a/test/bug/dawn/947.wgsl.expected.wgsl +++ b/test/bug/dawn/947.wgsl.expected.wgsl @@ -1,7 +1,7 @@ struct Uniforms { u_scale : vec2; u_offset : vec2; -}; +} [[binding(0), group(0)]] var uniforms : Uniforms; @@ -10,7 +10,7 @@ struct VertexOutputs { texcoords : vec2; [[builtin(position)]] position : vec4; -}; +} [[stage(vertex)]] fn vs_main([[builtin(vertex_index)]] VertexIndex : u32) -> VertexOutputs { diff --git a/test/bug/fxc/dyn_array_idx/read/function.wgsl.expected.wgsl b/test/bug/fxc/dyn_array_idx/read/function.wgsl.expected.wgsl index 85f665b569..9487d560f0 100644 --- a/test/bug/fxc/dyn_array_idx/read/function.wgsl.expected.wgsl +++ b/test/bug/fxc/dyn_array_idx/read/function.wgsl.expected.wgsl @@ -1,16 +1,16 @@ struct UBO { dynamic_idx : i32; -}; +} [[group(0), binding(0)]] var ubo : UBO; struct S { data : array; -}; +} struct Result { out : i32; -}; +} [[group(0), binding(1)]] var result : Result; diff --git a/test/bug/fxc/dyn_array_idx/read/private.wgsl.expected.wgsl b/test/bug/fxc/dyn_array_idx/read/private.wgsl.expected.wgsl index 4a1fecc3cc..352b5e2f0f 100644 --- a/test/bug/fxc/dyn_array_idx/read/private.wgsl.expected.wgsl +++ b/test/bug/fxc/dyn_array_idx/read/private.wgsl.expected.wgsl @@ -1,16 +1,16 @@ struct UBO { dynamic_idx : i32; -}; +} [[group(0), binding(0)]] var ubo : UBO; struct S { data : array; -}; +} struct Result { out : i32; -}; +} [[group(0), binding(1)]] var result : Result; diff --git a/test/bug/fxc/dyn_array_idx/read/storage.wgsl.expected.wgsl b/test/bug/fxc/dyn_array_idx/read/storage.wgsl.expected.wgsl index 76cf15c339..5445952649 100644 --- a/test/bug/fxc/dyn_array_idx/read/storage.wgsl.expected.wgsl +++ b/test/bug/fxc/dyn_array_idx/read/storage.wgsl.expected.wgsl @@ -1,18 +1,18 @@ struct UBO { dynamic_idx : i32; -}; +} [[group(0), binding(0)]] var ubo : UBO; struct Result { out : i32; -}; +} [[group(0), binding(2)]] var result : Result; struct SSBO { data : array; -}; +} [[group(0), binding(1)]] var ssbo : SSBO; diff --git a/test/bug/fxc/dyn_array_idx/read/uniform.wgsl.expected.wgsl b/test/bug/fxc/dyn_array_idx/read/uniform.wgsl.expected.wgsl index cd2664aec0..d0f1e724fb 100644 --- a/test/bug/fxc/dyn_array_idx/read/uniform.wgsl.expected.wgsl +++ b/test/bug/fxc/dyn_array_idx/read/uniform.wgsl.expected.wgsl @@ -1,13 +1,13 @@ struct UBO { data : [[stride(16)]] array; dynamic_idx : i32; -}; +} [[group(0), binding(0)]] var ubo : UBO; struct Result { out : i32; -}; +} [[group(0), binding(2)]] var result : Result; diff --git a/test/bug/fxc/dyn_array_idx/read/workgroup.wgsl.expected.wgsl b/test/bug/fxc/dyn_array_idx/read/workgroup.wgsl.expected.wgsl index edca39d611..80a812d3ae 100644 --- a/test/bug/fxc/dyn_array_idx/read/workgroup.wgsl.expected.wgsl +++ b/test/bug/fxc/dyn_array_idx/read/workgroup.wgsl.expected.wgsl @@ -1,16 +1,16 @@ struct UBO { dynamic_idx : i32; -}; +} [[group(0), binding(0)]] var ubo : UBO; struct S { data : array; -}; +} struct Result { out : i32; -}; +} [[group(0), binding(1)]] var result : Result; diff --git a/test/bug/fxc/dyn_array_idx/write/function.wgsl.expected.wgsl b/test/bug/fxc/dyn_array_idx/write/function.wgsl.expected.wgsl index dc84c698cb..18b069c573 100644 --- a/test/bug/fxc/dyn_array_idx/write/function.wgsl.expected.wgsl +++ b/test/bug/fxc/dyn_array_idx/write/function.wgsl.expected.wgsl @@ -1,16 +1,16 @@ struct UBO { dynamic_idx : i32; -}; +} [[group(0), binding(0)]] var ubo : UBO; struct S { data : array; -}; +} struct Result { out : i32; -}; +} [[group(0), binding(1)]] var result : Result; diff --git a/test/bug/fxc/dyn_array_idx/write/function_via_param.wgsl.expected.wgsl b/test/bug/fxc/dyn_array_idx/write/function_via_param.wgsl.expected.wgsl index d560432205..57c8a26129 100644 --- a/test/bug/fxc/dyn_array_idx/write/function_via_param.wgsl.expected.wgsl +++ b/test/bug/fxc/dyn_array_idx/write/function_via_param.wgsl.expected.wgsl @@ -1,16 +1,16 @@ struct UBO { dynamic_idx : i32; -}; +} [[group(0), binding(0)]] var ubo : UBO; struct S { data : array; -}; +} struct Result { out : i32; -}; +} [[group(0), binding(1)]] var result : Result; diff --git a/test/bug/fxc/dyn_array_idx/write/private.wgsl.expected.wgsl b/test/bug/fxc/dyn_array_idx/write/private.wgsl.expected.wgsl index 36ef54714a..754400635b 100644 --- a/test/bug/fxc/dyn_array_idx/write/private.wgsl.expected.wgsl +++ b/test/bug/fxc/dyn_array_idx/write/private.wgsl.expected.wgsl @@ -1,16 +1,16 @@ struct UBO { dynamic_idx : i32; -}; +} [[group(0), binding(0)]] var ubo : UBO; struct S { data : array; -}; +} struct Result { out : i32; -}; +} [[group(0), binding(1)]] var result : Result; diff --git a/test/bug/fxc/dyn_array_idx/write/private_via_param.wgsl.expected.wgsl b/test/bug/fxc/dyn_array_idx/write/private_via_param.wgsl.expected.wgsl index 5a820acc75..fd99ff2866 100644 --- a/test/bug/fxc/dyn_array_idx/write/private_via_param.wgsl.expected.wgsl +++ b/test/bug/fxc/dyn_array_idx/write/private_via_param.wgsl.expected.wgsl @@ -1,16 +1,16 @@ struct UBO { dynamic_idx : i32; -}; +} [[group(0), binding(0)]] var ubo : UBO; struct S { data : array; -}; +} struct Result { out : i32; -}; +} [[group(0), binding(1)]] var result : Result; diff --git a/test/bug/fxc/dyn_array_idx/write/storage.wgsl.expected.wgsl b/test/bug/fxc/dyn_array_idx/write/storage.wgsl.expected.wgsl index 9e51589a45..b3d0217fcf 100644 --- a/test/bug/fxc/dyn_array_idx/write/storage.wgsl.expected.wgsl +++ b/test/bug/fxc/dyn_array_idx/write/storage.wgsl.expected.wgsl @@ -1,18 +1,18 @@ struct UBO { dynamic_idx : i32; -}; +} [[group(0), binding(0)]] var ubo : UBO; struct Result { out : i32; -}; +} [[group(0), binding(2)]] var result : Result; struct SSBO { data : array; -}; +} [[group(0), binding(1)]] var ssbo : SSBO; diff --git a/test/bug/fxc/dyn_array_idx/write/workgroup.wgsl.expected.wgsl b/test/bug/fxc/dyn_array_idx/write/workgroup.wgsl.expected.wgsl index 4874b2a3aa..7c122d1a73 100644 --- a/test/bug/fxc/dyn_array_idx/write/workgroup.wgsl.expected.wgsl +++ b/test/bug/fxc/dyn_array_idx/write/workgroup.wgsl.expected.wgsl @@ -1,16 +1,16 @@ struct UBO { dynamic_idx : i32; -}; +} [[group(0), binding(0)]] var ubo : UBO; struct S { data : array; -}; +} struct Result { out : i32; -}; +} [[group(0), binding(1)]] var result : Result; diff --git a/test/bug/fxc/indexed_assign_to_array_in_struct/1206.wgsl.expected.wgsl b/test/bug/fxc/indexed_assign_to_array_in_struct/1206.wgsl.expected.wgsl index 239e359145..818e3b4134 100644 --- a/test/bug/fxc/indexed_assign_to_array_in_struct/1206.wgsl.expected.wgsl +++ b/test/bug/fxc/indexed_assign_to_array_in_struct/1206.wgsl.expected.wgsl @@ -1,17 +1,17 @@ struct Simulation { i : u32; -}; +} struct Particle { position : array, 8>; lifetime : f32; color : vec4; velocity : vec3; -}; +} struct Particles { p : array; -}; +} [[group(1), binding(3)]] var particles : Particles; diff --git a/test/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_x.wgsl.expected.wgsl b/test/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_x.wgsl.expected.wgsl index c2015383f8..3b201def94 100644 --- a/test/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_x.wgsl.expected.wgsl +++ b/test/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_x.wgsl.expected.wgsl @@ -1,7 +1,7 @@ struct Uniforms { i : u32; j : u32; -}; +} [[group(1), binding(4)]] var uniforms : Uniforms; diff --git a/test/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_xy.wgsl.expected.wgsl b/test/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_xy.wgsl.expected.wgsl index 11e2eaeb1b..8b37003eda 100644 --- a/test/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_xy.wgsl.expected.wgsl +++ b/test/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_xy.wgsl.expected.wgsl @@ -1,7 +1,7 @@ struct Uniforms { i : u32; j : u32; -}; +} [[group(1), binding(4)]] var uniforms : Uniforms; diff --git a/test/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_y.wgsl.expected.wgsl b/test/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_y.wgsl.expected.wgsl index d8c4481b39..031f689aee 100644 --- a/test/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_y.wgsl.expected.wgsl +++ b/test/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_y.wgsl.expected.wgsl @@ -1,7 +1,7 @@ struct Uniforms { i : u32; j : u32; -}; +} [[group(1), binding(4)]] var uniforms : Uniforms; diff --git a/test/bug/fxc/matrix_assignment_dynamic_index/local_assign_vector.wgsl.expected.wgsl b/test/bug/fxc/matrix_assignment_dynamic_index/local_assign_vector.wgsl.expected.wgsl index ffabd7b448..4dc3783313 100644 --- a/test/bug/fxc/matrix_assignment_dynamic_index/local_assign_vector.wgsl.expected.wgsl +++ b/test/bug/fxc/matrix_assignment_dynamic_index/local_assign_vector.wgsl.expected.wgsl @@ -1,7 +1,7 @@ struct Uniforms { i : u32; j : u32; -}; +} [[group(1), binding(4)]] var uniforms : Uniforms; diff --git a/test/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_x.wgsl.expected.wgsl b/test/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_x.wgsl.expected.wgsl index 86f180d095..bc312b2e18 100644 --- a/test/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_x.wgsl.expected.wgsl +++ b/test/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_x.wgsl.expected.wgsl @@ -1,7 +1,7 @@ struct Uniforms { i : u32; j : u32; -}; +} [[group(1), binding(4)]] var uniforms : Uniforms; diff --git a/test/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_xy.wgsl.expected.wgsl b/test/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_xy.wgsl.expected.wgsl index 99e8629876..f706b60a7d 100644 --- a/test/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_xy.wgsl.expected.wgsl +++ b/test/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_xy.wgsl.expected.wgsl @@ -1,7 +1,7 @@ struct Uniforms { i : u32; j : u32; -}; +} [[group(1), binding(4)]] var uniforms : Uniforms; diff --git a/test/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_y.wgsl.expected.wgsl b/test/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_y.wgsl.expected.wgsl index d8c4481b39..031f689aee 100644 --- a/test/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_y.wgsl.expected.wgsl +++ b/test/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_y.wgsl.expected.wgsl @@ -1,7 +1,7 @@ struct Uniforms { i : u32; j : u32; -}; +} [[group(1), binding(4)]] var uniforms : Uniforms; diff --git a/test/bug/fxc/matrix_assignment_dynamic_index/module_assign_vector.wgsl.expected.wgsl b/test/bug/fxc/matrix_assignment_dynamic_index/module_assign_vector.wgsl.expected.wgsl index 856e7d3631..b1c72550f9 100644 --- a/test/bug/fxc/matrix_assignment_dynamic_index/module_assign_vector.wgsl.expected.wgsl +++ b/test/bug/fxc/matrix_assignment_dynamic_index/module_assign_vector.wgsl.expected.wgsl @@ -1,7 +1,7 @@ struct Uniforms { i : u32; j : u32; -}; +} [[group(1), binding(4)]] var uniforms : Uniforms; diff --git a/test/bug/tint/1046.wgsl.expected.wgsl b/test/bug/tint/1046.wgsl.expected.wgsl index 310472cc29..d67947b9b0 100644 --- a/test/bug/tint/1046.wgsl.expected.wgsl +++ b/test/bug/tint/1046.wgsl.expected.wgsl @@ -1,10 +1,10 @@ struct PointLight { position : vec4; -}; +} struct PointLights { values : [[stride(16)]] array; -}; +} struct Uniforms { worldView : mat4x4; @@ -12,7 +12,7 @@ struct Uniforms { numPointLights : u32; color_source : u32; color : vec4; -}; +} [[binding(0), group(0)]] var uniforms : Uniforms; @@ -33,12 +33,12 @@ struct FragmentInput { uv : vec2; [[location(3)]] color : vec4; -}; +} struct FragmentOutput { [[location(0)]] color : vec4; -}; +} fn getColor(fragment : FragmentInput) -> vec4 { var color : vec4; diff --git a/test/bug/tint/1076.wgsl.expected.wgsl b/test/bug/tint/1076.wgsl.expected.wgsl index 311d625cd5..8a91c0869b 100644 --- a/test/bug/tint/1076.wgsl.expected.wgsl +++ b/test/bug/tint/1076.wgsl.expected.wgsl @@ -3,7 +3,7 @@ struct FragIn { a : f32; [[builtin(sample_mask)]] mask : u32; -}; +} [[stage(fragment)]] fn main(in : FragIn, [[location(1)]] b : f32) -> FragIn { diff --git a/test/bug/tint/1088.spvasm.expected.wgsl b/test/bug/tint/1088.spvasm.expected.wgsl index d5d50764fc..d31ca16343 100644 --- a/test/bug/tint/1088.spvasm.expected.wgsl +++ b/test/bug/tint/1088.spvasm.expected.wgsl @@ -9,7 +9,7 @@ struct LeftOver { padding : u32; test2 : Arr; test : Arr_1; -}; +} var position : vec3; @@ -53,7 +53,7 @@ struct main_out { gl_Position : vec4; [[location(0)]] vUV_1 : vec2; -}; +} [[stage(vertex)]] fn main([[location(0)]] position_param : vec3, [[location(2)]] uv_param : vec2, [[location(1)]] normal_param : vec3) -> main_out { diff --git a/test/bug/tint/1113.wgsl.expected.wgsl b/test/bug/tint/1113.wgsl.expected.wgsl index f8db09d406..ce45595aa1 100644 --- a/test/bug/tint/1113.wgsl.expected.wgsl +++ b/test/bug/tint/1113.wgsl.expected.wgsl @@ -5,7 +5,7 @@ struct Uniforms { pad2 : u32; bbMin : vec3; bbMax : vec3; -}; +} struct Dbg { offsetCounter : atomic; @@ -20,27 +20,27 @@ struct Dbg { value_f32_1 : f32; value_f32_2 : f32; value_f32_3 : f32; -}; +} struct F32s { values : [[stride(4)]] array; -}; +} struct U32s { values : [[stride(4)]] array; -}; +} struct I32s { values : [[stride(4)]] array; -}; +} struct AU32s { values : [[stride(4)]] array>; -}; +} struct AI32s { values : [[stride(4)]] array>; -}; +} [[binding(0), group(0)]] var uniforms : Uniforms; diff --git a/test/bug/tint/1121.wgsl.expected.wgsl b/test/bug/tint/1121.wgsl.expected.wgsl index 4f28ea47f7..262096765a 100644 --- a/test/bug/tint/1121.wgsl.expected.wgsl +++ b/test/bug/tint/1121.wgsl.expected.wgsl @@ -2,22 +2,22 @@ struct LightData { position : vec4; color : vec3; radius : f32; -}; +} struct LightsBuffer { lights : array; -}; +} [[group(0), binding(0)]] var lightsBuffer : LightsBuffer; struct TileLightIdData { count : atomic; lightId : array; -}; +} struct Tiles { data : array; -}; +} [[group(1), binding(0)]] var tileLightId : Tiles; @@ -28,7 +28,7 @@ struct Config { tileCountY : u32; numTileLightSlot : u32; tileSize : u32; -}; +} [[group(2), binding(0)]] var config : Config; @@ -38,7 +38,7 @@ struct Uniforms { viewMatrix : mat4x4; projectionMatrix : mat4x4; fullScreenSize : vec4; -}; +} [[group(3), binding(0)]] var uniforms : Uniforms; diff --git a/test/bug/tint/1136.wgsl.expected.wgsl b/test/bug/tint/1136.wgsl.expected.wgsl index b23fded20d..7bf2195ce6 100644 --- a/test/bug/tint/1136.wgsl.expected.wgsl +++ b/test/bug/tint/1136.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct Buffer { data : u32; -}; +} [[group(0), binding(0)]] var buffer : Buffer; diff --git a/test/bug/tint/221.wgsl.expected.wgsl b/test/bug/tint/221.wgsl.expected.wgsl index de43263aba..6173b616a7 100644 --- a/test/bug/tint/221.wgsl.expected.wgsl +++ b/test/bug/tint/221.wgsl.expected.wgsl @@ -3,7 +3,7 @@ type Arr = array; struct Buf { count : u32; data : Arr; -}; +} [[group(0), binding(0)]] var b : Buf; diff --git a/test/bug/tint/294.wgsl.expected.wgsl b/test/bug/tint/294.wgsl.expected.wgsl index 7cb86982a4..f4c1358137 100644 --- a/test/bug/tint/294.wgsl.expected.wgsl +++ b/test/bug/tint/294.wgsl.expected.wgsl @@ -1,10 +1,10 @@ struct Light { position : vec3; colour : vec3; -}; +} struct Lights { light : [[stride(32)]] array; -}; +} [[group(0), binding(1)]] var lights : Lights; diff --git a/test/bug/tint/369.wgsl.expected.wgsl b/test/bug/tint/369.wgsl.expected.wgsl index 7f4547368d..f4192a7741 100644 --- a/test/bug/tint/369.wgsl.expected.wgsl +++ b/test/bug/tint/369.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct S { m : mat2x2; -}; +} [[group(0), binding(0)]] var SSBO : S; diff --git a/test/bug/tint/403.wgsl.expected.wgsl b/test/bug/tint/403.wgsl.expected.wgsl index 6e1ae4459c..2fa1f18489 100644 --- a/test/bug/tint/403.wgsl.expected.wgsl +++ b/test/bug/tint/403.wgsl.expected.wgsl @@ -1,10 +1,10 @@ struct vertexUniformBuffer1 { transform1 : mat2x2; -}; +} struct vertexUniformBuffer2 { transform2 : mat2x2; -}; +} [[group(0), binding(0)]] var x_20 : vertexUniformBuffer1; diff --git a/test/bug/tint/492.wgsl.expected.wgsl b/test/bug/tint/492.wgsl.expected.wgsl index 3b56c94128..6563f70603 100644 --- a/test/bug/tint/492.wgsl.expected.wgsl +++ b/test/bug/tint/492.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct S { a : i32; -}; +} [[group(0), binding(0)]] var buf : S; diff --git a/test/bug/tint/534.wgsl.expected.wgsl b/test/bug/tint/534.wgsl.expected.wgsl index 76047459d4..bc45f8a754 100644 --- a/test/bug/tint/534.wgsl.expected.wgsl +++ b/test/bug/tint/534.wgsl.expected.wgsl @@ -3,11 +3,11 @@ struct Uniforms { isFloat16 : u32; isRGB10A2Unorm : u32; channelCount : u32; -}; +} struct OutputBuf { result : [[stride(4)]] array; -}; +} [[group(0), binding(0)]] var src : texture_2d; diff --git a/test/bug/tint/744.wgsl.expected.wgsl b/test/bug/tint/744.wgsl.expected.wgsl index 27c747d7ee..001dd88796 100644 --- a/test/bug/tint/744.wgsl.expected.wgsl +++ b/test/bug/tint/744.wgsl.expected.wgsl @@ -2,11 +2,11 @@ struct Uniforms { aShape : vec2; bShape : vec2; outShape : vec2; -}; +} struct Matrix { numbers : array; -}; +} [[group(0), binding(0)]] var firstMatrix : Matrix; diff --git a/test/bug/tint/749.spvasm.expected.wgsl b/test/bug/tint/749.spvasm.expected.wgsl index 741a6cade2..59e192045a 100644 --- a/test/bug/tint/749.spvasm.expected.wgsl +++ b/test/bug/tint/749.spvasm.expected.wgsl @@ -1,10 +1,10 @@ struct QuicksortObject { numbers : array; -}; +} struct buf0 { resolution : vec2; -}; +} var obj : QuicksortObject; @@ -1476,7 +1476,7 @@ fn main_1() { struct main_out { [[location(0)]] x_GLF_color_1 : vec4; -}; +} [[stage(fragment)]] fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { diff --git a/test/bug/tint/757.wgsl.expected.wgsl b/test/bug/tint/757.wgsl.expected.wgsl index 2407fead93..b19bb0cf78 100644 --- a/test/bug/tint/757.wgsl.expected.wgsl +++ b/test/bug/tint/757.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct Constants { level : i32; -}; +} [[group(0), binding(0)]] var constants : Constants; @@ -8,7 +8,7 @@ struct Constants { struct Result { values : [[stride(4)]] array; -}; +} [[group(0), binding(3)]] var result : Result; diff --git a/test/bug/tint/824.wgsl.expected.wgsl b/test/bug/tint/824.wgsl.expected.wgsl index 6d051de35a..2c795fe1bb 100644 --- a/test/bug/tint/824.wgsl.expected.wgsl +++ b/test/bug/tint/824.wgsl.expected.wgsl @@ -3,7 +3,7 @@ struct Output { Position : vec4; [[location(0)]] color : vec4; -}; +} [[stage(vertex)]] fn main([[builtin(vertex_index)]] VertexIndex : u32, [[builtin(instance_index)]] InstanceIndex : u32) -> Output { diff --git a/test/bug/tint/827.wgsl.expected.wgsl b/test/bug/tint/827.wgsl.expected.wgsl index 48baf0c44d..af06757fc1 100644 --- a/test/bug/tint/827.wgsl.expected.wgsl +++ b/test/bug/tint/827.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct Result { values : array; -}; +} let width : u32 = 128u; diff --git a/test/bug/tint/870.spvasm.expected.wgsl b/test/bug/tint/870.spvasm.expected.wgsl index 9d03c583cd..73a04d4589 100644 --- a/test/bug/tint/870.spvasm.expected.wgsl +++ b/test/bug/tint/870.spvasm.expected.wgsl @@ -5,11 +5,11 @@ struct sspp962805860buildInformationS { offset : vec4; essence : i32; orientation : Arr; -}; +} struct x_B4_BuildInformation { passthru : sspp962805860buildInformationS; -}; +} [[group(0), binding(2)]] var sspp962805860buildInformation : x_B4_BuildInformation; diff --git a/test/bug/tint/913.wgsl.expected.wgsl b/test/bug/tint/913.wgsl.expected.wgsl index ecc1c2bbd7..322d0b1c0f 100644 --- a/test/bug/tint/913.wgsl.expected.wgsl +++ b/test/bug/tint/913.wgsl.expected.wgsl @@ -4,11 +4,11 @@ struct Uniforms { srcCopyOrigin : vec2; dstCopyOrigin : vec2; copySize : vec2; -}; +} struct OutputBuf { result : array; -}; +} [[group(0), binding(0)]] var src : texture_2d; diff --git a/test/bug/tint/914.wgsl.expected.wgsl b/test/bug/tint/914.wgsl.expected.wgsl index 6b42dac4fa..bfa7c61a3e 100644 --- a/test/bug/tint/914.wgsl.expected.wgsl +++ b/test/bug/tint/914.wgsl.expected.wgsl @@ -2,11 +2,11 @@ struct Uniforms { dimAOuter : u32; dimInner : u32; dimBOuter : u32; -}; +} struct Matrix { numbers : array; -}; +} [[group(0), binding(0)]] var firstMatrix : Matrix; diff --git a/test/bug/tint/922.wgsl.expected.wgsl b/test/bug/tint/922.wgsl.expected.wgsl index 6e637c7aae..82929da447 100644 --- a/test/bug/tint/922.wgsl.expected.wgsl +++ b/test/bug/tint/922.wgsl.expected.wgsl @@ -3,31 +3,31 @@ struct Mat4x4_ { my : vec4; mz : vec4; mw : vec4; -}; +} struct Mat4x3_ { mx : vec4; my : vec4; mz : vec4; -}; +} struct Mat4x2_ { mx : vec4; my : vec4; -}; +} struct ub_SceneParams { u_Projection : Mat4x4_; -}; +} struct ub_MaterialParams { u_TexMtx : [[stride(32)]] array; u_Misc0_ : vec4; -}; +} struct ub_PacketParams { u_PosMtx : [[stride(48)]] array; -}; +} struct VertexOutput { [[location(0)]] @@ -36,7 +36,7 @@ struct VertexOutput { v_TexCoord : vec2; [[builtin(position)]] member : vec4; -}; +} [[group(0), binding(0)]] var global : ub_SceneParams; diff --git a/test/bug/tint/926.wgsl.expected.wgsl b/test/bug/tint/926.wgsl.expected.wgsl index b21aa736d5..978979b6e0 100644 --- a/test/bug/tint/926.wgsl.expected.wgsl +++ b/test/bug/tint/926.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct DrawIndirectArgs { vertexCount : atomic; -}; +} [[group(0), binding(5)]] var drawOut : DrawIndirectArgs; diff --git a/test/bug/tint/942.wgsl.expected.wgsl b/test/bug/tint/942.wgsl.expected.wgsl index 327b5aafbc..827326f072 100644 --- a/test/bug/tint/942.wgsl.expected.wgsl +++ b/test/bug/tint/942.wgsl.expected.wgsl @@ -1,7 +1,7 @@ struct Params { filterDim : u32; blockDim : u32; -}; +} [[group(0), binding(0)]] var samp : sampler; @@ -13,7 +13,7 @@ struct Params { struct Flip { value : u32; -}; +} [[group(1), binding(3)]] var flip : Flip; diff --git a/test/bug/tint/943.spvasm.expected.wgsl b/test/bug/tint/943.spvasm.expected.wgsl index ab6b376a10..04699ddd81 100644 --- a/test/bug/tint/943.spvasm.expected.wgsl +++ b/test/bug/tint/943.spvasm.expected.wgsl @@ -12,7 +12,7 @@ struct Uniforms { [[size(4)]] padding_3 : u32; outShapeStrides : vec2; -}; +} type RTArr = [[stride(4)]] array; @@ -20,17 +20,17 @@ type RTArr_1 = [[stride(4)]] array; struct ssbOut { result : RTArr_1; -}; +} type RTArr_2 = [[stride(4)]] array; struct ssbA { A : RTArr_1; -}; +} struct ssbB { B : RTArr_1; -}; +} var dimAOuter_1 : i32; diff --git a/test/bug/tint/948.wgsl.expected.wgsl b/test/bug/tint/948.wgsl.expected.wgsl index 4fe5b0c354..d6a66dbeb2 100644 --- a/test/bug/tint/948.wgsl.expected.wgsl +++ b/test/bug/tint/948.wgsl.expected.wgsl @@ -9,7 +9,7 @@ struct LeftOver { stageScale : f32; spriteCount : f32; colorMul : vec3; -}; +} [[group(2), binding(9)]] var x_20 : LeftOver; @@ -213,7 +213,7 @@ fn main_1() { struct main_out { [[location(0)]] glFragColor_1 : vec4; -}; +} [[stage(fragment)]] fn main([[location(2)]] tUV_param : vec2, [[location(5)]] tileID_1_param : vec2, [[location(4)]] levelUnits_param : vec2, [[location(3)]] stageUnits_1_param : vec2, [[location(0)]] vPosition_param : vec3, [[location(1)]] vUV_param : vec2) -> main_out { diff --git a/test/bug/tint/949.wgsl.expected.wgsl b/test/bug/tint/949.wgsl.expected.wgsl index 68602e113d..8bbc8076b6 100644 --- a/test/bug/tint/949.wgsl.expected.wgsl +++ b/test/bug/tint/949.wgsl.expected.wgsl @@ -1,7 +1,7 @@ struct lightingInfo { diffuse : vec3; specular : vec3; -}; +} struct LeftOver { u_World : mat4x4; @@ -15,7 +15,7 @@ struct LeftOver { [[size(4)]] padding_1 : u32; tangentSpaceParameter0 : vec2; -}; +} struct Light0 { vLightData : vec4; @@ -26,7 +26,7 @@ struct Light0 { padding_2 : u32; shadowsInfo : vec4; depthValues : vec2; -}; +} var u_Float : f32; @@ -438,7 +438,7 @@ fn main_1() { struct main_out { [[location(0)]] glFragColor_1 : vec4; -}; +} [[stage(fragment)]] fn main([[location(1)]] vMainuv_param : vec2, [[location(0)]] v_output1_param : vec4, [[builtin(front_facing)]] gl_FrontFacing_param : bool, [[location(3)]] v_uv_param : vec2, [[location(2)]] v_output2_param : vec4) -> main_out { diff --git a/test/bug/tint/951.spvasm.expected.wgsl b/test/bug/tint/951.spvasm.expected.wgsl index 2440aa7a14..f80adea0e9 100644 --- a/test/bug/tint/951.spvasm.expected.wgsl +++ b/test/bug/tint/951.spvasm.expected.wgsl @@ -4,11 +4,11 @@ type RTArr_1 = [[stride(4)]] array; struct ssbOut { result : RTArr_1; -}; +} struct ssbA { A : RTArr_1; -}; +} struct Uniforms { NAN : f32; @@ -16,7 +16,7 @@ struct Uniforms { outShape : i32; outShapeStrides : i32; size : i32; -}; +} [[group(0), binding(0)]] var x_16 : ssbOut; diff --git a/test/bug/tint/959.wgsl.expected.wgsl b/test/bug/tint/959.wgsl.expected.wgsl index 6a440f783d..4e4ecf0777 100644 --- a/test/bug/tint/959.wgsl.expected.wgsl +++ b/test/bug/tint/959.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct S { a : f32; -}; +} [[group(0), binding(0)]] var b0 : S; diff --git a/test/bug/tint/977.spvasm.expected.wgsl b/test/bug/tint/977.spvasm.expected.wgsl index 711260b314..69bc7aa1c5 100644 --- a/test/bug/tint/977.spvasm.expected.wgsl +++ b/test/bug/tint/977.spvasm.expected.wgsl @@ -4,23 +4,23 @@ type RTArr_1 = [[stride(4)]] array; struct ResultMatrix { numbers : RTArr_1; -}; +} type RTArr_2 = [[stride(4)]] array; struct FirstMatrix { numbers : RTArr_1; -}; +} struct SecondMatrix { numbers : RTArr_1; -}; +} struct Uniforms { NAN : f32; sizeA : i32; sizeB : i32; -}; +} var gl_GlobalInvocationID : vec3; diff --git a/test/bug/tint/978.wgsl.expected.wgsl b/test/bug/tint/978.wgsl.expected.wgsl index a912004334..b73a26e1aa 100644 --- a/test/bug/tint/978.wgsl.expected.wgsl +++ b/test/bug/tint/978.wgsl.expected.wgsl @@ -1,12 +1,12 @@ struct FragmentInput { [[location(2)]] vUv : vec2; -}; +} struct FragmentOutput { [[location(0)]] color : vec4; -}; +} [[binding(5), group(1)]] var depthMap : texture_depth_2d; diff --git a/test/bug/tint/980.wgsl.expected.wgsl b/test/bug/tint/980.wgsl.expected.wgsl index 1af06bae1f..b74a7cb215 100644 --- a/test/bug/tint/980.wgsl.expected.wgsl +++ b/test/bug/tint/980.wgsl.expected.wgsl @@ -7,7 +7,7 @@ fn Bad(index : u32, rd : vec3) -> vec3 { struct S { v : vec3; i : u32; -}; +} [[binding(0), group(0)]] var io : S; diff --git a/test/bug/tint/993.wgsl.expected.wgsl b/test/bug/tint/993.wgsl.expected.wgsl index 588ebed112..12eb2ae63c 100644 --- a/test/bug/tint/993.wgsl.expected.wgsl +++ b/test/bug/tint/993.wgsl.expected.wgsl @@ -1,18 +1,18 @@ struct Constants { zero : u32; -}; +} [[group(1), binding(0)]] var constants : Constants; struct Result { value : u32; -}; +} [[group(1), binding(1)]] var result : Result; struct TestData { data : array, 3>; -}; +} [[group(0), binding(0)]] var s : TestData; diff --git a/test/bug/tint/998.wgsl.expected.wgsl b/test/bug/tint/998.wgsl.expected.wgsl index f6e3471fa2..e7abd6d557 100644 --- a/test/bug/tint/998.wgsl.expected.wgsl +++ b/test/bug/tint/998.wgsl.expected.wgsl @@ -1,18 +1,18 @@ struct Constants { zero : u32; -}; +} [[group(1), binding(0)]] var constants : Constants; struct Result { value : u32; -}; +} [[group(1), binding(1)]] var result : Result; struct S { data : array; -}; +} var s : S; diff --git a/test/expressions/binary/mul/mat3x2-vec3/f32.wgsl.expected.wgsl b/test/expressions/binary/mul/mat3x2-vec3/f32.wgsl.expected.wgsl index ae7c935808..adb8e744eb 100644 --- a/test/expressions/binary/mul/mat3x2-vec3/f32.wgsl.expected.wgsl +++ b/test/expressions/binary/mul/mat3x2-vec3/f32.wgsl.expected.wgsl @@ -1,7 +1,7 @@ struct S { matrix : mat3x2; vector : vec3; -}; +} [[group(0), binding(0)]] var data : S; diff --git a/test/expressions/binary/mul/mat3x3-vec3/f32.wgsl.expected.wgsl b/test/expressions/binary/mul/mat3x3-vec3/f32.wgsl.expected.wgsl index 67be8b677b..461d0c75b9 100644 --- a/test/expressions/binary/mul/mat3x3-vec3/f32.wgsl.expected.wgsl +++ b/test/expressions/binary/mul/mat3x3-vec3/f32.wgsl.expected.wgsl @@ -1,7 +1,7 @@ struct S { matrix : mat3x3; vector : vec3; -}; +} [[group(0), binding(0)]] var data : S; diff --git a/test/expressions/binary/mul/vec3-mat3x3/f32.wgsl.expected.wgsl b/test/expressions/binary/mul/vec3-mat3x3/f32.wgsl.expected.wgsl index 884e94ce2e..10e087f1a8 100644 --- a/test/expressions/binary/mul/vec3-mat3x3/f32.wgsl.expected.wgsl +++ b/test/expressions/binary/mul/vec3-mat3x3/f32.wgsl.expected.wgsl @@ -1,7 +1,7 @@ struct S { matrix : mat3x3; vector : vec3; -}; +} [[group(0), binding(0)]] var data : S; diff --git a/test/expressions/binary/mul/vec3-mat4x3/f32.wgsl.expected.wgsl b/test/expressions/binary/mul/vec3-mat4x3/f32.wgsl.expected.wgsl index 36c0fe46af..223240fc2c 100644 --- a/test/expressions/binary/mul/vec3-mat4x3/f32.wgsl.expected.wgsl +++ b/test/expressions/binary/mul/vec3-mat4x3/f32.wgsl.expected.wgsl @@ -1,7 +1,7 @@ struct S { matrix : mat4x3; vector : vec3; -}; +} [[group(0), binding(0)]] var data : S; diff --git a/test/expressions/literals/-inf.spvasm.expected.wgsl b/test/expressions/literals/-inf.spvasm.expected.wgsl index 3e916f66a7..60e728102e 100644 --- a/test/expressions/literals/-inf.spvasm.expected.wgsl +++ b/test/expressions/literals/-inf.spvasm.expected.wgsl @@ -8,7 +8,7 @@ fn main_1() { struct main_out { [[location(0)]] out_var_SV_TARGET_1 : vec4; -}; +} [[stage(fragment)]] fn main() -> main_out { diff --git a/test/expressions/literals/inf.spvasm.expected.wgsl b/test/expressions/literals/inf.spvasm.expected.wgsl index c4dd750b2d..0389b9860d 100644 --- a/test/expressions/literals/inf.spvasm.expected.wgsl +++ b/test/expressions/literals/inf.spvasm.expected.wgsl @@ -8,7 +8,7 @@ fn main_1() { struct main_out { [[location(0)]] out_var_SV_TARGET_1 : vec4; -}; +} [[stage(fragment)]] fn main() -> main_out { diff --git a/test/expressions/literals/nan.spvasm.expected.wgsl b/test/expressions/literals/nan.spvasm.expected.wgsl index a72149c9cd..816c89ee24 100644 --- a/test/expressions/literals/nan.spvasm.expected.wgsl +++ b/test/expressions/literals/nan.spvasm.expected.wgsl @@ -8,7 +8,7 @@ fn main_1() { struct main_out { [[location(0)]] out_var_SV_TARGET_1 : vec4; -}; +} [[stage(fragment)]] fn main() -> main_out { diff --git a/test/expressions/swizzle/read/packed_vec3/f32.wgsl.expected.wgsl b/test/expressions/swizzle/read/packed_vec3/f32.wgsl.expected.wgsl index 6a0255bfa9..727788bee9 100644 --- a/test/expressions/swizzle/read/packed_vec3/f32.wgsl.expected.wgsl +++ b/test/expressions/swizzle/read/packed_vec3/f32.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct S { v : vec3; -}; +} [[group(0), binding(0)]] var U : S; diff --git a/test/expressions/swizzle/read/packed_vec3/i32.wgsl.expected.wgsl b/test/expressions/swizzle/read/packed_vec3/i32.wgsl.expected.wgsl index 9220cb8f30..dffd20c935 100644 --- a/test/expressions/swizzle/read/packed_vec3/i32.wgsl.expected.wgsl +++ b/test/expressions/swizzle/read/packed_vec3/i32.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct S { v : vec3; -}; +} [[group(0), binding(0)]] var U : S; diff --git a/test/expressions/swizzle/read/packed_vec3/u32.wgsl.expected.wgsl b/test/expressions/swizzle/read/packed_vec3/u32.wgsl.expected.wgsl index e77660c724..36bf160bae 100644 --- a/test/expressions/swizzle/read/packed_vec3/u32.wgsl.expected.wgsl +++ b/test/expressions/swizzle/read/packed_vec3/u32.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct S { v : vec3; -}; +} [[group(0), binding(0)]] var U : S; diff --git a/test/expressions/swizzle/read/vec3/f32.wgsl.expected.wgsl b/test/expressions/swizzle/read/vec3/f32.wgsl.expected.wgsl index cef93bb67b..b3862ad219 100644 --- a/test/expressions/swizzle/read/vec3/f32.wgsl.expected.wgsl +++ b/test/expressions/swizzle/read/vec3/f32.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct S { v : vec3; -}; +} var P : S; diff --git a/test/expressions/swizzle/read/vec3/i32.wgsl.expected.wgsl b/test/expressions/swizzle/read/vec3/i32.wgsl.expected.wgsl index 9b440ce773..72b0026bae 100644 --- a/test/expressions/swizzle/read/vec3/i32.wgsl.expected.wgsl +++ b/test/expressions/swizzle/read/vec3/i32.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct S { v : vec3; -}; +} var P : S; diff --git a/test/expressions/swizzle/read/vec3/u32.wgsl.expected.wgsl b/test/expressions/swizzle/read/vec3/u32.wgsl.expected.wgsl index 390ba90985..1756e9964b 100644 --- a/test/expressions/swizzle/read/vec3/u32.wgsl.expected.wgsl +++ b/test/expressions/swizzle/read/vec3/u32.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct S { v : vec3; -}; +} var P : S; diff --git a/test/expressions/swizzle/write/packed_vec3/f32.wgsl.expected.wgsl b/test/expressions/swizzle/write/packed_vec3/f32.wgsl.expected.wgsl index 35bcaa3c40..84f2ef9b70 100644 --- a/test/expressions/swizzle/write/packed_vec3/f32.wgsl.expected.wgsl +++ b/test/expressions/swizzle/write/packed_vec3/f32.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct S { v : vec3; -}; +} [[group(0), binding(0)]] var U : S; diff --git a/test/expressions/swizzle/write/packed_vec3/i32.wgsl.expected.wgsl b/test/expressions/swizzle/write/packed_vec3/i32.wgsl.expected.wgsl index 75986e14f7..a0175896cd 100644 --- a/test/expressions/swizzle/write/packed_vec3/i32.wgsl.expected.wgsl +++ b/test/expressions/swizzle/write/packed_vec3/i32.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct S { v : vec3; -}; +} [[group(0), binding(0)]] var U : S; diff --git a/test/expressions/swizzle/write/packed_vec3/u32.wgsl.expected.wgsl b/test/expressions/swizzle/write/packed_vec3/u32.wgsl.expected.wgsl index 8db4caf3c2..b9c4866126 100644 --- a/test/expressions/swizzle/write/packed_vec3/u32.wgsl.expected.wgsl +++ b/test/expressions/swizzle/write/packed_vec3/u32.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct S { v : vec3; -}; +} [[group(0), binding(0)]] var U : S; diff --git a/test/expressions/swizzle/write/vec3/f32.wgsl.expected.wgsl b/test/expressions/swizzle/write/vec3/f32.wgsl.expected.wgsl index 83e6e31f45..9eab0b0a42 100644 --- a/test/expressions/swizzle/write/vec3/f32.wgsl.expected.wgsl +++ b/test/expressions/swizzle/write/vec3/f32.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct S { v : vec3; -}; +} var P : S; diff --git a/test/expressions/swizzle/write/vec3/i32.wgsl.expected.wgsl b/test/expressions/swizzle/write/vec3/i32.wgsl.expected.wgsl index 0c055dfcd4..bd00bb3fed 100644 --- a/test/expressions/swizzle/write/vec3/i32.wgsl.expected.wgsl +++ b/test/expressions/swizzle/write/vec3/i32.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct S { v : vec3; -}; +} var P : S; diff --git a/test/expressions/swizzle/write/vec3/u32.wgsl.expected.wgsl b/test/expressions/swizzle/write/vec3/u32.wgsl.expected.wgsl index 301f985152..0323375bc0 100644 --- a/test/expressions/swizzle/write/vec3/u32.wgsl.expected.wgsl +++ b/test/expressions/swizzle/write/vec3/u32.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct S { v : vec3; -}; +} var P : S; diff --git a/test/expressions/zero_init/array/struct.wgsl.expected.wgsl b/test/expressions/zero_init/array/struct.wgsl.expected.wgsl index 939e93be79..c864d0fa2e 100644 --- a/test/expressions/zero_init/array/struct.wgsl.expected.wgsl +++ b/test/expressions/zero_init/array/struct.wgsl.expected.wgsl @@ -3,7 +3,7 @@ struct S { u : u32; f : f32; b : bool; -}; +} fn f() { var v = array(); diff --git a/test/expressions/zero_init/struct/array.wgsl.expected.wgsl b/test/expressions/zero_init/struct/array.wgsl.expected.wgsl index 522939f0e5..97b1cce8d3 100644 --- a/test/expressions/zero_init/struct/array.wgsl.expected.wgsl +++ b/test/expressions/zero_init/struct/array.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct S { a : array; -}; +} fn f() { var v = S(); diff --git a/test/expressions/zero_init/struct/scalar.wgsl.expected.wgsl b/test/expressions/zero_init/struct/scalar.wgsl.expected.wgsl index 0da534fa25..cd48ab42a1 100644 --- a/test/expressions/zero_init/struct/scalar.wgsl.expected.wgsl +++ b/test/expressions/zero_init/struct/scalar.wgsl.expected.wgsl @@ -3,7 +3,7 @@ struct S { u : u32; f : f32; b : bool; -}; +} fn f() { var v = S(); diff --git a/test/identifiers/underscore/double/struct.wgsl.expected.wgsl b/test/identifiers/underscore/double/struct.wgsl.expected.wgsl index 2a008b63fc..ad84d6633c 100644 --- a/test/identifiers/underscore/double/struct.wgsl.expected.wgsl +++ b/test/identifiers/underscore/double/struct.wgsl.expected.wgsl @@ -1,10 +1,10 @@ struct a { b : i32; -}; +} struct a__ { b__ : i32; -}; +} fn f() { let c = a__(); diff --git a/test/identifiers/underscore/prefix/lower/struct.wgsl.expected.wgsl b/test/identifiers/underscore/prefix/lower/struct.wgsl.expected.wgsl index 6565fc16ca..a9953901eb 100644 --- a/test/identifiers/underscore/prefix/lower/struct.wgsl.expected.wgsl +++ b/test/identifiers/underscore/prefix/lower/struct.wgsl.expected.wgsl @@ -1,10 +1,10 @@ struct a { b : i32; -}; +} struct _a { _b : i32; -}; +} fn f() { let c = _a(); diff --git a/test/identifiers/underscore/prefix/upper/struct.wgsl.expected.wgsl b/test/identifiers/underscore/prefix/upper/struct.wgsl.expected.wgsl index 243f3686d3..97a6d4c35e 100644 --- a/test/identifiers/underscore/prefix/upper/struct.wgsl.expected.wgsl +++ b/test/identifiers/underscore/prefix/upper/struct.wgsl.expected.wgsl @@ -1,10 +1,10 @@ struct A { B : i32; -}; +} struct _A { _B : i32; -}; +} fn f() { let c = _A(); diff --git a/test/intrinsics/arrayLength/complex_via_let.wgsl.expected.wgsl b/test/intrinsics/arrayLength/complex_via_let.wgsl.expected.wgsl index 0448ef6e4d..1dcc7b115c 100644 --- a/test/intrinsics/arrayLength/complex_via_let.wgsl.expected.wgsl +++ b/test/intrinsics/arrayLength/complex_via_let.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct S { a : array; -}; +} [[group(0), binding(0)]] var G : S; diff --git a/test/intrinsics/arrayLength/deprecated.wgsl.expected.wgsl b/test/intrinsics/arrayLength/deprecated.wgsl.expected.wgsl index 1db02f450a..5489c10451 100644 --- a/test/intrinsics/arrayLength/deprecated.wgsl.expected.wgsl +++ b/test/intrinsics/arrayLength/deprecated.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct S { a : array; -}; +} [[group(0), binding(0)]] var G : S; diff --git a/test/intrinsics/arrayLength/simple.wgsl.expected.wgsl b/test/intrinsics/arrayLength/simple.wgsl.expected.wgsl index 72d32ba509..9b7d0494f5 100644 --- a/test/intrinsics/arrayLength/simple.wgsl.expected.wgsl +++ b/test/intrinsics/arrayLength/simple.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct S { a : array; -}; +} [[group(0), binding(0)]] var G : S; diff --git a/test/intrinsics/arrayLength/via_let.wgsl.expected.wgsl b/test/intrinsics/arrayLength/via_let.wgsl.expected.wgsl index 163a302164..13663f0105 100644 --- a/test/intrinsics/arrayLength/via_let.wgsl.expected.wgsl +++ b/test/intrinsics/arrayLength/via_let.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct S { a : array; -}; +} [[group(0), binding(0)]] var G : S; diff --git a/test/intrinsics/arrayLength/via_let_complex.wgsl.expected.wgsl b/test/intrinsics/arrayLength/via_let_complex.wgsl.expected.wgsl index d4255df7ed..7b0795290c 100644 --- a/test/intrinsics/arrayLength/via_let_complex.wgsl.expected.wgsl +++ b/test/intrinsics/arrayLength/via_let_complex.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct S { a : array; -}; +} [[group(0), binding(0)]] var G : S; diff --git a/test/intrinsics/gen/arrayLength/1588cd.wgsl.expected.wgsl b/test/intrinsics/gen/arrayLength/1588cd.wgsl.expected.wgsl index a3c1031776..645da49d5a 100644 --- a/test/intrinsics/gen/arrayLength/1588cd.wgsl.expected.wgsl +++ b/test/intrinsics/gen/arrayLength/1588cd.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct SB_RO { arg_0 : array; -}; +} [[group(0), binding(1)]] var sb_ro : SB_RO; diff --git a/test/intrinsics/gen/arrayLength/61b1c7.wgsl.expected.wgsl b/test/intrinsics/gen/arrayLength/61b1c7.wgsl.expected.wgsl index 6d43b631d4..f1d33c25ae 100644 --- a/test/intrinsics/gen/arrayLength/61b1c7.wgsl.expected.wgsl +++ b/test/intrinsics/gen/arrayLength/61b1c7.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct SB_RW { arg_0 : array; -}; +} [[group(0), binding(0)]] var sb_rw : SB_RW; diff --git a/test/intrinsics/gen/arrayLength/a0f5ca.wgsl.expected.wgsl b/test/intrinsics/gen/arrayLength/a0f5ca.wgsl.expected.wgsl index 1e5ca7aa0e..85468b46df 100644 --- a/test/intrinsics/gen/arrayLength/a0f5ca.wgsl.expected.wgsl +++ b/test/intrinsics/gen/arrayLength/a0f5ca.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct SB_RO { arg_0 : array; -}; +} [[group(0), binding(1)]] var sb_ro : SB_RO; diff --git a/test/intrinsics/gen/arrayLength/cdd123.wgsl.expected.wgsl b/test/intrinsics/gen/arrayLength/cdd123.wgsl.expected.wgsl index e0afa3cf03..65a2077866 100644 --- a/test/intrinsics/gen/arrayLength/cdd123.wgsl.expected.wgsl +++ b/test/intrinsics/gen/arrayLength/cdd123.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct SB_RW { arg_0 : array; -}; +} [[group(0), binding(0)]] var sb_rw : SB_RW; diff --git a/test/intrinsics/gen/arrayLength/cfca0a.wgsl.expected.wgsl b/test/intrinsics/gen/arrayLength/cfca0a.wgsl.expected.wgsl index 84f74eba05..8930be06ab 100644 --- a/test/intrinsics/gen/arrayLength/cfca0a.wgsl.expected.wgsl +++ b/test/intrinsics/gen/arrayLength/cfca0a.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct SB_RO { arg_0 : array; -}; +} [[group(0), binding(1)]] var sb_ro : SB_RO; diff --git a/test/intrinsics/gen/arrayLength/eb510f.wgsl.expected.wgsl b/test/intrinsics/gen/arrayLength/eb510f.wgsl.expected.wgsl index 7b7f49cc17..5b8513018a 100644 --- a/test/intrinsics/gen/arrayLength/eb510f.wgsl.expected.wgsl +++ b/test/intrinsics/gen/arrayLength/eb510f.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct SB_RW { arg_0 : array; -}; +} [[group(0), binding(0)]] var sb_rw : SB_RW; diff --git a/test/intrinsics/gen/atomicAdd/8a199a.wgsl.expected.wgsl b/test/intrinsics/gen/atomicAdd/8a199a.wgsl.expected.wgsl index ad75b16dd5..432caa91df 100644 --- a/test/intrinsics/gen/atomicAdd/8a199a.wgsl.expected.wgsl +++ b/test/intrinsics/gen/atomicAdd/8a199a.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct SB_RW { arg_0 : atomic; -}; +} [[group(0), binding(0)]] var sb_rw : SB_RW; diff --git a/test/intrinsics/gen/atomicAdd/d32fe4.wgsl.expected.wgsl b/test/intrinsics/gen/atomicAdd/d32fe4.wgsl.expected.wgsl index acbf6ff190..5bc41caee8 100644 --- a/test/intrinsics/gen/atomicAdd/d32fe4.wgsl.expected.wgsl +++ b/test/intrinsics/gen/atomicAdd/d32fe4.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct SB_RW { arg_0 : atomic; -}; +} [[group(0), binding(0)]] var sb_rw : SB_RW; diff --git a/test/intrinsics/gen/atomicAnd/152966.wgsl.expected.wgsl b/test/intrinsics/gen/atomicAnd/152966.wgsl.expected.wgsl index 026499f9b6..c0be5bca01 100644 --- a/test/intrinsics/gen/atomicAnd/152966.wgsl.expected.wgsl +++ b/test/intrinsics/gen/atomicAnd/152966.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct SB_RW { arg_0 : atomic; -}; +} [[group(0), binding(0)]] var sb_rw : SB_RW; diff --git a/test/intrinsics/gen/atomicAnd/85a8d9.wgsl.expected.wgsl b/test/intrinsics/gen/atomicAnd/85a8d9.wgsl.expected.wgsl index 7f6b09e0c6..c63138b807 100644 --- a/test/intrinsics/gen/atomicAnd/85a8d9.wgsl.expected.wgsl +++ b/test/intrinsics/gen/atomicAnd/85a8d9.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct SB_RW { arg_0 : atomic; -}; +} [[group(0), binding(0)]] var sb_rw : SB_RW; diff --git a/test/intrinsics/gen/atomicCompareExchangeWeak/12871c.wgsl.expected.wgsl b/test/intrinsics/gen/atomicCompareExchangeWeak/12871c.wgsl.expected.wgsl index 990942e801..eed9b1faa9 100644 --- a/test/intrinsics/gen/atomicCompareExchangeWeak/12871c.wgsl.expected.wgsl +++ b/test/intrinsics/gen/atomicCompareExchangeWeak/12871c.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct SB_RW { arg_0 : atomic; -}; +} [[group(0), binding(0)]] var sb_rw : SB_RW; diff --git a/test/intrinsics/gen/atomicCompareExchangeWeak/6673da.wgsl.expected.wgsl b/test/intrinsics/gen/atomicCompareExchangeWeak/6673da.wgsl.expected.wgsl index 985e3bd737..ea4899a1e9 100644 --- a/test/intrinsics/gen/atomicCompareExchangeWeak/6673da.wgsl.expected.wgsl +++ b/test/intrinsics/gen/atomicCompareExchangeWeak/6673da.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct SB_RW { arg_0 : atomic; -}; +} [[group(0), binding(0)]] var sb_rw : SB_RW; diff --git a/test/intrinsics/gen/atomicExchange/d59712.wgsl.expected.wgsl b/test/intrinsics/gen/atomicExchange/d59712.wgsl.expected.wgsl index 293aaaddde..9970c9b1a9 100644 --- a/test/intrinsics/gen/atomicExchange/d59712.wgsl.expected.wgsl +++ b/test/intrinsics/gen/atomicExchange/d59712.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct SB_RW { arg_0 : atomic; -}; +} [[group(0), binding(0)]] var sb_rw : SB_RW; diff --git a/test/intrinsics/gen/atomicExchange/f2e22f.wgsl.expected.wgsl b/test/intrinsics/gen/atomicExchange/f2e22f.wgsl.expected.wgsl index 58c2ae3afa..511c02bf65 100644 --- a/test/intrinsics/gen/atomicExchange/f2e22f.wgsl.expected.wgsl +++ b/test/intrinsics/gen/atomicExchange/f2e22f.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct SB_RW { arg_0 : atomic; -}; +} [[group(0), binding(0)]] var sb_rw : SB_RW; diff --git a/test/intrinsics/gen/atomicLoad/0806ad.wgsl.expected.wgsl b/test/intrinsics/gen/atomicLoad/0806ad.wgsl.expected.wgsl index 3b643bbea9..b0f3f7d52d 100644 --- a/test/intrinsics/gen/atomicLoad/0806ad.wgsl.expected.wgsl +++ b/test/intrinsics/gen/atomicLoad/0806ad.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct SB_RW { arg_0 : atomic; -}; +} [[group(0), binding(0)]] var sb_rw : SB_RW; diff --git a/test/intrinsics/gen/atomicLoad/fe6cc3.wgsl.expected.wgsl b/test/intrinsics/gen/atomicLoad/fe6cc3.wgsl.expected.wgsl index 6155c41ad8..a4b878b917 100644 --- a/test/intrinsics/gen/atomicLoad/fe6cc3.wgsl.expected.wgsl +++ b/test/intrinsics/gen/atomicLoad/fe6cc3.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct SB_RW { arg_0 : atomic; -}; +} [[group(0), binding(0)]] var sb_rw : SB_RW; diff --git a/test/intrinsics/gen/atomicMax/51b9be.wgsl.expected.wgsl b/test/intrinsics/gen/atomicMax/51b9be.wgsl.expected.wgsl index e2dd9eb647..3f36fbc7e2 100644 --- a/test/intrinsics/gen/atomicMax/51b9be.wgsl.expected.wgsl +++ b/test/intrinsics/gen/atomicMax/51b9be.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct SB_RW { arg_0 : atomic; -}; +} [[group(0), binding(0)]] var sb_rw : SB_RW; diff --git a/test/intrinsics/gen/atomicMax/92aa72.wgsl.expected.wgsl b/test/intrinsics/gen/atomicMax/92aa72.wgsl.expected.wgsl index a59e10abb2..d1c9beabe8 100644 --- a/test/intrinsics/gen/atomicMax/92aa72.wgsl.expected.wgsl +++ b/test/intrinsics/gen/atomicMax/92aa72.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct SB_RW { arg_0 : atomic; -}; +} [[group(0), binding(0)]] var sb_rw : SB_RW; diff --git a/test/intrinsics/gen/atomicMin/8e38dc.wgsl.expected.wgsl b/test/intrinsics/gen/atomicMin/8e38dc.wgsl.expected.wgsl index f4da3b55ba..ef749888c6 100644 --- a/test/intrinsics/gen/atomicMin/8e38dc.wgsl.expected.wgsl +++ b/test/intrinsics/gen/atomicMin/8e38dc.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct SB_RW { arg_0 : atomic; -}; +} [[group(0), binding(0)]] var sb_rw : SB_RW; diff --git a/test/intrinsics/gen/atomicMin/c67a74.wgsl.expected.wgsl b/test/intrinsics/gen/atomicMin/c67a74.wgsl.expected.wgsl index 91b08cc19f..1e1fb28295 100644 --- a/test/intrinsics/gen/atomicMin/c67a74.wgsl.expected.wgsl +++ b/test/intrinsics/gen/atomicMin/c67a74.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct SB_RW { arg_0 : atomic; -}; +} [[group(0), binding(0)]] var sb_rw : SB_RW; diff --git a/test/intrinsics/gen/atomicOr/5e95d4.wgsl.expected.wgsl b/test/intrinsics/gen/atomicOr/5e95d4.wgsl.expected.wgsl index 2f15ddd888..a483962b3f 100644 --- a/test/intrinsics/gen/atomicOr/5e95d4.wgsl.expected.wgsl +++ b/test/intrinsics/gen/atomicOr/5e95d4.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct SB_RW { arg_0 : atomic; -}; +} [[group(0), binding(0)]] var sb_rw : SB_RW; diff --git a/test/intrinsics/gen/atomicOr/8d96a0.wgsl.expected.wgsl b/test/intrinsics/gen/atomicOr/8d96a0.wgsl.expected.wgsl index dd150f6911..57de39254b 100644 --- a/test/intrinsics/gen/atomicOr/8d96a0.wgsl.expected.wgsl +++ b/test/intrinsics/gen/atomicOr/8d96a0.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct SB_RW { arg_0 : atomic; -}; +} [[group(0), binding(0)]] var sb_rw : SB_RW; diff --git a/test/intrinsics/gen/atomicStore/cdc29e.wgsl.expected.wgsl b/test/intrinsics/gen/atomicStore/cdc29e.wgsl.expected.wgsl index fc0ae3b8f9..9f19d4311d 100644 --- a/test/intrinsics/gen/atomicStore/cdc29e.wgsl.expected.wgsl +++ b/test/intrinsics/gen/atomicStore/cdc29e.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct SB_RW { arg_0 : atomic; -}; +} [[group(0), binding(0)]] var sb_rw : SB_RW; diff --git a/test/intrinsics/gen/atomicStore/d1e9a6.wgsl.expected.wgsl b/test/intrinsics/gen/atomicStore/d1e9a6.wgsl.expected.wgsl index e038d5033a..803cb0d543 100644 --- a/test/intrinsics/gen/atomicStore/d1e9a6.wgsl.expected.wgsl +++ b/test/intrinsics/gen/atomicStore/d1e9a6.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct SB_RW { arg_0 : atomic; -}; +} [[group(0), binding(0)]] var sb_rw : SB_RW; diff --git a/test/intrinsics/gen/atomicSub/051100.wgsl.expected.wgsl b/test/intrinsics/gen/atomicSub/051100.wgsl.expected.wgsl index e94eefc0c0..1059294929 100644 --- a/test/intrinsics/gen/atomicSub/051100.wgsl.expected.wgsl +++ b/test/intrinsics/gen/atomicSub/051100.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct SB_RW { arg_0 : atomic; -}; +} [[group(0), binding(0)]] var sb_rw : SB_RW; diff --git a/test/intrinsics/gen/atomicSub/15bfc9.wgsl.expected.wgsl b/test/intrinsics/gen/atomicSub/15bfc9.wgsl.expected.wgsl index ca53ef6715..26c3cbedb1 100644 --- a/test/intrinsics/gen/atomicSub/15bfc9.wgsl.expected.wgsl +++ b/test/intrinsics/gen/atomicSub/15bfc9.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct SB_RW { arg_0 : atomic; -}; +} [[group(0), binding(0)]] var sb_rw : SB_RW; diff --git a/test/intrinsics/gen/atomicXor/54510e.wgsl.expected.wgsl b/test/intrinsics/gen/atomicXor/54510e.wgsl.expected.wgsl index c9a654493d..e0ef7e7931 100644 --- a/test/intrinsics/gen/atomicXor/54510e.wgsl.expected.wgsl +++ b/test/intrinsics/gen/atomicXor/54510e.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct SB_RW { arg_0 : atomic; -}; +} [[group(0), binding(0)]] var sb_rw : SB_RW; diff --git a/test/intrinsics/gen/atomicXor/c1b78c.wgsl.expected.wgsl b/test/intrinsics/gen/atomicXor/c1b78c.wgsl.expected.wgsl index 010c0890f5..68404820f7 100644 --- a/test/intrinsics/gen/atomicXor/c1b78c.wgsl.expected.wgsl +++ b/test/intrinsics/gen/atomicXor/c1b78c.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct SB_RW { arg_0 : atomic; -}; +} [[group(0), binding(0)]] var sb_rw : SB_RW; diff --git a/test/intrinsics/ignore/runtime_array.wgsl.expected.wgsl b/test/intrinsics/ignore/runtime_array.wgsl.expected.wgsl index ab69868062..e58a70c3fd 100644 --- a/test/intrinsics/ignore/runtime_array.wgsl.expected.wgsl +++ b/test/intrinsics/ignore/runtime_array.wgsl.expected.wgsl @@ -4,7 +4,7 @@ intrinsics/ignore/runtime_array.wgsl:9:5 warning: use of deprecated intrinsic struct S { arr : array; -}; +} [[binding(0), group(0)]] var s : S; diff --git a/test/intrinsics/ignore/storage_buffer.wgsl.expected.wgsl b/test/intrinsics/ignore/storage_buffer.wgsl.expected.wgsl index 34817fcbb0..0f2f5e96ed 100644 --- a/test/intrinsics/ignore/storage_buffer.wgsl.expected.wgsl +++ b/test/intrinsics/ignore/storage_buffer.wgsl.expected.wgsl @@ -8,7 +8,7 @@ intrinsics/ignore/storage_buffer.wgsl:10:5 warning: use of deprecated intrinsic struct S { i : i32; -}; +} [[binding(0), group(0)]] var s : S; diff --git a/test/intrinsics/ignore/uniform_buffer.wgsl.expected.wgsl b/test/intrinsics/ignore/uniform_buffer.wgsl.expected.wgsl index 2d8a109e27..72a1efe67b 100644 --- a/test/intrinsics/ignore/uniform_buffer.wgsl.expected.wgsl +++ b/test/intrinsics/ignore/uniform_buffer.wgsl.expected.wgsl @@ -8,7 +8,7 @@ intrinsics/ignore/uniform_buffer.wgsl:10:5 warning: use of deprecated intrinsic struct S { i : i32; -}; +} [[binding(0), group(0)]] var u : S; diff --git a/test/intrinsics/textureDimensions/depth_ms.spvasm.expected.wgsl b/test/intrinsics/textureDimensions/depth_ms.spvasm.expected.wgsl index 0dbdb019d6..d7e9e8b7c7 100644 --- a/test/intrinsics/textureDimensions/depth_ms.spvasm.expected.wgsl +++ b/test/intrinsics/textureDimensions/depth_ms.spvasm.expected.wgsl @@ -23,7 +23,7 @@ fn vertex_main_1() { struct vertex_main_out { [[builtin(position)]] tint_symbol_1_1 : vec4; -}; +} [[stage(vertex)]] fn vertex_main() -> vertex_main_out { diff --git a/test/intrinsics/textureLoad/depth_ms.spvasm.expected.wgsl b/test/intrinsics/textureLoad/depth_ms.spvasm.expected.wgsl index c308490f25..13f9223af6 100644 --- a/test/intrinsics/textureLoad/depth_ms.spvasm.expected.wgsl +++ b/test/intrinsics/textureLoad/depth_ms.spvasm.expected.wgsl @@ -23,7 +23,7 @@ fn vertex_main_1() { struct vertex_main_out { [[builtin(position)]] tint_symbol_1_1 : vec4; -}; +} [[stage(vertex)]] fn vertex_main() -> vertex_main_out { diff --git a/test/intrinsics/textureNumSamples/depth_ms.spvasm.expected.wgsl b/test/intrinsics/textureNumSamples/depth_ms.spvasm.expected.wgsl index ac6cc99674..bafa3a8ef1 100644 --- a/test/intrinsics/textureNumSamples/depth_ms.spvasm.expected.wgsl +++ b/test/intrinsics/textureNumSamples/depth_ms.spvasm.expected.wgsl @@ -23,7 +23,7 @@ fn vertex_main_1() { struct vertex_main_out { [[builtin(position)]] tint_symbol_1_1 : vec4; -}; +} [[stage(vertex)]] fn vertex_main() -> vertex_main_out { diff --git a/test/layout/storage/mat2x2/f32.wgsl.expected.wgsl b/test/layout/storage/mat2x2/f32.wgsl.expected.wgsl index 0df98b4d8e..9933db6f5f 100644 --- a/test/layout/storage/mat2x2/f32.wgsl.expected.wgsl +++ b/test/layout/storage/mat2x2/f32.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct SSBO { m : mat2x2; -}; +} [[group(0), binding(0)]] var ssbo : SSBO; diff --git a/test/layout/storage/mat2x2/stride/16.spvasm.expected.wgsl b/test/layout/storage/mat2x2/stride/16.spvasm.expected.wgsl index d2d8b0260a..ffb157a314 100644 --- a/test/layout/storage/mat2x2/stride/16.spvasm.expected.wgsl +++ b/test/layout/storage/mat2x2/stride/16.spvasm.expected.wgsl @@ -1,6 +1,6 @@ struct SSBO { m : [[stride(16)]] array, 2u>; -}; +} [[group(0), binding(0)]] var ssbo : SSBO; diff --git a/test/let/global/global.wgsl.expected.wgsl b/test/let/global/global.wgsl.expected.wgsl index 126f25c373..68c5ae57a9 100644 --- a/test/let/global/global.wgsl.expected.wgsl +++ b/test/let/global/global.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct MyStruct { f1 : f32; -}; +} type MyArray = array; diff --git a/test/let/inferred/function.wgsl.expected.wgsl b/test/let/inferred/function.wgsl.expected.wgsl index 03d68ef1f5..4f5b69ac66 100644 --- a/test/let/inferred/function.wgsl.expected.wgsl +++ b/test/let/inferred/function.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct MyStruct { f1 : f32; -}; +} type MyArray = array; diff --git a/test/ptr_ref/load/global/struct_field.spvasm.expected.wgsl b/test/ptr_ref/load/global/struct_field.spvasm.expected.wgsl index 8771732fd5..67eba57a56 100644 --- a/test/ptr_ref/load/global/struct_field.spvasm.expected.wgsl +++ b/test/ptr_ref/load/global/struct_field.spvasm.expected.wgsl @@ -1,6 +1,6 @@ struct S { i : i32; -}; +} var V : S; diff --git a/test/ptr_ref/load/global/struct_field.wgsl.expected.wgsl b/test/ptr_ref/load/global/struct_field.wgsl.expected.wgsl index 074fe803ba..d0b3e34459 100644 --- a/test/ptr_ref/load/global/struct_field.wgsl.expected.wgsl +++ b/test/ptr_ref/load/global/struct_field.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct S { i : i32; -}; +} var V : S; diff --git a/test/ptr_ref/load/local/ptr_storage.wgsl.expected.wgsl b/test/ptr_ref/load/local/ptr_storage.wgsl.expected.wgsl index 13f8743a0f..3111c5f4ae 100644 --- a/test/ptr_ref/load/local/ptr_storage.wgsl.expected.wgsl +++ b/test/ptr_ref/load/local/ptr_storage.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct S { a : i32; -}; +} [[group(0), binding(0)]] var v : S; diff --git a/test/ptr_ref/load/local/ptr_uniform.wgsl.expected.wgsl b/test/ptr_ref/load/local/ptr_uniform.wgsl.expected.wgsl index 9ce5c5290f..b6f8628c33 100644 --- a/test/ptr_ref/load/local/ptr_uniform.wgsl.expected.wgsl +++ b/test/ptr_ref/load/local/ptr_uniform.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct S { a : i32; -}; +} [[group(0), binding(0)]] var v : S; diff --git a/test/ptr_ref/load/local/struct_field.spvasm.expected.wgsl b/test/ptr_ref/load/local/struct_field.spvasm.expected.wgsl index aa20b42594..ea14750795 100644 --- a/test/ptr_ref/load/local/struct_field.spvasm.expected.wgsl +++ b/test/ptr_ref/load/local/struct_field.spvasm.expected.wgsl @@ -1,6 +1,6 @@ struct S { i : i32; -}; +} fn main_1() { var i : i32; diff --git a/test/ptr_ref/load/local/struct_field.wgsl.expected.wgsl b/test/ptr_ref/load/local/struct_field.wgsl.expected.wgsl index 18aca63324..7bbcb5a598 100644 --- a/test/ptr_ref/load/local/struct_field.wgsl.expected.wgsl +++ b/test/ptr_ref/load/local/struct_field.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct S { i : i32; -}; +} [[stage(compute), workgroup_size(1)]] fn main() { diff --git a/test/ptr_ref/store/global/struct_field.spvasm.expected.wgsl b/test/ptr_ref/store/global/struct_field.spvasm.expected.wgsl index c217a5f895..e70b574562 100644 --- a/test/ptr_ref/store/global/struct_field.spvasm.expected.wgsl +++ b/test/ptr_ref/store/global/struct_field.spvasm.expected.wgsl @@ -1,6 +1,6 @@ struct S { i : i32; -}; +} var V : S; diff --git a/test/ptr_ref/store/local/struct_field.spvasm.expected.wgsl b/test/ptr_ref/store/local/struct_field.spvasm.expected.wgsl index d628330c98..b3b95dfcbf 100644 --- a/test/ptr_ref/store/local/struct_field.spvasm.expected.wgsl +++ b/test/ptr_ref/store/local/struct_field.spvasm.expected.wgsl @@ -1,6 +1,6 @@ struct S { i : i32; -}; +} fn main_1() { var V : S; diff --git a/test/samples/compute_boids.wgsl.expected.wgsl b/test/samples/compute_boids.wgsl.expected.wgsl index 8fd0a198c2..394631c2ef 100644 --- a/test/samples/compute_boids.wgsl.expected.wgsl +++ b/test/samples/compute_boids.wgsl.expected.wgsl @@ -13,7 +13,7 @@ fn frag_main() -> [[location(0)]] vec4 { struct Particle { pos : vec2; vel : vec2; -}; +} struct SimParams { deltaT : f32; @@ -23,11 +23,11 @@ struct SimParams { rule1Scale : f32; rule2Scale : f32; rule3Scale : f32; -}; +} struct Particles { particles : array; -}; +} [[binding(0), group(0)]] var params : SimParams; diff --git a/test/samples/cube.wgsl.expected.wgsl b/test/samples/cube.wgsl.expected.wgsl index 29109a63e0..a764703054 100644 --- a/test/samples/cube.wgsl.expected.wgsl +++ b/test/samples/cube.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct Uniforms { modelViewProjectionMatrix : mat4x4; -}; +} [[binding(0), group(0)]] var uniforms : Uniforms; @@ -9,14 +9,14 @@ struct VertexInput { cur_position : vec4; [[location(1)]] color : vec4; -}; +} struct VertexOutput { [[location(0)]] vtxFragColor : vec4; [[builtin(position)]] Position : vec4; -}; +} [[stage(vertex)]] fn vtx_main(input : VertexInput) -> VertexOutput { diff --git a/test/samples/simple_vertex.spvasm.expected.wgsl b/test/samples/simple_vertex.spvasm.expected.wgsl index 45b705fab8..372bb24214 100644 --- a/test/samples/simple_vertex.spvasm.expected.wgsl +++ b/test/samples/simple_vertex.spvasm.expected.wgsl @@ -8,7 +8,7 @@ fn main_1() { struct main_out { [[builtin(position)]] gl_Position : vec4; -}; +} [[stage(vertex)]] fn main() -> main_out { diff --git a/test/shader_io/compute_input_builtins_struct.wgsl.expected.wgsl b/test/shader_io/compute_input_builtins_struct.wgsl.expected.wgsl index 23d354aef2..c3830ee2a3 100644 --- a/test/shader_io/compute_input_builtins_struct.wgsl.expected.wgsl +++ b/test/shader_io/compute_input_builtins_struct.wgsl.expected.wgsl @@ -9,7 +9,7 @@ struct ComputeInputs { workgroup_id : vec3; [[builtin(num_workgroups)]] num_workgroups : vec3; -}; +} [[stage(compute), workgroup_size(1)]] fn main(inputs : ComputeInputs) { diff --git a/test/shader_io/compute_input_mixed.wgsl.expected.wgsl b/test/shader_io/compute_input_mixed.wgsl.expected.wgsl index bb7428c570..369ae7f18b 100644 --- a/test/shader_io/compute_input_mixed.wgsl.expected.wgsl +++ b/test/shader_io/compute_input_mixed.wgsl.expected.wgsl @@ -1,12 +1,12 @@ struct ComputeInputs0 { [[builtin(local_invocation_id)]] local_invocation_id : vec3; -}; +} struct ComputeInputs1 { [[builtin(workgroup_id)]] workgroup_id : vec3; -}; +} [[stage(compute), workgroup_size(1)]] fn main(inputs0 : ComputeInputs0, [[builtin(local_invocation_index)]] local_invocation_index : u32, [[builtin(global_invocation_id)]] global_invocation_id : vec3, inputs1 : ComputeInputs1) { diff --git a/test/shader_io/fragment_input_builtins_struct.wgsl.expected.wgsl b/test/shader_io/fragment_input_builtins_struct.wgsl.expected.wgsl index 0cf1aeb7ca..79ec5fd007 100644 --- a/test/shader_io/fragment_input_builtins_struct.wgsl.expected.wgsl +++ b/test/shader_io/fragment_input_builtins_struct.wgsl.expected.wgsl @@ -7,7 +7,7 @@ struct FragmentInputs { sample_index : u32; [[builtin(sample_mask)]] sample_mask : u32; -}; +} [[stage(fragment)]] fn main(inputs : FragmentInputs) { diff --git a/test/shader_io/fragment_input_locations_struct.wgsl.expected.wgsl b/test/shader_io/fragment_input_locations_struct.wgsl.expected.wgsl index 4fa7de4121..5179ec9733 100644 --- a/test/shader_io/fragment_input_locations_struct.wgsl.expected.wgsl +++ b/test/shader_io/fragment_input_locations_struct.wgsl.expected.wgsl @@ -7,7 +7,7 @@ struct FragmentInputs { loc2 : f32; [[location(3)]] loc3 : vec4; -}; +} [[stage(fragment)]] fn main(inputs : FragmentInputs) { diff --git a/test/shader_io/fragment_input_mixed.wgsl.expected.wgsl b/test/shader_io/fragment_input_mixed.wgsl.expected.wgsl index a6f21f1b96..bca1e796ea 100644 --- a/test/shader_io/fragment_input_mixed.wgsl.expected.wgsl +++ b/test/shader_io/fragment_input_mixed.wgsl.expected.wgsl @@ -3,14 +3,14 @@ struct FragmentInputs0 { position : vec4; [[location(0), interpolate(flat)]] loc0 : i32; -}; +} struct FragmentInputs1 { [[location(3)]] loc3 : vec4; [[builtin(sample_mask)]] sample_mask : u32; -}; +} [[stage(fragment)]] fn main(inputs0 : FragmentInputs0, [[builtin(front_facing)]] front_facing : bool, [[location(1), interpolate(flat)]] loc1 : u32, [[builtin(sample_index)]] sample_index : u32, inputs1 : FragmentInputs1, [[location(2)]] loc2 : f32) { diff --git a/test/shader_io/fragment_output_builtins_struct.wgsl.expected.wgsl b/test/shader_io/fragment_output_builtins_struct.wgsl.expected.wgsl index 6617a26713..e87f857ea2 100644 --- a/test/shader_io/fragment_output_builtins_struct.wgsl.expected.wgsl +++ b/test/shader_io/fragment_output_builtins_struct.wgsl.expected.wgsl @@ -3,7 +3,7 @@ struct FragmentOutputs { frag_depth : f32; [[builtin(sample_mask)]] sample_mask : u32; -}; +} [[stage(fragment)]] fn main() -> FragmentOutputs { diff --git a/test/shader_io/fragment_output_locations_struct.wgsl.expected.wgsl b/test/shader_io/fragment_output_locations_struct.wgsl.expected.wgsl index 879805ceba..da4e7cf14e 100644 --- a/test/shader_io/fragment_output_locations_struct.wgsl.expected.wgsl +++ b/test/shader_io/fragment_output_locations_struct.wgsl.expected.wgsl @@ -7,7 +7,7 @@ struct FragmentOutputs { loc2 : f32; [[location(3)]] loc3 : vec4; -}; +} [[stage(fragment)]] fn main() -> FragmentOutputs { diff --git a/test/shader_io/fragment_output_mixed.wgsl.expected.wgsl b/test/shader_io/fragment_output_mixed.wgsl.expected.wgsl index 3fb401c30c..80692654c0 100644 --- a/test/shader_io/fragment_output_mixed.wgsl.expected.wgsl +++ b/test/shader_io/fragment_output_mixed.wgsl.expected.wgsl @@ -11,7 +11,7 @@ struct FragmentOutputs { sample_mask : u32; [[location(3)]] loc3 : vec4; -}; +} [[stage(fragment)]] fn main() -> FragmentOutputs { diff --git a/test/shader_io/interpolate_input_struct.wgsl.expected.wgsl b/test/shader_io/interpolate_input_struct.wgsl.expected.wgsl index b90c09b6c6..20a8106f93 100644 --- a/test/shader_io/interpolate_input_struct.wgsl.expected.wgsl +++ b/test/shader_io/interpolate_input_struct.wgsl.expected.wgsl @@ -15,7 +15,7 @@ struct In { linear_centroid : f32; [[location(7), interpolate(linear, sample)]] linear_sample : f32; -}; +} [[stage(fragment)]] fn main(in : In) { diff --git a/test/shader_io/interpolate_integers.wgsl.expected.wgsl b/test/shader_io/interpolate_integers.wgsl.expected.wgsl index 9b3eee2d5d..afabf7c151 100644 --- a/test/shader_io/interpolate_integers.wgsl.expected.wgsl +++ b/test/shader_io/interpolate_integers.wgsl.expected.wgsl @@ -9,7 +9,7 @@ struct Interface { vu : vec4; [[builtin(position)]] pos : vec4; -}; +} [[stage(vertex)]] fn vert_main() -> Interface { diff --git a/test/shader_io/interpolate_return_struct.wgsl.expected.wgsl b/test/shader_io/interpolate_return_struct.wgsl.expected.wgsl index fad2030640..bcf81777b6 100644 --- a/test/shader_io/interpolate_return_struct.wgsl.expected.wgsl +++ b/test/shader_io/interpolate_return_struct.wgsl.expected.wgsl @@ -17,7 +17,7 @@ struct Out { linear_centroid : f32; [[location(7), interpolate(linear, sample)]] linear_sample : f32; -}; +} [[stage(vertex)]] fn main() -> Out { diff --git a/test/shader_io/invariant_struct_member.wgsl.expected.wgsl b/test/shader_io/invariant_struct_member.wgsl.expected.wgsl index 03d919306a..503a0bae69 100644 --- a/test/shader_io/invariant_struct_member.wgsl.expected.wgsl +++ b/test/shader_io/invariant_struct_member.wgsl.expected.wgsl @@ -1,7 +1,7 @@ struct Out { [[builtin(position), invariant]] pos : vec4; -}; +} [[stage(vertex)]] fn main() -> Out { diff --git a/test/shader_io/shared_struct_different_stages.wgsl.expected.wgsl b/test/shader_io/shared_struct_different_stages.wgsl.expected.wgsl index 67a91d6a7a..343afdd089 100644 --- a/test/shader_io/shared_struct_different_stages.wgsl.expected.wgsl +++ b/test/shader_io/shared_struct_different_stages.wgsl.expected.wgsl @@ -5,7 +5,7 @@ struct Interface { col2 : f32; [[builtin(position)]] pos : vec4; -}; +} [[stage(vertex)]] fn vert_main() -> Interface { diff --git a/test/shader_io/shared_struct_helper_function.wgsl.expected.wgsl b/test/shader_io/shared_struct_helper_function.wgsl.expected.wgsl index c282cd65d4..034d5e1fdd 100644 --- a/test/shader_io/shared_struct_helper_function.wgsl.expected.wgsl +++ b/test/shader_io/shared_struct_helper_function.wgsl.expected.wgsl @@ -3,7 +3,7 @@ struct VertexOutput { pos : vec4; [[location(0), interpolate(flat)]] loc0 : i32; -}; +} fn foo(x : f32) -> VertexOutput { return VertexOutput(vec4(x, x, x, 1.0), 42); diff --git a/test/shader_io/shared_struct_storage_buffer.wgsl.expected.wgsl b/test/shader_io/shared_struct_storage_buffer.wgsl.expected.wgsl index 971ff7b0d0..787270414e 100644 --- a/test/shader_io/shared_struct_storage_buffer.wgsl.expected.wgsl +++ b/test/shader_io/shared_struct_storage_buffer.wgsl.expected.wgsl @@ -5,7 +5,7 @@ struct S { u : u32; [[align(128), builtin(position)]] v : vec4; -}; +} [[group(0), binding(0)]] var output : S; diff --git a/test/shader_io/vertex_input_builtins_struct.wgsl.expected.wgsl b/test/shader_io/vertex_input_builtins_struct.wgsl.expected.wgsl index f63100d2d3..7d885b4eab 100644 --- a/test/shader_io/vertex_input_builtins_struct.wgsl.expected.wgsl +++ b/test/shader_io/vertex_input_builtins_struct.wgsl.expected.wgsl @@ -3,7 +3,7 @@ struct VertexInputs { vertex_index : u32; [[builtin(instance_index)]] instance_index : u32; -}; +} [[stage(vertex)]] fn main(inputs : VertexInputs) -> [[builtin(position)]] vec4 { diff --git a/test/shader_io/vertex_input_locations_struct.wgsl.expected.wgsl b/test/shader_io/vertex_input_locations_struct.wgsl.expected.wgsl index 28d40aa242..7b7c1b0240 100644 --- a/test/shader_io/vertex_input_locations_struct.wgsl.expected.wgsl +++ b/test/shader_io/vertex_input_locations_struct.wgsl.expected.wgsl @@ -7,7 +7,7 @@ struct VertexInputs { loc2 : f32; [[location(3)]] loc3 : vec4; -}; +} [[stage(vertex)]] fn main(inputs : VertexInputs) -> [[builtin(position)]] vec4 { diff --git a/test/shader_io/vertex_input_mixed.wgsl.expected.wgsl b/test/shader_io/vertex_input_mixed.wgsl.expected.wgsl index 0cd61f69f7..81a6507b5e 100644 --- a/test/shader_io/vertex_input_mixed.wgsl.expected.wgsl +++ b/test/shader_io/vertex_input_mixed.wgsl.expected.wgsl @@ -3,14 +3,14 @@ struct VertexInputs0 { vertex_index : u32; [[location(0)]] loc0 : i32; -}; +} struct VertexInputs1 { [[location(2)]] loc2 : f32; [[location(3)]] loc3 : vec4; -}; +} [[stage(vertex)]] fn main(inputs0 : VertexInputs0, [[location(1)]] loc1 : u32, [[builtin(instance_index)]] instance_index : u32, inputs1 : VertexInputs1) -> [[builtin(position)]] vec4 { diff --git a/test/shader_io/vertex_output_builtins_struct.wgsl.expected.wgsl b/test/shader_io/vertex_output_builtins_struct.wgsl.expected.wgsl index 77d3b510dd..744325c302 100644 --- a/test/shader_io/vertex_output_builtins_struct.wgsl.expected.wgsl +++ b/test/shader_io/vertex_output_builtins_struct.wgsl.expected.wgsl @@ -1,7 +1,7 @@ struct VertexOutputs { [[builtin(position)]] position : vec4; -}; +} [[stage(vertex)]] fn main() -> VertexOutputs { diff --git a/test/shader_io/vertex_output_locations_struct.wgsl.expected.wgsl b/test/shader_io/vertex_output_locations_struct.wgsl.expected.wgsl index f1c6c7cc95..a3df42d165 100644 --- a/test/shader_io/vertex_output_locations_struct.wgsl.expected.wgsl +++ b/test/shader_io/vertex_output_locations_struct.wgsl.expected.wgsl @@ -9,7 +9,7 @@ struct VertexOutputs { loc3 : vec4; [[builtin(position)]] position : vec4; -}; +} [[stage(vertex)]] fn main() -> VertexOutputs { diff --git a/test/shadowing/function/var.wgsl.expected.wgsl b/test/shadowing/function/var.wgsl.expected.wgsl index feea3e6ce5..eff3fc5bcd 100644 --- a/test/shadowing/function/var.wgsl.expected.wgsl +++ b/test/shadowing/function/var.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct a { a : i32; -}; +} fn f() { { diff --git a/test/shadowing/struct/let.wgsl.expected.wgsl b/test/shadowing/struct/let.wgsl.expected.wgsl index 4425a838df..1c889fa8f2 100644 --- a/test/shadowing/struct/let.wgsl.expected.wgsl +++ b/test/shadowing/struct/let.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct a { a : i32; -}; +} fn f() { { diff --git a/test/shadowing/struct/param.wgsl.expected.wgsl b/test/shadowing/struct/param.wgsl.expected.wgsl index 2cb3206793..62184f1ca7 100644 --- a/test/shadowing/struct/param.wgsl.expected.wgsl +++ b/test/shadowing/struct/param.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct a { a : i32; -}; +} fn f(a : a) { let b = a; diff --git a/test/shadowing/struct/var.wgsl.expected.wgsl b/test/shadowing/struct/var.wgsl.expected.wgsl index feea3e6ce5..eff3fc5bcd 100644 --- a/test/shadowing/struct/var.wgsl.expected.wgsl +++ b/test/shadowing/struct/var.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct a { a : i32; -}; +} fn f() { { diff --git a/test/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_body.wgsl.expected.wgsl b/test/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_body.wgsl.expected.wgsl index a45995105d..f6394af993 100644 --- a/test/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_body.wgsl.expected.wgsl +++ b/test/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_body.wgsl.expected.wgsl @@ -1,14 +1,14 @@ struct Uniforms { i : u32; -}; +} struct InnerS { v : i32; -}; +} struct OuterS { a1 : array; -}; +} [[group(1), binding(4)]] var uniforms : Uniforms; diff --git a/test/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_continuing.wgsl.expected.wgsl b/test/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_continuing.wgsl.expected.wgsl index ac653ea519..85d01c6b90 100644 --- a/test/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_continuing.wgsl.expected.wgsl +++ b/test/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_continuing.wgsl.expected.wgsl @@ -1,14 +1,14 @@ struct Uniforms { i : u32; -}; +} struct InnerS { v : i32; -}; +} struct OuterS { a1 : array; -}; +} [[group(1), binding(4)]] var uniforms : Uniforms; diff --git a/test/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_init.wgsl.expected.wgsl b/test/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_init.wgsl.expected.wgsl index 5c08a50136..6d4ee1c6c6 100644 --- a/test/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_init.wgsl.expected.wgsl +++ b/test/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_init.wgsl.expected.wgsl @@ -1,14 +1,14 @@ struct Uniforms { i : u32; -}; +} struct InnerS { v : i32; -}; +} struct OuterS { a1 : array; -}; +} [[group(1), binding(4)]] var uniforms : Uniforms; diff --git a/test/statements/assign/indexed_assign_to_array_in_struct/indexing_with_side_effect_func.wgsl.expected.wgsl b/test/statements/assign/indexed_assign_to_array_in_struct/indexing_with_side_effect_func.wgsl.expected.wgsl index 06620e8b39..7ae55bed18 100644 --- a/test/statements/assign/indexed_assign_to_array_in_struct/indexing_with_side_effect_func.wgsl.expected.wgsl +++ b/test/statements/assign/indexed_assign_to_array_in_struct/indexing_with_side_effect_func.wgsl.expected.wgsl @@ -1,19 +1,19 @@ struct Uniforms { i : u32; j : u32; -}; +} struct InnerS { v : i32; -}; +} struct S1 { a2 : array; -}; +} struct OuterS { a1 : array; -}; +} var nextIndex : u32; diff --git a/test/statements/assign/indexed_assign_to_array_in_struct/struct_array.wgsl.expected.wgsl b/test/statements/assign/indexed_assign_to_array_in_struct/struct_array.wgsl.expected.wgsl index 9a967aa2db..22548cc706 100644 --- a/test/statements/assign/indexed_assign_to_array_in_struct/struct_array.wgsl.expected.wgsl +++ b/test/statements/assign/indexed_assign_to_array_in_struct/struct_array.wgsl.expected.wgsl @@ -1,14 +1,14 @@ struct Uniforms { i : u32; -}; +} struct InnerS { v : i32; -}; +} struct OuterS { a1 : array; -}; +} [[group(1), binding(4)]] var uniforms : Uniforms; diff --git a/test/statements/assign/indexed_assign_to_array_in_struct/struct_array_array.wgsl.expected.wgsl b/test/statements/assign/indexed_assign_to_array_in_struct/struct_array_array.wgsl.expected.wgsl index db81a61ee8..555cf5d579 100644 --- a/test/statements/assign/indexed_assign_to_array_in_struct/struct_array_array.wgsl.expected.wgsl +++ b/test/statements/assign/indexed_assign_to_array_in_struct/struct_array_array.wgsl.expected.wgsl @@ -1,15 +1,15 @@ struct Uniforms { i : u32; j : u32; -}; +} struct InnerS { v : i32; -}; +} struct OuterS { a1 : array, 8>; -}; +} [[group(1), binding(4)]] var uniforms : Uniforms; diff --git a/test/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct.wgsl.expected.wgsl b/test/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct.wgsl.expected.wgsl index d8a6c91823..cae1e5dffe 100644 --- a/test/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct.wgsl.expected.wgsl +++ b/test/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct.wgsl.expected.wgsl @@ -1,18 +1,18 @@ struct Uniforms { i : u32; -}; +} struct InnerS { v : i32; -}; +} struct S1 { s2 : InnerS; -}; +} struct OuterS { a1 : array; -}; +} [[group(1), binding(4)]] var uniforms : Uniforms; diff --git a/test/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct_array.wgsl.expected.wgsl b/test/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct_array.wgsl.expected.wgsl index 9efd02bf1f..6969d94663 100644 --- a/test/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct_array.wgsl.expected.wgsl +++ b/test/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct_array.wgsl.expected.wgsl @@ -1,19 +1,19 @@ struct Uniforms { i : u32; j : u32; -}; +} struct InnerS { v : i32; -}; +} struct S1 { a2 : array; -}; +} struct OuterS { a1 : array; -}; +} [[group(1), binding(4)]] var uniforms : Uniforms; diff --git a/test/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array.wgsl.expected.wgsl b/test/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array.wgsl.expected.wgsl index 4eae4791e9..c08a5f8c39 100644 --- a/test/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array.wgsl.expected.wgsl +++ b/test/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array.wgsl.expected.wgsl @@ -1,14 +1,14 @@ struct Uniforms { i : u32; -}; +} struct InnerS { v : i32; -}; +} struct OuterS { a1 : array; -}; +} [[group(1), binding(4)]] var uniforms : Uniforms; diff --git a/test/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array_struct_array.wgsl.expected.wgsl b/test/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array_struct_array.wgsl.expected.wgsl index a6925a9e3c..c53b90d03c 100644 --- a/test/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array_struct_array.wgsl.expected.wgsl +++ b/test/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array_struct_array.wgsl.expected.wgsl @@ -1,19 +1,19 @@ struct Uniforms { i : u32; j : u32; -}; +} struct InnerS { v : i32; -}; +} struct S1 { a2 : array; -}; +} struct OuterS { a1 : array; -}; +} [[group(1), binding(4)]] var uniforms : Uniforms; diff --git a/test/statements/assign/indexed_assign_to_array_in_struct/struct_matrix.wgsl.expected.wgsl b/test/statements/assign/indexed_assign_to_array_in_struct/struct_matrix.wgsl.expected.wgsl index 62a9bbbe27..aeb5f1b7ac 100644 --- a/test/statements/assign/indexed_assign_to_array_in_struct/struct_matrix.wgsl.expected.wgsl +++ b/test/statements/assign/indexed_assign_to_array_in_struct/struct_matrix.wgsl.expected.wgsl @@ -1,10 +1,10 @@ struct Uniforms { i : u32; -}; +} struct OuterS { m1 : mat2x4; -}; +} [[group(1), binding(4)]] var uniforms : Uniforms; diff --git a/test/statements/assign/indexed_assign_to_array_in_struct/struct_multiple_arrays.wgsl.expected.wgsl b/test/statements/assign/indexed_assign_to_array_in_struct/struct_multiple_arrays.wgsl.expected.wgsl index dcf15424f0..55091c5937 100644 --- a/test/statements/assign/indexed_assign_to_array_in_struct/struct_multiple_arrays.wgsl.expected.wgsl +++ b/test/statements/assign/indexed_assign_to_array_in_struct/struct_multiple_arrays.wgsl.expected.wgsl @@ -1,15 +1,15 @@ struct Uniforms { i : u32; -}; +} struct InnerS { v : i32; -}; +} struct OuterS { a1 : array; a2 : array; -}; +} [[group(1), binding(4)]] var uniforms : Uniforms; diff --git a/test/statements/assign/indexed_assign_to_array_in_struct/struct_struct_array.wgsl.expected.wgsl b/test/statements/assign/indexed_assign_to_array_in_struct/struct_struct_array.wgsl.expected.wgsl index daa4a124c8..f2ebffe956 100644 --- a/test/statements/assign/indexed_assign_to_array_in_struct/struct_struct_array.wgsl.expected.wgsl +++ b/test/statements/assign/indexed_assign_to_array_in_struct/struct_struct_array.wgsl.expected.wgsl @@ -1,18 +1,18 @@ struct Uniforms { i : u32; -}; +} struct InnerS { v : i32; -}; +} struct S1 { a : array; -}; +} struct OuterS { s2 : S1; -}; +} [[group(1), binding(4)]] var uniforms : Uniforms; diff --git a/test/statements/assign/indexed_assign_to_array_in_struct/struct_vector.wgsl.expected.wgsl b/test/statements/assign/indexed_assign_to_array_in_struct/struct_vector.wgsl.expected.wgsl index f478089ccd..da718cf198 100644 --- a/test/statements/assign/indexed_assign_to_array_in_struct/struct_vector.wgsl.expected.wgsl +++ b/test/statements/assign/indexed_assign_to_array_in_struct/struct_vector.wgsl.expected.wgsl @@ -1,10 +1,10 @@ struct Uniforms { i : u32; -}; +} struct OuterS { v1 : vec3; -}; +} [[group(1), binding(4)]] var uniforms : Uniforms; diff --git a/test/statements/assign/indexed_assign_to_array_in_struct/vector_assign.wgsl.expected.wgsl b/test/statements/assign/indexed_assign_to_array_in_struct/vector_assign.wgsl.expected.wgsl index 75951e57bb..928e38d693 100644 --- a/test/statements/assign/indexed_assign_to_array_in_struct/vector_assign.wgsl.expected.wgsl +++ b/test/statements/assign/indexed_assign_to_array_in_struct/vector_assign.wgsl.expected.wgsl @@ -1,10 +1,10 @@ struct Uniforms { i : u32; -}; +} struct OuterS { a1 : array; -}; +} [[group(1), binding(4)]] var uniforms : Uniforms; diff --git a/test/statements/assign/indexed_assign_to_array_in_struct/via_pointer.wgsl.expected.wgsl b/test/statements/assign/indexed_assign_to_array_in_struct/via_pointer.wgsl.expected.wgsl index 3752e4a2d3..f65b28530f 100644 --- a/test/statements/assign/indexed_assign_to_array_in_struct/via_pointer.wgsl.expected.wgsl +++ b/test/statements/assign/indexed_assign_to_array_in_struct/via_pointer.wgsl.expected.wgsl @@ -1,14 +1,14 @@ struct Uniforms { i : u32; -}; +} struct InnerS { v : i32; -}; +} struct OuterS { a1 : array; -}; +} [[group(1), binding(4)]] var uniforms : Uniforms; diff --git a/test/statements/assign/indexed_assign_to_array_in_struct/via_pointer_arg.wgsl.expected.wgsl b/test/statements/assign/indexed_assign_to_array_in_struct/via_pointer_arg.wgsl.expected.wgsl index 9a80febe0d..86b031af1c 100644 --- a/test/statements/assign/indexed_assign_to_array_in_struct/via_pointer_arg.wgsl.expected.wgsl +++ b/test/statements/assign/indexed_assign_to_array_in_struct/via_pointer_arg.wgsl.expected.wgsl @@ -1,14 +1,14 @@ struct Uniforms { i : u32; -}; +} struct InnerS { v : i32; -}; +} struct OuterS { a1 : array; -}; +} [[group(1), binding(4)]] var uniforms : Uniforms; diff --git a/test/statements/assign/phony/addr_of_non_constructable.wgsl.expected.wgsl b/test/statements/assign/phony/addr_of_non_constructable.wgsl.expected.wgsl index 6cd06e9840..0952e9dd5a 100644 --- a/test/statements/assign/phony/addr_of_non_constructable.wgsl.expected.wgsl +++ b/test/statements/assign/phony/addr_of_non_constructable.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct S { arr : array; -}; +} [[binding(0), group(0)]] var s : S; diff --git a/test/statements/assign/phony/addr_of_runtime_array.wgsl.expected.wgsl b/test/statements/assign/phony/addr_of_runtime_array.wgsl.expected.wgsl index 02446cd8c9..b6c74412f5 100644 --- a/test/statements/assign/phony/addr_of_runtime_array.wgsl.expected.wgsl +++ b/test/statements/assign/phony/addr_of_runtime_array.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct S { arr : array; -}; +} [[binding(0), group(0)]] var s : S; diff --git a/test/statements/assign/phony/storage_buffer.wgsl.expected.wgsl b/test/statements/assign/phony/storage_buffer.wgsl.expected.wgsl index 3a83d4dda2..c4caa99b03 100644 --- a/test/statements/assign/phony/storage_buffer.wgsl.expected.wgsl +++ b/test/statements/assign/phony/storage_buffer.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct S { i : i32; -}; +} [[binding(0), group(0)]] var s : S; diff --git a/test/statements/assign/phony/uniform_buffer.wgsl.expected.wgsl b/test/statements/assign/phony/uniform_buffer.wgsl.expected.wgsl index 7a04f48d4c..3ef1045311 100644 --- a/test/statements/assign/phony/uniform_buffer.wgsl.expected.wgsl +++ b/test/statements/assign/phony/uniform_buffer.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct S { i : i32; -}; +} [[binding(0), group(0)]] var u : S; diff --git a/test/statements/for/condition/struct_ctor.wgsl.expected.wgsl b/test/statements/for/condition/struct_ctor.wgsl.expected.wgsl index dd9b9c5ebd..45b0beaa92 100644 --- a/test/statements/for/condition/struct_ctor.wgsl.expected.wgsl +++ b/test/statements/for/condition/struct_ctor.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct S { i : i32; -}; +} fn f() { var i : i32; diff --git a/test/statements/for/continuing/struct_ctor.wgsl.expected.wgsl b/test/statements/for/continuing/struct_ctor.wgsl.expected.wgsl index 7baa234bd7..392153b816 100644 --- a/test/statements/for/continuing/struct_ctor.wgsl.expected.wgsl +++ b/test/statements/for/continuing/struct_ctor.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct S { i : i32; -}; +} fn f() { for(var i = 0; false; i = (i + S(1).i)) { diff --git a/test/statements/for/initializer/struct_ctor.wgsl.expected.wgsl b/test/statements/for/initializer/struct_ctor.wgsl.expected.wgsl index 312aad5957..eb6a570576 100644 --- a/test/statements/for/initializer/struct_ctor.wgsl.expected.wgsl +++ b/test/statements/for/initializer/struct_ctor.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct S { i : i32; -}; +} fn f() { for(var i : i32 = S(1).i; false; ) { diff --git a/test/struct/type_constructor.wgsl.expected.wgsl b/test/struct/type_constructor.wgsl.expected.wgsl index 572257638b..c526e3fbee 100644 --- a/test/struct/type_constructor.wgsl.expected.wgsl +++ b/test/struct/type_constructor.wgsl.expected.wgsl @@ -3,22 +3,22 @@ struct S1 { b : i32; c : i32; d : i32; -}; +} struct S2 { e : i32; f : S1; -}; +} struct S3 { g : i32; h : S1; i : S2; -}; +} struct T { a : array; -}; +} [[stage(compute), workgroup_size(1)]] fn main() { diff --git a/test/types/function_scope_declarations.wgsl.expected.wgsl b/test/types/function_scope_declarations.wgsl.expected.wgsl index 4f1194c115..3845786bef 100644 --- a/test/types/function_scope_declarations.wgsl.expected.wgsl +++ b/test/types/function_scope_declarations.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct S { a : f32; -}; +} [[stage(compute), workgroup_size(1)]] fn main() { diff --git a/test/types/module_scope_let.wgsl.expected.wgsl b/test/types/module_scope_let.wgsl.expected.wgsl index 7243c5cf46..be35814f29 100644 --- a/test/types/module_scope_let.wgsl.expected.wgsl +++ b/test/types/module_scope_let.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct S { a : f32; -}; +} let bool_let : bool = bool(); diff --git a/test/types/module_scope_var.wgsl.expected.wgsl b/test/types/module_scope_var.wgsl.expected.wgsl index 0b4bd735bb..55f4e0a9ef 100644 --- a/test/types/module_scope_var.wgsl.expected.wgsl +++ b/test/types/module_scope_var.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct S { a : f32; -}; +} var bool_var : bool; diff --git a/test/types/module_scope_var_initializers.wgsl.expected.wgsl b/test/types/module_scope_var_initializers.wgsl.expected.wgsl index fa0ef756f1..d9dcf61be2 100644 --- a/test/types/module_scope_var_initializers.wgsl.expected.wgsl +++ b/test/types/module_scope_var_initializers.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct S { a : f32; -}; +} var bool_var : bool = bool(); diff --git a/test/types/parameters.wgsl.expected.wgsl b/test/types/parameters.wgsl.expected.wgsl index 87bb564341..2720ce3034 100644 --- a/test/types/parameters.wgsl.expected.wgsl +++ b/test/types/parameters.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct S { a : f32; -}; +} fn foo(param_bool : bool, param_i32 : i32, param_u32 : u32, param_f32 : f32, param_v2i32 : vec2, param_v3u32 : vec3, param_v4f32 : vec4, param_m2x3 : mat2x3, param_arr : array, param_struct : S, param_ptr_f32 : ptr, param_ptr_vec : ptr>, param_ptr_arr : ptr>) { } diff --git a/test/types/return_types.wgsl.expected.wgsl b/test/types/return_types.wgsl.expected.wgsl index 517b684fd4..d34a0957e3 100644 --- a/test/types/return_types.wgsl.expected.wgsl +++ b/test/types/return_types.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct S { a : f32; -}; +} fn ret_bool() -> bool { return bool(); diff --git a/test/types/struct_members.wgsl.expected.wgsl b/test/types/struct_members.wgsl.expected.wgsl index 2bd0f3396c..7ff178c68e 100644 --- a/test/types/struct_members.wgsl.expected.wgsl +++ b/test/types/struct_members.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct S_inner { a : f32; -}; +} struct S { member_bool : bool; @@ -13,7 +13,7 @@ struct S { member_m2x3 : mat2x3; member_arr : array; member_struct : S_inner; -}; +} [[stage(compute), workgroup_size(1)]] fn main() { diff --git a/test/var/inferred/function.wgsl.expected.wgsl b/test/var/inferred/function.wgsl.expected.wgsl index 46141083e5..2c8b7ab666 100644 --- a/test/var/inferred/function.wgsl.expected.wgsl +++ b/test/var/inferred/function.wgsl.expected.wgsl @@ -1,6 +1,6 @@ struct MyStruct { f1 : f32; -}; +} type MyArray = array; diff --git a/test/var/initialization/function/struct.wgsl.expected.wgsl b/test/var/initialization/function/struct.wgsl.expected.wgsl index 57bf9a7aca..538187cc19 100644 --- a/test/var/initialization/function/struct.wgsl.expected.wgsl +++ b/test/var/initialization/function/struct.wgsl.expected.wgsl @@ -1,7 +1,7 @@ struct S { a : i32; b : f32; -}; +} [[stage(compute), workgroup_size(1)]] fn main() { diff --git a/test/var/initialization/private/struct.wgsl.expected.wgsl b/test/var/initialization/private/struct.wgsl.expected.wgsl index 3a0a381823..a91da6a3bb 100644 --- a/test/var/initialization/private/struct.wgsl.expected.wgsl +++ b/test/var/initialization/private/struct.wgsl.expected.wgsl @@ -1,7 +1,7 @@ struct S { a : i32; b : f32; -}; +} var v : S; diff --git a/test/var/initialization/workgroup/struct.wgsl.expected.wgsl b/test/var/initialization/workgroup/struct.wgsl.expected.wgsl index 7b2e10eb2e..b67e95aacf 100644 --- a/test/var/initialization/workgroup/struct.wgsl.expected.wgsl +++ b/test/var/initialization/workgroup/struct.wgsl.expected.wgsl @@ -1,7 +1,7 @@ struct S { a : i32; b : f32; -}; +} var v : S;