diff options
Diffstat (limited to 'src/shader/debug.wgsl')
| -rw-r--r-- | src/shader/debug.wgsl | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/shader/debug.wgsl b/src/shader/debug.wgsl new file mode 100644 index 0000000..256b969 --- /dev/null +++ b/src/shader/debug.wgsl @@ -0,0 +1,28 @@ +struct Camera { + scale: vec2f, + centre: vec2f, +}; + +@group(0) @binding(0) var<uniform> camera: Camera; + +struct VertexOutput { + @builtin(position) clip_position: vec4f, + @location(0) color: vec4f, +}; + +@vertex +fn vs_main( + @location(0) world: vec2f, + @location(1) color: vec4f, +) -> VertexOutput { + var out: VertexOutput; + out.clip_position = vec4f((world - camera.centre) * camera.scale, 0.0, 1.0); + out.color = color; + + return out; +} + +@fragment +fn fs_main(in: VertexOutput) -> @location(0) vec4f { + return in.color; +} |
