Skip to content

Commit

Permalink
[wgsl-out] Uses commas to separate struct members instead of semicolons
Browse files Browse the repository at this point in the history
  • Loading branch information
Gordon-F authored and kvark committed Mar 13, 2022
1 parent 816fa34 commit b5761d9
Show file tree
Hide file tree
Showing 31 changed files with 127 additions and 127 deletions.
2 changes: 1 addition & 1 deletion src/back/wgsl/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ impl<W: Write> Writer<W> {
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)?;
}

Expand Down
4 changes: 2 additions & 2 deletions tests/out/wgsl/210-bevy-2d-shader-frag.wgsl
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
struct ColorMaterial_color {
Color: vec4<f32>;
Color: vec4<f32>,
};

struct FragmentOutput {
@location(0) o_Target: vec4<f32>;
@location(0) o_Target: vec4<f32>,
};

var<private> v_Uv_1: vec2<f32>;
Expand Down
10 changes: 5 additions & 5 deletions tests/out/wgsl/210-bevy-2d-shader-vert.wgsl
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
struct Camera {
ViewProj: mat4x4<f32>;
ViewProj: mat4x4<f32>,
};

struct Transform {
Model: mat4x4<f32>;
Model: mat4x4<f32>,
};

struct Sprite_size {
size: vec2<f32>;
size: vec2<f32>,
};

struct VertexOutput {
@location(0) v_Uv: vec2<f32>;
@builtin(position) member: vec4<f32>;
@location(0) v_Uv: vec2<f32>,
@builtin(position) member: vec4<f32>,
};

var<private> Vertex_Position_1: vec3<f32>;
Expand Down
12 changes: 6 additions & 6 deletions tests/out/wgsl/210-bevy-shader-vert.wgsl
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
struct Camera {
ViewProj: mat4x4<f32>;
ViewProj: mat4x4<f32>,
};

struct Transform {
Model: mat4x4<f32>;
Model: mat4x4<f32>,
};

struct VertexOutput {
@location(0) v_Position: vec3<f32>;
@location(1) v_Normal: vec3<f32>;
@location(2) v_Uv: vec2<f32>;
@builtin(position) member: vec4<f32>;
@location(0) v_Position: vec3<f32>,
@location(1) v_Normal: vec3<f32>,
@location(2) v_Uv: vec2<f32>,
@builtin(position) member: vec4<f32>,
};

var<private> Vertex_Position_1: vec3<f32>;
Expand Down
2 changes: 1 addition & 1 deletion tests/out/wgsl/246-collatz-comp.wgsl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
struct PrimeIndices {
indices: array<u32>;
indices: array<u32>,
};

@group(0) @binding(0)
Expand Down
8 changes: 4 additions & 4 deletions tests/out/wgsl/800-out-of-bounds-panic-vert.wgsl
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
struct Globals {
view_matrix: mat4x4<f32>;
view_matrix: mat4x4<f32>,
};

struct VertexPushConstants {
world_matrix: mat4x4<f32>;
world_matrix: mat4x4<f32>,
};

struct VertexOutput {
@location(0) frag_color: vec4<f32>;
@builtin(position) member: vec4<f32>;
@location(0) frag_color: vec4<f32>,
@builtin(position) member: vec4<f32>,
};

@group(0) @binding(0)
Expand Down
2 changes: 1 addition & 1 deletion tests/out/wgsl/896-push-constant-vert.wgsl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
struct PushConstants {
example: f32;
example: f32,
};

var<push_constant> c: PushConstants;
Expand Down
12 changes: 6 additions & 6 deletions tests/out/wgsl/access.wgsl
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
struct AlignedWrapper {
value: i32;
value: i32,
};

struct Bar {
matrix: mat4x4<f32>;
matrix_array: array<mat2x2<f32>,2>;
atom: atomic<i32>;
arr: array<vec2<u32>,2>;
data: array<AlignedWrapper>;
matrix: mat4x4<f32>,
matrix_array: array<mat2x2<f32>,2>,
atom: atomic<i32>,
arr: array<vec2<u32>,2>,
data: array<AlignedWrapper>,
};

@group(0) @binding(0)
Expand Down
34 changes: 17 additions & 17 deletions tests/out/wgsl/bevy-pbr-frag.wgsl
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
struct PointLight {
pos: vec4<f32>;
color: vec4<f32>;
lightParams: vec4<f32>;
pos: vec4<f32>,
color: vec4<f32>,
lightParams: vec4<f32>,
};

struct DirectionalLight {
direction: vec4<f32>;
color: vec4<f32>;
direction: vec4<f32>,
color: vec4<f32>,
};

struct CameraViewProj {
ViewProj: mat4x4<f32>;
ViewProj: mat4x4<f32>,
};

struct CameraPosition {
CameraPos: vec4<f32>;
CameraPos: vec4<f32>,
};

struct Lights {
AmbientColor: vec4<f32>;
NumLights: vec4<u32>;
PointLights: array<PointLight,10u>;
DirectionalLights: array<DirectionalLight,1u>;
AmbientColor: vec4<f32>,
NumLights: vec4<u32>,
PointLights: array<PointLight,10u>,
DirectionalLights: array<DirectionalLight,1u>,
};

struct StandardMaterial_base_color {
base_color: vec4<f32>;
base_color: vec4<f32>,
};

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<f32>;
emissive: vec4<f32>,
};

struct FragmentOutput {
@location(0) o_Target: vec4<f32>;
@location(0) o_Target: vec4<f32>,
};

var<private> v_WorldPosition_1: vec3<f32>;
Expand Down
14 changes: 7 additions & 7 deletions tests/out/wgsl/bevy-pbr-vert.wgsl
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
struct CameraViewProj {
ViewProj: mat4x4<f32>;
ViewProj: mat4x4<f32>,
};

struct Transform {
Model: mat4x4<f32>;
Model: mat4x4<f32>,
};

struct VertexOutput {
@location(0) v_WorldPosition: vec3<f32>;
@location(1) v_WorldNormal: vec3<f32>;
@location(2) v_Uv: vec2<f32>;
@location(3) v_WorldTangent: vec4<f32>;
@builtin(position) member: vec4<f32>;
@location(0) v_WorldPosition: vec3<f32>,
@location(1) v_WorldNormal: vec3<f32>,
@location(2) v_Uv: vec2<f32>,
@location(3) v_WorldTangent: vec4<f32>,
@builtin(position) member: vec4<f32>,
};

var<private> Vertex_Position_1: vec3<f32>;
Expand Down
20 changes: 10 additions & 10 deletions tests/out/wgsl/boids.wgsl
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
struct Particle {
pos: vec2<f32>;
vel: vec2<f32>;
pos: vec2<f32>,
vel: vec2<f32>,
};

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<Particle>;
particles: array<Particle>,
};

let NUM_PARTICLES: u32 = 1500u;
Expand Down
2 changes: 1 addition & 1 deletion tests/out/wgsl/bool-select-frag.wgsl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
struct FragmentOutput {
@location(0) o_color: vec4<f32>;
@location(0) o_color: vec4<f32>,
};

var<private> o_color: vec4<f32>;
Expand Down
2 changes: 1 addition & 1 deletion tests/out/wgsl/clamp-splat-vert.wgsl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
struct VertexOutput {
@builtin(position) member: vec4<f32>;
@builtin(position) member: vec4<f32>,
};

var<private> a_pos_1: vec2<f32>;
Expand Down
2 changes: 1 addition & 1 deletion tests/out/wgsl/collatz.wgsl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
struct PrimeIndices {
data: array<u32>;
data: array<u32>,
};

@group(0) @binding(0)
Expand Down
2 changes: 1 addition & 1 deletion tests/out/wgsl/constant-array-size-vert.wgsl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
struct Data {
vecs: array<vec4<f32>,42u>;
vecs: array<vec4<f32>,42u>,
};

@group(1) @binding(0)
Expand Down
20 changes: 10 additions & 10 deletions tests/out/wgsl/declarations-vert.wgsl
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
struct VertexData {
position: vec2<f32>;
a: vec2<f32>;
position: vec2<f32>,
a: vec2<f32>,
};

struct FragmentData {
position: vec2<f32>;
a: vec2<f32>;
position: vec2<f32>,
a: vec2<f32>,
};

struct TestStruct {
a: f32;
b: f32;
a: f32,
b: f32,
};

struct VertexOutput {
@location(0) position: vec2<f32>;
@location(1) a: vec2<f32>;
@location(2) out_array: vec4<f32>;
@location(3) out_array_1: vec4<f32>;
@location(0) position: vec2<f32>,
@location(1) a: vec2<f32>,
@location(2) out_array: vec4<f32>,
@location(3) out_array_1: vec4<f32>,
};

var<private> vert: VertexData;
Expand Down
2 changes: 1 addition & 1 deletion tests/out/wgsl/empty-global-name.wgsl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
struct type_1 {
member: i32;
member: i32,
};

@group(0) @binding(0)
Expand Down
4 changes: 2 additions & 2 deletions tests/out/wgsl/expressions-frag.wgsl
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
struct BST {
data: i32;
data: i32,
};

struct FragmentOutput {
@location(0) o_color: vec4<f32>;
@location(0) o_color: vec4<f32>,
};

var<private> global: f32;
Expand Down
8 changes: 4 additions & 4 deletions tests/out/wgsl/extra.wgsl
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
struct PushConstants {
index: u32;
double: vec2<f32>;
index: u32,
double: vec2<f32>,
};

struct FragmentIn {
@location(0) color: vec4<f32>;
@builtin(primitive_index) primitive_index: u32;
@location(0) color: vec4<f32>,
@builtin(primitive_index) primitive_index: u32,
};

var<push_constant> pc: PushConstants;
Expand Down
8 changes: 4 additions & 4 deletions tests/out/wgsl/fma-frag.wgsl
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
struct Mat4x3_ {
mx: vec4<f32>;
my: vec4<f32>;
mz: vec4<f32>;
mx: vec4<f32>,
my: vec4<f32>,
mz: vec4<f32>,
};

struct FragmentOutput {
@location(0) o_color: vec4<f32>;
@location(0) o_color: vec4<f32>,
};

var<private> o_color: vec4<f32>;
Expand Down
4 changes: 2 additions & 2 deletions tests/out/wgsl/globals.wgsl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
struct Foo {
v3_: vec3<f32>;
v1_: f32;
v3_: vec3<f32>,
v1_: f32,
};

let Foo_2: bool = true;
Expand Down
14 changes: 7 additions & 7 deletions tests/out/wgsl/interface.wgsl
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
struct VertexOutput {
@builtin(position) position: vec4<f32>;
@location(1) varying: f32;
@builtin(position) position: vec4<f32>,
@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<workgroup> output: array<u32,1>;
Expand Down
Loading

0 comments on commit b5761d9

Please sign in to comment.