From b5761d96113129ae6ddf82c8d6aa8050abc66b39 Mon Sep 17 00:00:00 2001 From: Igor Shaposhnik Date: Sun, 13 Mar 2022 00:51:08 +0300 Subject: [PATCH] [wgsl-out] Uses commas to separate struct members instead of semicolons --- src/back/wgsl/writer.rs | 2 +- tests/out/wgsl/210-bevy-2d-shader-frag.wgsl | 4 +-- tests/out/wgsl/210-bevy-2d-shader-vert.wgsl | 10 +++--- tests/out/wgsl/210-bevy-shader-vert.wgsl | 12 +++---- tests/out/wgsl/246-collatz-comp.wgsl | 2 +- .../wgsl/800-out-of-bounds-panic-vert.wgsl | 8 ++--- tests/out/wgsl/896-push-constant-vert.wgsl | 2 +- tests/out/wgsl/access.wgsl | 12 +++---- tests/out/wgsl/bevy-pbr-frag.wgsl | 34 +++++++++---------- tests/out/wgsl/bevy-pbr-vert.wgsl | 14 ++++---- tests/out/wgsl/boids.wgsl | 20 +++++------ tests/out/wgsl/bool-select-frag.wgsl | 2 +- tests/out/wgsl/clamp-splat-vert.wgsl | 2 +- tests/out/wgsl/collatz.wgsl | 2 +- tests/out/wgsl/constant-array-size-vert.wgsl | 2 +- tests/out/wgsl/declarations-vert.wgsl | 20 +++++------ tests/out/wgsl/empty-global-name.wgsl | 2 +- tests/out/wgsl/expressions-frag.wgsl | 4 +-- tests/out/wgsl/extra.wgsl | 8 ++--- tests/out/wgsl/fma-frag.wgsl | 8 ++--- tests/out/wgsl/globals.wgsl | 4 +-- tests/out/wgsl/interface.wgsl | 14 ++++---- tests/out/wgsl/interpolate.wgsl | 16 ++++----- tests/out/wgsl/operators.wgsl | 4 +-- tests/out/wgsl/pointers.wgsl | 2 +- tests/out/wgsl/quad-vert.wgsl | 6 ++-- tests/out/wgsl/quad.wgsl | 4 +-- tests/out/wgsl/quad_glsl-frag.wgsl | 2 +- tests/out/wgsl/quad_glsl-vert.wgsl | 4 +-- tests/out/wgsl/shadow.wgsl | 20 +++++------ tests/out/wgsl/skybox.wgsl | 8 ++--- 31 files changed, 127 insertions(+), 127 deletions(-) diff --git a/src/back/wgsl/writer.rs b/src/back/wgsl/writer.rs index 2d4b0150bf..9315e63757 100644 --- a/src/back/wgsl/writer.rs +++ b/src/back/wgsl/writer.rs @@ -419,7 +419,7 @@ impl Writer { let member_name = &self.names[&NameKey::StructMember(handle, index as u32)]; write!(self.out, "{}: ", member_name)?; self.write_type(module, member.ty)?; - write!(self.out, ";")?; + write!(self.out, ",")?; writeln!(self.out)?; } diff --git a/tests/out/wgsl/210-bevy-2d-shader-frag.wgsl b/tests/out/wgsl/210-bevy-2d-shader-frag.wgsl index cfb3ce6ce0..3c7aaf1d14 100644 --- a/tests/out/wgsl/210-bevy-2d-shader-frag.wgsl +++ b/tests/out/wgsl/210-bevy-2d-shader-frag.wgsl @@ -1,9 +1,9 @@ struct ColorMaterial_color { - Color: vec4; + Color: vec4, }; struct FragmentOutput { - @location(0) o_Target: vec4; + @location(0) o_Target: vec4, }; var v_Uv_1: vec2; diff --git a/tests/out/wgsl/210-bevy-2d-shader-vert.wgsl b/tests/out/wgsl/210-bevy-2d-shader-vert.wgsl index 18a6630f8d..b6e70957cb 100644 --- a/tests/out/wgsl/210-bevy-2d-shader-vert.wgsl +++ b/tests/out/wgsl/210-bevy-2d-shader-vert.wgsl @@ -1,18 +1,18 @@ struct Camera { - ViewProj: mat4x4; + ViewProj: mat4x4, }; struct Transform { - Model: mat4x4; + Model: mat4x4, }; struct Sprite_size { - size: vec2; + size: vec2, }; struct VertexOutput { - @location(0) v_Uv: vec2; - @builtin(position) member: vec4; + @location(0) v_Uv: vec2, + @builtin(position) member: vec4, }; var Vertex_Position_1: vec3; diff --git a/tests/out/wgsl/210-bevy-shader-vert.wgsl b/tests/out/wgsl/210-bevy-shader-vert.wgsl index a2ac6ba10c..d7a177cb3c 100644 --- a/tests/out/wgsl/210-bevy-shader-vert.wgsl +++ b/tests/out/wgsl/210-bevy-shader-vert.wgsl @@ -1,16 +1,16 @@ struct Camera { - ViewProj: mat4x4; + ViewProj: mat4x4, }; struct Transform { - Model: mat4x4; + Model: mat4x4, }; struct VertexOutput { - @location(0) v_Position: vec3; - @location(1) v_Normal: vec3; - @location(2) v_Uv: vec2; - @builtin(position) member: vec4; + @location(0) v_Position: vec3, + @location(1) v_Normal: vec3, + @location(2) v_Uv: vec2, + @builtin(position) member: vec4, }; var Vertex_Position_1: vec3; diff --git a/tests/out/wgsl/246-collatz-comp.wgsl b/tests/out/wgsl/246-collatz-comp.wgsl index a990dd31ba..994c028d12 100644 --- a/tests/out/wgsl/246-collatz-comp.wgsl +++ b/tests/out/wgsl/246-collatz-comp.wgsl @@ -1,5 +1,5 @@ struct PrimeIndices { - indices: array; + indices: array, }; @group(0) @binding(0) diff --git a/tests/out/wgsl/800-out-of-bounds-panic-vert.wgsl b/tests/out/wgsl/800-out-of-bounds-panic-vert.wgsl index b57fa3e0b4..a3aca90828 100644 --- a/tests/out/wgsl/800-out-of-bounds-panic-vert.wgsl +++ b/tests/out/wgsl/800-out-of-bounds-panic-vert.wgsl @@ -1,14 +1,14 @@ struct Globals { - view_matrix: mat4x4; + view_matrix: mat4x4, }; struct VertexPushConstants { - world_matrix: mat4x4; + world_matrix: mat4x4, }; struct VertexOutput { - @location(0) frag_color: vec4; - @builtin(position) member: vec4; + @location(0) frag_color: vec4, + @builtin(position) member: vec4, }; @group(0) @binding(0) diff --git a/tests/out/wgsl/896-push-constant-vert.wgsl b/tests/out/wgsl/896-push-constant-vert.wgsl index f7f2dcfb31..89e7cee2be 100644 --- a/tests/out/wgsl/896-push-constant-vert.wgsl +++ b/tests/out/wgsl/896-push-constant-vert.wgsl @@ -1,5 +1,5 @@ struct PushConstants { - example: f32; + example: f32, }; var c: PushConstants; diff --git a/tests/out/wgsl/access.wgsl b/tests/out/wgsl/access.wgsl index 1080002efc..cab0428e9d 100644 --- a/tests/out/wgsl/access.wgsl +++ b/tests/out/wgsl/access.wgsl @@ -1,13 +1,13 @@ struct AlignedWrapper { - value: i32; + value: i32, }; struct Bar { - matrix: mat4x4; - matrix_array: array,2>; - atom: atomic; - arr: array,2>; - data: array; + matrix: mat4x4, + matrix_array: array,2>, + atom: atomic, + arr: array,2>, + data: array, }; @group(0) @binding(0) diff --git a/tests/out/wgsl/bevy-pbr-frag.wgsl b/tests/out/wgsl/bevy-pbr-frag.wgsl index bf12b515da..d8ef7b2dd0 100644 --- a/tests/out/wgsl/bevy-pbr-frag.wgsl +++ b/tests/out/wgsl/bevy-pbr-frag.wgsl @@ -1,51 +1,51 @@ struct PointLight { - pos: vec4; - color: vec4; - lightParams: vec4; + pos: vec4, + color: vec4, + lightParams: vec4, }; struct DirectionalLight { - direction: vec4; - color: vec4; + direction: vec4, + color: vec4, }; struct CameraViewProj { - ViewProj: mat4x4; + ViewProj: mat4x4, }; struct CameraPosition { - CameraPos: vec4; + CameraPos: vec4, }; struct Lights { - AmbientColor: vec4; - NumLights: vec4; - PointLights: array; - DirectionalLights: array; + AmbientColor: vec4, + NumLights: vec4, + PointLights: array, + DirectionalLights: array, }; struct StandardMaterial_base_color { - base_color: vec4; + base_color: vec4, }; struct StandardMaterial_roughness { - perceptual_roughness: f32; + perceptual_roughness: f32, }; struct StandardMaterial_metallic { - metallic: f32; + metallic: f32, }; struct StandardMaterial_reflectance { - reflectance: f32; + reflectance: f32, }; struct StandardMaterial_emissive { - emissive: vec4; + emissive: vec4, }; struct FragmentOutput { - @location(0) o_Target: vec4; + @location(0) o_Target: vec4, }; var v_WorldPosition_1: vec3; diff --git a/tests/out/wgsl/bevy-pbr-vert.wgsl b/tests/out/wgsl/bevy-pbr-vert.wgsl index 617537fad5..13c7cb9358 100644 --- a/tests/out/wgsl/bevy-pbr-vert.wgsl +++ b/tests/out/wgsl/bevy-pbr-vert.wgsl @@ -1,17 +1,17 @@ struct CameraViewProj { - ViewProj: mat4x4; + ViewProj: mat4x4, }; struct Transform { - Model: mat4x4; + Model: mat4x4, }; struct VertexOutput { - @location(0) v_WorldPosition: vec3; - @location(1) v_WorldNormal: vec3; - @location(2) v_Uv: vec2; - @location(3) v_WorldTangent: vec4; - @builtin(position) member: vec4; + @location(0) v_WorldPosition: vec3, + @location(1) v_WorldNormal: vec3, + @location(2) v_Uv: vec2, + @location(3) v_WorldTangent: vec4, + @builtin(position) member: vec4, }; var Vertex_Position_1: vec3; diff --git a/tests/out/wgsl/boids.wgsl b/tests/out/wgsl/boids.wgsl index 1910535abc..bc908aa675 100644 --- a/tests/out/wgsl/boids.wgsl +++ b/tests/out/wgsl/boids.wgsl @@ -1,20 +1,20 @@ struct Particle { - pos: vec2; - vel: vec2; + pos: vec2, + vel: vec2, }; struct SimParams { - deltaT: f32; - rule1Distance: f32; - rule2Distance: f32; - rule3Distance: f32; - rule1Scale: f32; - rule2Scale: f32; - rule3Scale: f32; + deltaT: f32, + rule1Distance: f32, + rule2Distance: f32, + rule3Distance: f32, + rule1Scale: f32, + rule2Scale: f32, + rule3Scale: f32, }; struct Particles { - particles: array; + particles: array, }; let NUM_PARTICLES: u32 = 1500u; diff --git a/tests/out/wgsl/bool-select-frag.wgsl b/tests/out/wgsl/bool-select-frag.wgsl index c1d5502cf1..f44a4416e8 100644 --- a/tests/out/wgsl/bool-select-frag.wgsl +++ b/tests/out/wgsl/bool-select-frag.wgsl @@ -1,5 +1,5 @@ struct FragmentOutput { - @location(0) o_color: vec4; + @location(0) o_color: vec4, }; var o_color: vec4; diff --git a/tests/out/wgsl/clamp-splat-vert.wgsl b/tests/out/wgsl/clamp-splat-vert.wgsl index 953ea71ccd..fd0b8eaf6d 100644 --- a/tests/out/wgsl/clamp-splat-vert.wgsl +++ b/tests/out/wgsl/clamp-splat-vert.wgsl @@ -1,5 +1,5 @@ struct VertexOutput { - @builtin(position) member: vec4; + @builtin(position) member: vec4, }; var a_pos_1: vec2; diff --git a/tests/out/wgsl/collatz.wgsl b/tests/out/wgsl/collatz.wgsl index 334a779e6f..37e530c0ce 100644 --- a/tests/out/wgsl/collatz.wgsl +++ b/tests/out/wgsl/collatz.wgsl @@ -1,5 +1,5 @@ struct PrimeIndices { - data: array; + data: array, }; @group(0) @binding(0) diff --git a/tests/out/wgsl/constant-array-size-vert.wgsl b/tests/out/wgsl/constant-array-size-vert.wgsl index f0d5474a20..bf4830dc9e 100644 --- a/tests/out/wgsl/constant-array-size-vert.wgsl +++ b/tests/out/wgsl/constant-array-size-vert.wgsl @@ -1,5 +1,5 @@ struct Data { - vecs: array,42u>; + vecs: array,42u>, }; @group(1) @binding(0) diff --git a/tests/out/wgsl/declarations-vert.wgsl b/tests/out/wgsl/declarations-vert.wgsl index cc5d9c932e..ba1cdd58d6 100644 --- a/tests/out/wgsl/declarations-vert.wgsl +++ b/tests/out/wgsl/declarations-vert.wgsl @@ -1,23 +1,23 @@ struct VertexData { - position: vec2; - a: vec2; + position: vec2, + a: vec2, }; struct FragmentData { - position: vec2; - a: vec2; + position: vec2, + a: vec2, }; struct TestStruct { - a: f32; - b: f32; + a: f32, + b: f32, }; struct VertexOutput { - @location(0) position: vec2; - @location(1) a: vec2; - @location(2) out_array: vec4; - @location(3) out_array_1: vec4; + @location(0) position: vec2, + @location(1) a: vec2, + @location(2) out_array: vec4, + @location(3) out_array_1: vec4, }; var vert: VertexData; diff --git a/tests/out/wgsl/empty-global-name.wgsl b/tests/out/wgsl/empty-global-name.wgsl index 1baaf03e29..81334fc8f6 100644 --- a/tests/out/wgsl/empty-global-name.wgsl +++ b/tests/out/wgsl/empty-global-name.wgsl @@ -1,5 +1,5 @@ struct type_1 { - member: i32; + member: i32, }; @group(0) @binding(0) diff --git a/tests/out/wgsl/expressions-frag.wgsl b/tests/out/wgsl/expressions-frag.wgsl index 434d24b6a1..f487aae834 100644 --- a/tests/out/wgsl/expressions-frag.wgsl +++ b/tests/out/wgsl/expressions-frag.wgsl @@ -1,9 +1,9 @@ struct BST { - data: i32; + data: i32, }; struct FragmentOutput { - @location(0) o_color: vec4; + @location(0) o_color: vec4, }; var global: f32; diff --git a/tests/out/wgsl/extra.wgsl b/tests/out/wgsl/extra.wgsl index e1aaa9c018..98b6bc883b 100644 --- a/tests/out/wgsl/extra.wgsl +++ b/tests/out/wgsl/extra.wgsl @@ -1,11 +1,11 @@ struct PushConstants { - index: u32; - double: vec2; + index: u32, + double: vec2, }; struct FragmentIn { - @location(0) color: vec4; - @builtin(primitive_index) primitive_index: u32; + @location(0) color: vec4, + @builtin(primitive_index) primitive_index: u32, }; var pc: PushConstants; diff --git a/tests/out/wgsl/fma-frag.wgsl b/tests/out/wgsl/fma-frag.wgsl index 8bd6686745..3d094d41ce 100644 --- a/tests/out/wgsl/fma-frag.wgsl +++ b/tests/out/wgsl/fma-frag.wgsl @@ -1,11 +1,11 @@ struct Mat4x3_ { - mx: vec4; - my: vec4; - mz: vec4; + mx: vec4, + my: vec4, + mz: vec4, }; struct FragmentOutput { - @location(0) o_color: vec4; + @location(0) o_color: vec4, }; var o_color: vec4; diff --git a/tests/out/wgsl/globals.wgsl b/tests/out/wgsl/globals.wgsl index d1ab5cbf11..4d60fe89b4 100644 --- a/tests/out/wgsl/globals.wgsl +++ b/tests/out/wgsl/globals.wgsl @@ -1,6 +1,6 @@ struct Foo { - v3_: vec3; - v1_: f32; + v3_: vec3, + v1_: f32, }; let Foo_2: bool = true; diff --git a/tests/out/wgsl/interface.wgsl b/tests/out/wgsl/interface.wgsl index ad24717f36..9da63f6318 100644 --- a/tests/out/wgsl/interface.wgsl +++ b/tests/out/wgsl/interface.wgsl @@ -1,20 +1,20 @@ struct VertexOutput { - @builtin(position) position: vec4; - @location(1) varying: f32; + @builtin(position) position: vec4, + @location(1) varying: f32, }; struct FragmentOutput { - @builtin(frag_depth) depth: f32; - @builtin(sample_mask) sample_mask: u32; - @location(0) color: f32; + @builtin(frag_depth) depth: f32, + @builtin(sample_mask) sample_mask: u32, + @location(0) color: f32, }; struct Input1_ { - @builtin(vertex_index) index: u32; + @builtin(vertex_index) index: u32, }; struct Input2_ { - @builtin(instance_index) index: u32; + @builtin(instance_index) index: u32, }; var output: array; diff --git a/tests/out/wgsl/interpolate.wgsl b/tests/out/wgsl/interpolate.wgsl index 69ccd9630b..a74b65741f 100644 --- a/tests/out/wgsl/interpolate.wgsl +++ b/tests/out/wgsl/interpolate.wgsl @@ -1,12 +1,12 @@ struct FragmentInput { - @builtin(position) position: vec4; - @location(0) flat: u32; - @location(1) @interpolate(linear) linear: f32; - @location(2) @interpolate(linear, centroid) linear_centroid: vec2; - @location(3) @interpolate(linear, sample) linear_sample: vec3; - @location(4) perspective: vec4; - @location(5) @interpolate(perspective, centroid) perspective_centroid: f32; - @location(6) @interpolate(perspective, sample) perspective_sample: f32; + @builtin(position) position: vec4, + @location(0) flat: u32, + @location(1) @interpolate(linear) linear: f32, + @location(2) @interpolate(linear, centroid) linear_centroid: vec2, + @location(3) @interpolate(linear, sample) linear_sample: vec3, + @location(4) perspective: vec4, + @location(5) @interpolate(perspective, centroid) perspective_centroid: f32, + @location(6) @interpolate(perspective, sample) perspective_sample: f32, }; @stage(vertex) diff --git a/tests/out/wgsl/operators.wgsl b/tests/out/wgsl/operators.wgsl index eac31fec00..5beefb4d4d 100644 --- a/tests/out/wgsl/operators.wgsl +++ b/tests/out/wgsl/operators.wgsl @@ -1,6 +1,6 @@ struct Foo { - a: vec4; - b: i32; + a: vec4, + b: i32, }; let v_f32_one: vec4 = vec4(1.0, 1.0, 1.0, 1.0); diff --git a/tests/out/wgsl/pointers.wgsl b/tests/out/wgsl/pointers.wgsl index e06ecb0b15..035e05292d 100644 --- a/tests/out/wgsl/pointers.wgsl +++ b/tests/out/wgsl/pointers.wgsl @@ -1,5 +1,5 @@ struct DynamicArray { - arr: array; + arr: array, }; @group(0) @binding(0) diff --git a/tests/out/wgsl/quad-vert.wgsl b/tests/out/wgsl/quad-vert.wgsl index eaec429139..7f598d03f1 100644 --- a/tests/out/wgsl/quad-vert.wgsl +++ b/tests/out/wgsl/quad-vert.wgsl @@ -1,10 +1,10 @@ struct gl_PerVertex { - @builtin(position) gl_Position: vec4; + @builtin(position) gl_Position: vec4, }; struct VertexOutput { - @location(0) member: vec2; - @builtin(position) gl_Position: vec4; + @location(0) member: vec2, + @builtin(position) gl_Position: vec4, }; var v_uv: vec2; diff --git a/tests/out/wgsl/quad.wgsl b/tests/out/wgsl/quad.wgsl index 641f2fd289..01c21bf157 100644 --- a/tests/out/wgsl/quad.wgsl +++ b/tests/out/wgsl/quad.wgsl @@ -1,6 +1,6 @@ struct VertexOutput { - @location(0) uv: vec2; - @builtin(position) position: vec4; + @location(0) uv: vec2, + @builtin(position) position: vec4, }; let c_scale: f32 = 1.2000000476837158; diff --git a/tests/out/wgsl/quad_glsl-frag.wgsl b/tests/out/wgsl/quad_glsl-frag.wgsl index 74276c9d62..49dbe92423 100644 --- a/tests/out/wgsl/quad_glsl-frag.wgsl +++ b/tests/out/wgsl/quad_glsl-frag.wgsl @@ -1,5 +1,5 @@ struct FragmentOutput { - @location(0) o_color: vec4; + @location(0) o_color: vec4, }; var v_uv_1: vec2; diff --git a/tests/out/wgsl/quad_glsl-vert.wgsl b/tests/out/wgsl/quad_glsl-vert.wgsl index 470286a3ca..a029b3d434 100644 --- a/tests/out/wgsl/quad_glsl-vert.wgsl +++ b/tests/out/wgsl/quad_glsl-vert.wgsl @@ -1,6 +1,6 @@ struct VertexOutput { - @location(0) v_uv: vec2; - @builtin(position) member: vec4; + @location(0) v_uv: vec2, + @builtin(position) member: vec4, }; var a_pos_1: vec2; diff --git a/tests/out/wgsl/shadow.wgsl b/tests/out/wgsl/shadow.wgsl index a5dbb554ef..41fc7eba2d 100644 --- a/tests/out/wgsl/shadow.wgsl +++ b/tests/out/wgsl/shadow.wgsl @@ -1,23 +1,23 @@ struct Globals { - view_proj: mat4x4; - num_lights: vec4; + view_proj: mat4x4, + num_lights: vec4, }; struct Entity { - world: mat4x4; - color: vec4; + world: mat4x4, + color: vec4, }; struct VertexOutput { - @builtin(position) proj_position: vec4; - @location(0) world_normal: vec3; - @location(1) world_position: vec4; + @builtin(position) proj_position: vec4, + @location(0) world_normal: vec3, + @location(1) world_position: vec4, }; struct Light { - proj: mat4x4; - pos: vec4; - color: vec4; + proj: mat4x4, + pos: vec4, + color: vec4, }; let c_ambient: vec3 = vec3(0.05000000074505806, 0.05000000074505806, 0.05000000074505806); diff --git a/tests/out/wgsl/skybox.wgsl b/tests/out/wgsl/skybox.wgsl index 93b5f06e58..32c2c52d25 100644 --- a/tests/out/wgsl/skybox.wgsl +++ b/tests/out/wgsl/skybox.wgsl @@ -1,11 +1,11 @@ struct VertexOutput { - @builtin(position) position: vec4; - @location(0) uv: vec3; + @builtin(position) position: vec4, + @location(0) uv: vec3, }; struct Data { - proj_inv: mat4x4; - view: mat4x4; + proj_inv: mat4x4, + view: mat4x4, }; @group(0) @binding(0)