Skip to content

Commit

Permalink
chore: re-order bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
CodyJasonBennett committed Mar 31, 2023
1 parent e9c829a commit 8ff0eba
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 22 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ const material = new Material({
projectionMatrix: mat4x4<f32>,
modelViewMatrix: mat4x4<f32>,
};
@binding(0) @group(0) var<uniform> uniforms: Uniforms;
@group(0) @binding(0) var<uniform> uniforms: Uniforms;
@vertex
fn main(@location(0) position: vec3<f32>) -> @builtin(position) vec4<f32> {
Expand Down Expand Up @@ -427,7 +427,7 @@ const material = new Material({
projectionMatrix: mat4x4<f32>,
modelViewMatrix: mat4x4<f32>,
};
@binding(0) @group(0) var<uniform> uniforms: Uniforms;
@group(0) @binding(0) var<uniform> uniforms: Uniforms;
@vertex
fn main(@location(0) position: vec3<f32>) -> @builtin(position) vec4<f32> {
Expand Down Expand Up @@ -472,14 +472,14 @@ var<storage, read_write> data: array<vec2<f32>>;
struct Uniforms {
time: f32,
};
@binding(1) @group(0) var<uniform> uniforms: Uniforms;
@group(0) @binding(1) var<uniform> uniforms: Uniforms;
// Texture bindings
@binding(2) @group(0) var sample: sampler;
@binding(3) @group(0) var color: texture_2d<f32>;
@group(0) @binding(2) var sample: sampler;
@group(0) @binding(3) var color: texture_2d<f32>;
@binding(4) @group(0) var sample_2: sampler;
@binding(5) @group(0) var color_2: texture_2d<f32>;
@group(0) @binding(4) var sample_2: sampler;
@group(0) @binding(5) var color_2: texture_2d<f32>;
```

### Blending
Expand Down Expand Up @@ -685,7 +685,7 @@ const material = new Material({
modelViewMatrix: mat4x4<f32>,
instanceMatrix: array<mat4x4<f32>, 2>,
};
@binding(0) @group(0) var<uniform> uniforms: Uniforms;
@group(0) @binding(0) var<uniform> uniforms: Uniforms;
@vertex
fn main(
Expand Down
2 changes: 1 addition & 1 deletion examples/webgpu-compute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ mesh.material = new Material({
struct Uniforms {
time: f32,
};
@binding(0) @group(0) var<uniform> uniforms: Uniforms;
@group(0) @binding(0) var<uniform> uniforms: Uniforms;
@fragment
fn main(@location(0) uv: vec2<f32>) -> @location(0) vec4<f32> {
Expand Down
2 changes: 1 addition & 1 deletion examples/webgpu-cube.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const material = new Material({
normalMatrix: mat4x4<f32>,
color: vec3<f32>,
};
@binding(0) @group(0) var<uniform> uniforms: Uniforms;
@group(0) @binding(0) var<uniform> uniforms: Uniforms;
struct VertexIn {
@location(0) position: vec3<f32>,
Expand Down
6 changes: 3 additions & 3 deletions examples/webgpu-fullscreen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const material = new Material({
struct Uniforms {
time: f32,
};
@binding(0) @group(0) var<uniform> uniforms: Uniforms;
@group(0) @binding(0) var<uniform> uniforms: Uniforms;
struct VertexIn {
@location(0) position: vec3<f32>,
Expand All @@ -41,8 +41,8 @@ const material = new Material({
}
`,
fragment: /* wgsl */ `
@binding(1) @group(0) var sample: sampler;
@binding(2) @group(0) var color: texture_2d<f32>;
@group(0) @binding(1) var sample: sampler;
@group(0) @binding(2) var color: texture_2d<f32>;
struct FragmentIn {
@location(0) color: vec4<f32>,
Expand Down
16 changes: 8 additions & 8 deletions examples/webgpu-mrt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,17 @@ const composite = new Mesh(
}
`,
fragment: /* wgsl */ `
@binding(0) @group(0) var sampler0: sampler;
@binding(1) @group(0) var texture0: texture_2d<f32>;
@group(0) @binding(0) var sampler0: sampler;
@group(0) @binding(1) var texture0: texture_2d<f32>;
@binding(2) @group(0) var sampler1: sampler;
@binding(3) @group(0) var texture1: texture_2d<f32>;
@group(0) @binding(2) var sampler1: sampler;
@group(0) @binding(3) var texture1: texture_2d<f32>;
@binding(4) @group(0) var sampler2: sampler;
@binding(5) @group(0) var texture2: texture_2d<f32>;
@group(0) @binding(4) var sampler2: sampler;
@group(0) @binding(5) var texture2: texture_2d<f32>;
@binding(6) @group(0) var sampler3: sampler;
@binding(7) @group(0) var texture3: texture_2d<f32>;
@group(0) @binding(6) var sampler3: sampler;
@group(0) @binding(7) var texture3: texture_2d<f32>;
struct FragmentIn {
@location(0) uv: vec2<f32>,
Expand Down
2 changes: 1 addition & 1 deletion examples/webgpu-transparency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const material = new Material({
projectionMatrix: mat4x4<f32>,
modelViewMatrix: mat4x4<f32>,
};
@binding(0) @group(0) var<uniform> uniforms: Uniforms;
@group(0) @binding(0) var<uniform> uniforms: Uniforms;
struct VertexIn {
@location(0) position: vec3<f32>,
Expand Down

0 comments on commit 8ff0eba

Please sign in to comment.