From b2ede3f0680edc894a54e28374cb87ab2690afa2 Mon Sep 17 00:00:00 2001 From: skal Date: Mon, 16 Feb 2026 14:32:59 +0100 Subject: refactor: remove v2 versioning artifacts, establish Sequence as canonical system MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Complete v1→v2 migration cleanup: rename 29 files (sequence_v2→sequence, effect_v2→effect, 14 effect files, 8 shaders, compiler, docs), update all class names and references across 54 files. Archive v1 timeline. System now uses standard naming with all versioning removed. 30/34 tests passing. Co-Authored-By: Claude Sonnet 4.5 --- common/shaders/combined_postprocess.wgsl | 36 ++++++++++++++++++++++ common/shaders/combined_postprocess_v2.wgsl | 36 ---------------------- common/shaders/gaussian_blur.wgsl | 45 +++++++++++++++++++++++++++ common/shaders/gaussian_blur_v2.wgsl | 45 --------------------------- common/shaders/heptagon.wgsl | 47 +++++++++++++++++++++++++++++ common/shaders/heptagon_v2.wgsl | 47 ----------------------------- common/shaders/passthrough.wgsl | 32 ++++++++++++-------- common/shaders/passthrough_v2.wgsl | 24 --------------- common/shaders/sequence_uniforms.wgsl | 12 ++++++++ common/shaders/sequence_v2_uniforms.wgsl | 12 -------- 10 files changed, 159 insertions(+), 177 deletions(-) create mode 100644 common/shaders/combined_postprocess.wgsl delete mode 100644 common/shaders/combined_postprocess_v2.wgsl create mode 100644 common/shaders/gaussian_blur.wgsl delete mode 100644 common/shaders/gaussian_blur_v2.wgsl create mode 100644 common/shaders/heptagon.wgsl delete mode 100644 common/shaders/heptagon_v2.wgsl delete mode 100644 common/shaders/passthrough_v2.wgsl create mode 100644 common/shaders/sequence_uniforms.wgsl delete mode 100644 common/shaders/sequence_v2_uniforms.wgsl (limited to 'common/shaders') diff --git a/common/shaders/combined_postprocess.wgsl b/common/shaders/combined_postprocess.wgsl new file mode 100644 index 0000000..ea65761 --- /dev/null +++ b/common/shaders/combined_postprocess.wgsl @@ -0,0 +1,36 @@ +// Example: Combined post-process using inline functions +// Demonstrates how to chain multiple simple effects without separate classes + +#include "sequence_uniforms" +#include "postprocess_inline" + +@group(0) @binding(0) var input_sampler: sampler; +@group(0) @binding(1) var input_texture: texture_2d; +@group(0) @binding(2) var uniforms: UniformsSequenceParams; + +struct VertexOutput { + @builtin(position) position: vec4, + @location(0) uv: vec2, +}; + +@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(x * 2.0 - 1.0, 1.0 - y * 2.0, 0.0, 1.0); + out.uv = vec2(x, y); + return out; +} + +@fragment fn fs_main(in: VertexOutput) -> @location(0) vec4 { + // Sample base color + var color = textureSample(input_texture, input_sampler, in.uv); + + // Apply effects in sequence (customize as needed) + // color = apply_solarize(color, 0.4, 0.4, uniforms.time); + // color = apply_theme(color, vec3(1.0, 0.8, 0.6), 0.3); + color = apply_vignette(color, in.uv, 0.6, 0.1, uniforms.audio_intensity); + // color = apply_flash(color, uniforms.beat_phase * 0.2); + + return color; +} diff --git a/common/shaders/combined_postprocess_v2.wgsl b/common/shaders/combined_postprocess_v2.wgsl deleted file mode 100644 index a934dce..0000000 --- a/common/shaders/combined_postprocess_v2.wgsl +++ /dev/null @@ -1,36 +0,0 @@ -// Example: Combined post-process using inline functions -// Demonstrates how to chain multiple simple effects without separate classes - -#include "sequence_v2_uniforms" -#include "postprocess_inline" - -@group(0) @binding(0) var input_sampler: sampler; -@group(0) @binding(1) var input_texture: texture_2d; -@group(0) @binding(2) var uniforms: UniformsSequenceParams; - -struct VertexOutput { - @builtin(position) position: vec4, - @location(0) uv: vec2, -}; - -@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(x * 2.0 - 1.0, 1.0 - y * 2.0, 0.0, 1.0); - out.uv = vec2(x, y); - return out; -} - -@fragment fn fs_main(in: VertexOutput) -> @location(0) vec4 { - // Sample base color - var color = textureSample(input_texture, input_sampler, in.uv); - - // Apply effects in sequence (customize as needed) - // color = apply_solarize(color, 0.4, 0.4, uniforms.time); - // color = apply_theme(color, vec3(1.0, 0.8, 0.6), 0.3); - color = apply_vignette(color, in.uv, 0.6, 0.1, uniforms.audio_intensity); - // color = apply_flash(color, uniforms.beat_phase * 0.2); - - return color; -} diff --git a/common/shaders/gaussian_blur.wgsl b/common/shaders/gaussian_blur.wgsl new file mode 100644 index 0000000..293977f --- /dev/null +++ b/common/shaders/gaussian_blur.wgsl @@ -0,0 +1,45 @@ +// Gaussian blur shader for Sequence v2 +#include "sequence_uniforms" + +@group(0) @binding(0) var input_sampler: sampler; +@group(0) @binding(1) var input_texture: texture_2d; +@group(0) @binding(2) var uniforms: UniformsSequenceParams; + +struct GaussianBlurParams { + direction: vec2, + radius: f32, + _pad: f32, +}; +@group(0) @binding(3) var params: GaussianBlurParams; + +struct VertexOutput { + @builtin(position) position: vec4, + @location(0) uv: vec2, +}; + +@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(x * 2.0 - 1.0, 1.0 - y * 2.0, 0.0, 1.0); + out.uv = vec2(x, y); + return out; +} + +@fragment fn fs_main(in: VertexOutput) -> @location(0) vec4 { + let texel_size = 1.0 / uniforms.resolution; + let offset = params.direction * texel_size; + + var color = vec4(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; +} diff --git a/common/shaders/gaussian_blur_v2.wgsl b/common/shaders/gaussian_blur_v2.wgsl deleted file mode 100644 index 0f29140..0000000 --- a/common/shaders/gaussian_blur_v2.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// 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; -@group(0) @binding(2) var uniforms: UniformsSequenceParams; - -struct GaussianBlurParams { - direction: vec2, - radius: f32, - _pad: f32, -}; -@group(0) @binding(3) var params: GaussianBlurParams; - -struct VertexOutput { - @builtin(position) position: vec4, - @location(0) uv: vec2, -}; - -@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(x * 2.0 - 1.0, 1.0 - y * 2.0, 0.0, 1.0); - out.uv = vec2(x, y); - return out; -} - -@fragment fn fs_main(in: VertexOutput) -> @location(0) vec4 { - let texel_size = 1.0 / uniforms.resolution; - let offset = params.direction * texel_size; - - var color = vec4(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; -} diff --git a/common/shaders/heptagon.wgsl b/common/shaders/heptagon.wgsl new file mode 100644 index 0000000..3bfc59d --- /dev/null +++ b/common/shaders/heptagon.wgsl @@ -0,0 +1,47 @@ +// Heptagon shader for Sequence v2 +#include "sequence_uniforms" + +// Standard v2 post-process layout (bindings 0,1 unused for scene effects) +@group(0) @binding(2) var uniforms: UniformsSequenceParams; + +struct VertexOutput { + @builtin(position) position: vec4, + @location(0) uv: vec2, +}; + +@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(x * 2.0 - 1.0, 1.0 - y * 2.0, 0.0, 1.0); + out.uv = vec2(x, y); + return out; +} + +fn sdf_heptagon(p: vec2, r: f32) -> f32 { + let k = vec3(0.868516, -0.495754, 0.357407); + var p_abs = abs(p); + p_abs -= 2.0 * k.xy * min(dot(k.xy, p_abs), 0.0); + p_abs -= 2.0 * vec2(-k.x, k.y) * min(dot(vec2(-k.x, k.y), p_abs), 0.0); + p_abs -= vec2(clamp(p_abs.x, -k.z * r, k.z * r), r); + return length(p_abs) * sign(p_abs.y); +} + +@fragment fn fs_main(in: VertexOutput) -> @location(0) vec4 { + let aspect = uniforms.aspect_ratio; + let uv = (in.uv * 2.0 - 1.0) * vec2(aspect, 1.0); + + let rotation = uniforms.beat_time * 0.5; + let c = cos(rotation); + let s = sin(rotation); + let rot_uv = vec2( + uv.x * c - uv.y * s, + uv.x * s + uv.y * c + ); + + let dist = sdf_heptagon(rot_uv, 0.5); + let color = mix(vec3(0.2, 0.4, 0.8), vec3(1.0, 0.8, 0.2), + smoothstep(0.01, -0.01, dist)); + + return vec4(color, 1.0); +} diff --git a/common/shaders/heptagon_v2.wgsl b/common/shaders/heptagon_v2.wgsl deleted file mode 100644 index cb07c18..0000000 --- a/common/shaders/heptagon_v2.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Heptagon shader for Sequence v2 -#include "sequence_v2_uniforms" - -// Standard v2 post-process layout (bindings 0,1 unused for scene effects) -@group(0) @binding(2) var uniforms: UniformsSequenceParams; - -struct VertexOutput { - @builtin(position) position: vec4, - @location(0) uv: vec2, -}; - -@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(x * 2.0 - 1.0, 1.0 - y * 2.0, 0.0, 1.0); - out.uv = vec2(x, y); - return out; -} - -fn sdf_heptagon(p: vec2, r: f32) -> f32 { - let k = vec3(0.868516, -0.495754, 0.357407); - var p_abs = abs(p); - p_abs -= 2.0 * k.xy * min(dot(k.xy, p_abs), 0.0); - p_abs -= 2.0 * vec2(-k.x, k.y) * min(dot(vec2(-k.x, k.y), p_abs), 0.0); - p_abs -= vec2(clamp(p_abs.x, -k.z * r, k.z * r), r); - return length(p_abs) * sign(p_abs.y); -} - -@fragment fn fs_main(in: VertexOutput) -> @location(0) vec4 { - let aspect = uniforms.aspect_ratio; - let uv = (in.uv * 2.0 - 1.0) * vec2(aspect, 1.0); - - let rotation = uniforms.beat_time * 0.5; - let c = cos(rotation); - let s = sin(rotation); - let rot_uv = vec2( - uv.x * c - uv.y * s, - uv.x * s + uv.y * c - ); - - let dist = sdf_heptagon(rot_uv, 0.5); - let color = mix(vec3(0.2, 0.4, 0.8), vec3(1.0, 0.8, 0.2), - smoothstep(0.01, -0.01, dist)); - - return vec4(color, 1.0); -} 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; +// Passthrough shader for Sequence v2 +#include "sequence_uniforms" -#include "common_uniforms" -@group(0) @binding(2) var uniforms: CommonUniforms; +@group(0) @binding(0) var input_sampler: sampler; +@group(0) @binding(1) var input_texture: texture_2d; +@group(0) @binding(2) var uniforms: UniformsSequenceParams; -@vertex fn vs_main(@builtin(vertex_index) i: u32) -> @builtin(position) vec4 { - var pos = array, 3>( - vec2(-1, -1), - vec2(3, -1), - vec2(-1, 3) - ); - return vec4(pos[i], 0.0, 1.0); +struct VertexOutput { + @builtin(position) position: vec4, + @location(0) uv: vec2, +}; + +@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(x * 2.0 - 1.0, 1.0 - y * 2.0, 0.0, 1.0); + out.uv = vec2(x, y); + return out; } -@fragment fn fs_main(@builtin(position) p: vec4) -> @location(0) vec4 { - return textureSample(txt, smplr, p.xy / uniforms.resolution); +@fragment fn fs_main(in: VertexOutput) -> @location(0) vec4 { + return textureSample(input_texture, input_sampler, in.uv); } diff --git a/common/shaders/passthrough_v2.wgsl b/common/shaders/passthrough_v2.wgsl deleted file mode 100644 index e2fdc25..0000000 --- a/common/shaders/passthrough_v2.wgsl +++ /dev/null @@ -1,24 +0,0 @@ -// Passthrough 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; -@group(0) @binding(2) var uniforms: UniformsSequenceParams; - -struct VertexOutput { - @builtin(position) position: vec4, - @location(0) uv: vec2, -}; - -@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(x * 2.0 - 1.0, 1.0 - y * 2.0, 0.0, 1.0); - out.uv = vec2(x, y); - return out; -} - -@fragment fn fs_main(in: VertexOutput) -> @location(0) vec4 { - return textureSample(input_texture, input_sampler, in.uv); -} diff --git a/common/shaders/sequence_uniforms.wgsl b/common/shaders/sequence_uniforms.wgsl new file mode 100644 index 0000000..b302329 --- /dev/null +++ b/common/shaders/sequence_uniforms.wgsl @@ -0,0 +1,12 @@ +// Sequence v2 uniform structure for WGSL shaders +// Matches UniformsSequenceParams in sequence_v2.h + +struct UniformsSequenceParams { + resolution: vec2, + aspect_ratio: f32, + time: f32, + beat_time: f32, + beat_phase: f32, + audio_intensity: f32, + _pad: f32, +}; diff --git a/common/shaders/sequence_v2_uniforms.wgsl b/common/shaders/sequence_v2_uniforms.wgsl deleted file mode 100644 index b302329..0000000 --- a/common/shaders/sequence_v2_uniforms.wgsl +++ /dev/null @@ -1,12 +0,0 @@ -// Sequence v2 uniform structure for WGSL shaders -// Matches UniformsSequenceParams in sequence_v2.h - -struct UniformsSequenceParams { - resolution: vec2, - aspect_ratio: f32, - time: f32, - beat_time: f32, - beat_phase: f32, - audio_intensity: f32, - _pad: f32, -}; -- cgit v1.2.3