Skip to content

Commit 19e21a7

Browse files
committed
fix: correct group bindings....
1 parent 323e5cd commit 19e21a7

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

assets/shaders/myshader.wgsl

+7-7
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@
88
#import shadplay::shader_utils::common NEG_HALF_PI, shader_toy_default, rotate2D
99

1010
@group(0) @binding(0) var<uniform> view: View;
11-
@group(1) @binding(1)var<uniform> color: vec4f;
1211

13-
@group(1) @binding(2) var texture: texture_2d<f32>;
14-
@group(1) @binding(3) var texture_sampler: sampler;
12+
@group(2) @binding(100)var<uniform> color: vec4f;
13+
@group(2) @binding(101) var texture: texture_2d<f32>;
14+
@group(2) @binding(102) var texture_sampler: sampler;
1515

1616
const SPEED:f32 = 1.0;
1717

1818
@fragment
1919
fn fragment(in: VertexOutput) -> @location(0) vec4f {
20-
// let texture_uvs = in.uv;
21-
// let tex: vec4f = textureSample(texture, texture_sampler, texture_uvs);
22-
// return tex;
23-
return vec4f(1.0);
20+
let texture_uvs = in.uv;
21+
let tex: vec4f = textureSample(texture, texture_sampler, texture_uvs);
22+
return tex;
23+
// return vec4f(1.0);
2424
}

scripts/reset-3d.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99
1010
@group(0) @binding(0) var<uniform> view: View;
1111
12-
@group(1) @binding(1) var texture: texture_2d<f32>;
13-
@group(1) @binding(1) var texture_sampler: sampler;
12+
@group(2) @binding(100)var<uniform> color: vec4f;
13+
@group(2) @binding(101) var texture: texture_2d<f32>;
14+
@group(2) @binding(102) var texture_sampler: sampler;
1415
1516
const SPEED:f32 = 1.0;
1617

src/shader_utils/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ pub struct DragNDropShader {
1919
/// The 3D shader.
2020
#[derive(Asset, AsBindGroup, TypePath, Debug, Clone)]
2121
pub struct YourShader {
22-
#[uniform(0)]
22+
#[uniform(100)]
2323
pub color: LinearRgba, //RGBA
2424

25-
#[texture(1, dimension = "2d")]
26-
#[sampler(2)]
25+
#[texture(101, dimension = "2d")]
26+
#[sampler(102)]
2727
pub img: Handle<Image>,
2828
}
2929
// 3d impl

0 commit comments

Comments
 (0)