summaryrefslogtreecommitdiff
path: root/common/shaders/gaussian_blur_v2.wgsl
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-16 08:58:46 +0100
committerskal <pascal.massimino@gmail.com>2026-02-16 08:58:46 +0100
commit04938fc4a3335e1459e5fb23d0d091fd2a40c296 (patch)
tree769ab31b1545e17e42e10bf5b35b5ea9d35564f3 /common/shaders/gaussian_blur_v2.wgsl
parent79fc9fc1e56ef78dfb7b9732febc8c8777fac9fb (diff)
feat(sequence): complete phase 3 - v2 shader integration and effect ports
- Create v2-compatible WGSL shaders with UniformsSequenceParams - Add sequence_v2_uniforms snippet for ShaderComposer - Port 3 effects: PassthroughEffectV2, GaussianBlurEffectV2, HeptagonEffectV2 - Enable and fix end-to-end test (test_sequence_v2_e2e) - Fix shader binding order (sampler at 0, texture at 1) - Fix WebGPU validation (maxAnisotropy=1, explicit depthSlice) - Add v2 shaders to main and test workspace assets - All tests passing (36/36) handoff(Claude): Phase 3 complete, v2 effects functional, ready for phase 4
Diffstat (limited to 'common/shaders/gaussian_blur_v2.wgsl')
-rw-r--r--common/shaders/gaussian_blur_v2.wgsl45
1 files changed, 45 insertions, 0 deletions
diff --git a/common/shaders/gaussian_blur_v2.wgsl b/common/shaders/gaussian_blur_v2.wgsl
new file mode 100644
index 0000000..0f29140
--- /dev/null
+++ b/common/shaders/gaussian_blur_v2.wgsl
@@ -0,0 +1,45 @@
+// Gaussian blur shader for Sequence v2
+#include "sequence_v2_uniforms"
+
+@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;
+
+struct GaussianBlurParams {
+ direction: vec2<f32>,
+ radius: f32,
+ _pad: f32,
+};
+@group(0) @binding(3) var<uniform> params: GaussianBlurParams;
+
+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(in: VertexOutput) -> @location(0) vec4<f32> {
+ let texel_size = 1.0 / uniforms.resolution;
+ let offset = params.direction * texel_size;
+
+ var color = vec4<f32>(0.0);
+ let kernel_size = i32(params.radius);
+ var weight_sum = 0.0;
+
+ for (var i = -kernel_size; i <= kernel_size; i++) {
+ let sample_offset = f32(i) * offset;
+ let weight = exp(-f32(i * i) / (2.0 * params.radius * params.radius));
+ color += textureSample(input_texture, input_sampler, in.uv + sample_offset) * weight;
+ weight_sum += weight;
+ }
+
+ return color / weight_sum;
+}