summaryrefslogtreecommitdiffstats
path: root/assets/shaders/canvas.wgsl
diff options
context:
space:
mode:
Diffstat (limited to 'assets/shaders/canvas.wgsl')
-rw-r--r--assets/shaders/canvas.wgsl32
1 files changed, 32 insertions, 0 deletions
diff --git a/assets/shaders/canvas.wgsl b/assets/shaders/canvas.wgsl
new file mode 100644
index 0000000..3be1a77
--- /dev/null
+++ b/assets/shaders/canvas.wgsl
@@ -0,0 +1,32 @@
+struct VertexInput {
+ @location(0) position: vec3<f32>,
+ @location(1) uv: vec2<f32>
+};
+
+struct VertexOutput {
+ @builtin(position) clip_position: vec4<f32>,
+ @location(0) uv: vec2<f32>
+};
+
+@vertex
+fn vs_main(
+ model: VertexInput,
+) -> VertexOutput {
+ var out: VertexOutput;
+
+ out.clip_position = vec4<f32>(model.position, 1.0);
+ out.uv = model.uv;
+
+ return out;
+}
+
+@group(0) @binding(0)
+var canvas_texture: texture_2d<f32>;
+@group(0) @binding(1)
+var canvas_sampler: sampler;
+
+@fragment
+fn fs_main(in: VertexOutput
+) -> @location(0) vec4<f32> {
+ return textureSample(canvas_texture, canvas_sampler, in.uv);
+}