summaryrefslogtreecommitdiff
path: root/common/shaders/passthrough.wgsl
diff options
context:
space:
mode:
Diffstat (limited to 'common/shaders/passthrough.wgsl')
-rw-r--r--common/shaders/passthrough.wgsl32
1 files changed, 19 insertions, 13 deletions
diff --git a/common/shaders/passthrough.wgsl b/common/shaders/passthrough.wgsl
index 266e231..9fb0bdc 100644
--- a/common/shaders/passthrough.wgsl
+++ b/common/shaders/passthrough.wgsl
@@ -1,18 +1,24 @@
-@group(0) @binding(0) var smplr: sampler;
-@group(0) @binding(1) var txt: texture_2d<f32>;
+// Passthrough shader for Sequence v2
+#include "sequence_uniforms"
-#include "common_uniforms"
-@group(0) @binding(2) var<uniform> uniforms: CommonUniforms;
+@group(0) @binding(0) var input_sampler: sampler;
+@group(0) @binding(1) var input_texture: texture_2d<f32>;
+@group(0) @binding(2) var<uniform> uniforms: UniformsSequenceParams;
-@vertex fn vs_main(@builtin(vertex_index) i: u32) -> @builtin(position) vec4<f32> {
- var pos = array<vec2<f32>, 3>(
- vec2<f32>(-1, -1),
- vec2<f32>(3, -1),
- vec2<f32>(-1, 3)
- );
- return vec4<f32>(pos[i], 0.0, 1.0);
+struct VertexOutput {
+ @builtin(position) position: vec4<f32>,
+ @location(0) uv: vec2<f32>,
+};
+
+@vertex fn vs_main(@builtin(vertex_index) vid: u32) -> VertexOutput {
+ var out: VertexOutput;
+ let x = f32((vid & 1u) << 1u);
+ let y = f32((vid & 2u));
+ out.position = vec4<f32>(x * 2.0 - 1.0, 1.0 - y * 2.0, 0.0, 1.0);
+ out.uv = vec2<f32>(x, y);
+ return out;
}
-@fragment fn fs_main(@builtin(position) p: vec4<f32>) -> @location(0) vec4<f32> {
- return textureSample(txt, smplr, p.xy / uniforms.resolution);
+@fragment fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
+ return textureSample(input_texture, input_sampler, in.uv);
}