[wgsl-reader][wgsl-writer] Update struct decorations to new syntax.

This CL updates the parsing of struct decorations to require ()'s around
parameters.

Bug: tint:238
Change-Id: Ia35ca5c260c3c57b5fc95788bd1aef07f75edc39
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28600
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
This commit is contained in:
dan sinclair
2020-09-20 19:14:28 +00:00
committed by Commit Bot service account
parent d3f75ca0e8
commit 8b685866cd
13 changed files with 103 additions and 74 deletions

View File

@@ -42,22 +42,22 @@ entry_point fragment as "frag_main" = frag_main;
# compute shader
type Particle = [[block]] struct {
[[offset 0]] pos : vec2<f32>;
[[offset 8]] vel : vec2<f32>;
[[offset(0)]] pos : vec2<f32>;
[[offset(8)]] vel : vec2<f32>;
};
type SimParams = [[block]] struct {
[[offset 0]] deltaT : f32;
[[offset 4]] rule1Distance : f32;
[[offset 8]] rule2Distance : f32;
[[offset 12]] rule3Distance : f32;
[[offset 16]] rule1Scale : f32;
[[offset 20]] rule2Scale : f32;
[[offset 24]] rule3Scale : f32;
[[offset(0)]] deltaT : f32;
[[offset(4)]] rule1Distance : f32;
[[offset(8)]] rule2Distance : f32;
[[offset(12)]] rule3Distance : f32;
[[offset(16)]] rule1Scale : f32;
[[offset(20)]] rule2Scale : f32;
[[offset(24)]] rule3Scale : f32;
};
type Particles = [[block]] struct {
[[offset 0]] particles : [[stride 16]] array<Particle, 5>;
[[offset(0)]] particles : [[stride 16]] array<Particle, 5>;
};
[[binding 0, set 0]] var<uniform> params : SimParams;

View File

@@ -17,7 +17,7 @@ entry_point fragment = frag_main;
# Vertex shader
type Uniforms = [[block]] struct {
[[offset 0]] modelViewProjectionMatrix : mat4x4<f32>;
[[offset(0)]] modelViewProjectionMatrix : mat4x4<f32>;
};
[[binding 0, set 0]] var<uniform> uniforms : Uniforms;