diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-16 14:32:59 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-16 14:32:59 +0100 |
| commit | b2ede3f0680edc894a54e28374cb87ab2690afa2 (patch) | |
| tree | 69e0a8c04eb29be953b037eb98e0a9ac0f1b417a /src | |
| parent | 0fd3c982247d05bacbd67db08c865ec67602437f (diff) | |
refactor: remove v2 versioning artifacts, establish Sequence as canonical system
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 <noreply@anthropic.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/app/main.cc | 6 | ||||
| -rw-r--r-- | src/app/test_demo.cc | 8 | ||||
| -rw-r--r-- | src/effects/gaussian_blur_effect.cc (renamed from src/effects/gaussian_blur_effect_v2.cc) | 8 | ||||
| -rw-r--r-- | src/effects/gaussian_blur_effect.h (renamed from src/effects/gaussian_blur_effect_v2.h) | 7 | ||||
| -rw-r--r-- | src/effects/heptagon_effect.cc (renamed from src/effects/heptagon_effect_v2.cc) | 10 | ||||
| -rw-r--r-- | src/effects/heptagon_effect.h (renamed from src/effects/heptagon_effect_v2.h) | 9 | ||||
| -rw-r--r-- | src/effects/hybrid3_d_effect.cc (renamed from src/effects/hybrid3_d_effect_v2.cc) | 14 | ||||
| -rw-r--r-- | src/effects/hybrid3_d_effect.h (renamed from src/effects/hybrid3_d_effect_v2.h) | 10 | ||||
| -rw-r--r-- | src/effects/particles_effect.cc (renamed from src/effects/particles_effect_v2.cc) | 10 | ||||
| -rw-r--r-- | src/effects/particles_effect.h (renamed from src/effects/particles_effect_v2.h) | 9 | ||||
| -rw-r--r-- | src/effects/passthrough_effect.cc (renamed from src/effects/passthrough_effect_v2.cc) | 8 | ||||
| -rw-r--r-- | src/effects/passthrough_effect.h (renamed from src/effects/passthrough_effect_v2.h) | 6 | ||||
| -rw-r--r-- | src/effects/placeholder_effect.cc (renamed from src/effects/placeholder_effect_v2.cc) | 8 | ||||
| -rw-r--r-- | src/effects/placeholder_effect.h (renamed from src/effects/placeholder_effect_v2.h) | 7 | ||||
| -rw-r--r-- | src/effects/rotating_cube_effect.cc (renamed from src/effects/rotating_cube_effect_v2.cc) | 14 | ||||
| -rw-r--r-- | src/effects/rotating_cube_effect.h (renamed from src/effects/rotating_cube_effect_v2.h) | 10 | ||||
| -rw-r--r-- | src/gpu/demo_effects.h | 20 | ||||
| -rw-r--r-- | src/gpu/effect.cc (renamed from src/gpu/effect_v2.cc) | 6 | ||||
| -rw-r--r-- | src/gpu/effect.h (renamed from src/gpu/effect_v2.h) | 15 | ||||
| -rw-r--r-- | src/gpu/gpu.cc | 2 | ||||
| -rw-r--r-- | src/gpu/sequence.cc (renamed from src/gpu/sequence_v2.cc) | 20 | ||||
| -rw-r--r-- | src/gpu/sequence.h (renamed from src/gpu/sequence_v2.h) | 17 | ||||
| -rw-r--r-- | src/tests/gpu/test_demo_effects.cc | 38 | ||||
| -rw-r--r-- | src/tests/gpu/test_effect_base.cc | 34 | ||||
| -rw-r--r-- | src/tests/gpu/test_sequence.cc (renamed from src/tests/gpu/test_sequence_v2.cc) | 34 | ||||
| -rw-r--r-- | src/tests/gpu/test_sequence_e2e.cc (renamed from src/tests/gpu/test_sequence_v2_e2e.cc) | 18 |
26 files changed, 179 insertions, 169 deletions
diff --git a/src/app/main.cc b/src/app/main.cc index 75995ad..7496e8c 100644 --- a/src/app/main.cc +++ b/src/app/main.cc @@ -20,7 +20,7 @@ #include "generated/assets.h" // Include generated asset header #include "gpu/demo_effects.h" #include "gpu/gpu.h" -#include "generated/timeline_v2.h" // For GetDemoDuration(), RenderV2Timeline() +#include "generated/timeline.h" // For GetDemoDuration(), RenderTimeline() #include "platform/platform.h" #include "util/math.h" #include <cmath> @@ -109,7 +109,7 @@ int main(int argc, char** argv) { gpu_init(&platform_state); // Initialize v2 sequences - InitializeV2Sequences(*gpu_get_context(), width, height); + InitializeSequences(*gpu_get_context(), width, height); #if !defined(STRIP_ALL) // Set WAV dump backend if requested @@ -414,7 +414,7 @@ int main(int argc, char** argv) { } // Draw graphics using v2 timeline - RenderV2Timeline(gpu_get_surface(), (float)current_physical_time, width, height, + RenderTimeline(gpu_get_surface(), (float)current_physical_time, width, height, absolute_beat_time, visual_peak); last_frame_time = current_physical_time; diff --git a/src/app/test_demo.cc b/src/app/test_demo.cc index c2366c3..993ceba 100644 --- a/src/app/test_demo.cc +++ b/src/app/test_demo.cc @@ -16,7 +16,7 @@ #include <cstring> // External declarations from generated test timeline (v2) -#include "generated/test_timeline_v2.h" +#include "generated/test_timeline.h" extern float GetDemoDuration(); // TODO: Port PeakMeterEffect and CNN effects to v2 @@ -226,7 +226,7 @@ int main(int argc, char** argv) { gpu_init(&platform_state); // Initialize v2 timeline from test_demo.seq - InitializeTestV2Sequences(*gpu_get_context(), width, height); + InitializeSequences(*gpu_get_context(), width, height); #if !defined(STRIP_ALL) // TODO: Port CNN and peak meter effects to v2 @@ -397,8 +397,8 @@ int main(int argc, char** argv) { // Draw graphics using v2 timeline const float graphics_frame_time = (float)current_physical_time; - RenderTestV2Timeline(gpu_get_surface(), graphics_frame_time, width, height, - absolute_beat_time, visual_peak); + RenderTimeline(gpu_get_surface(), graphics_frame_time, width, height, + absolute_beat_time, visual_peak); // Update audio systems (tracker, synth, etc.) based on audio time // progression diff --git a/src/effects/gaussian_blur_effect_v2.cc b/src/effects/gaussian_blur_effect.cc index 0c90fa2..17c657f 100644 --- a/src/effects/gaussian_blur_effect_v2.cc +++ b/src/effects/gaussian_blur_effect.cc @@ -1,13 +1,13 @@ // Gaussian blur effect v2 implementation -#include "effects/gaussian_blur_effect_v2.h" +#include "effects/gaussian_blur_effect.h" #include "gpu/post_process_helper.h" #include "gpu/shaders.h" -GaussianBlurEffectV2::GaussianBlurEffectV2(const GpuContext& ctx, +GaussianBlurEffect::GaussianBlurEffect(const GpuContext& ctx, const std::vector<std::string>& inputs, const std::vector<std::string>& outputs) - : EffectV2(ctx, inputs, outputs), pipeline_(nullptr), bind_group_(nullptr), + : Effect(ctx, inputs, outputs), pipeline_(nullptr), bind_group_(nullptr), sampler_(nullptr) { // Create pipeline pipeline_ = create_post_process_pipeline(ctx_.device, WGPUTextureFormat_RGBA8Unorm, @@ -27,7 +27,7 @@ GaussianBlurEffectV2::GaussianBlurEffectV2(const GpuContext& ctx, uniforms_buffer_.init(ctx_.device); } -void GaussianBlurEffectV2::render(WGPUCommandEncoder encoder, +void GaussianBlurEffect::render(WGPUCommandEncoder encoder, const UniformsSequenceParams& params, NodeRegistry& nodes) { // Get input/output views diff --git a/src/effects/gaussian_blur_effect_v2.h b/src/effects/gaussian_blur_effect.h index c5d88ff..8bf34dc 100644 --- a/src/effects/gaussian_blur_effect_v2.h +++ b/src/effects/gaussian_blur_effect.h @@ -2,7 +2,7 @@ #pragma once -#include "gpu/effect_v2.h" +#include "gpu/effect.h" #include "gpu/uniform_helper.h" struct GaussianBlurParams { @@ -14,9 +14,9 @@ struct GaussianBlurParams { static_assert(sizeof(GaussianBlurParams) == 16, "GaussianBlurParams must be 16 bytes"); -class GaussianBlurEffectV2 : public EffectV2 { +class GaussianBlurEffect : public Effect { public: - GaussianBlurEffectV2(const GpuContext& ctx, + GaussianBlurEffect(const GpuContext& ctx, const std::vector<std::string>& inputs, const std::vector<std::string>& outputs); @@ -31,3 +31,4 @@ class GaussianBlurEffectV2 : public EffectV2 { UniformBuffer<GaussianBlurParams> params_buffer_; UniformBuffer<UniformsSequenceParams> uniforms_buffer_; }; + diff --git a/src/effects/heptagon_effect_v2.cc b/src/effects/heptagon_effect.cc index 6a2135e..27d59da 100644 --- a/src/effects/heptagon_effect_v2.cc +++ b/src/effects/heptagon_effect.cc @@ -1,14 +1,14 @@ // Heptagon effect v2 implementation -#include "effects/heptagon_effect_v2.h" +#include "effects/heptagon_effect.h" #include "gpu/gpu.h" #include "gpu/post_process_helper.h" #include "gpu/shaders.h" -HeptagonEffectV2::HeptagonEffectV2(const GpuContext& ctx, +HeptagonEffect::HeptagonEffect(const GpuContext& ctx, const std::vector<std::string>& inputs, const std::vector<std::string>& outputs) - : EffectV2(ctx, inputs, outputs), pipeline_(nullptr), bind_group_(nullptr), sampler_(nullptr) { + : Effect(ctx, inputs, outputs), pipeline_(nullptr), bind_group_(nullptr), sampler_(nullptr) { // Init uniforms uniforms_buffer_.init(ctx_.device); @@ -37,7 +37,7 @@ HeptagonEffectV2::HeptagonEffectV2(const GpuContext& ctx, dummy_texture_view_ = wgpuTextureCreateView(dummy_texture_, nullptr); } -HeptagonEffectV2::~HeptagonEffectV2() { +HeptagonEffect::~HeptagonEffect() { if (bind_group_) wgpuBindGroupRelease(bind_group_); if (pipeline_) wgpuRenderPipelineRelease(pipeline_); if (sampler_) wgpuSamplerRelease(sampler_); @@ -45,7 +45,7 @@ HeptagonEffectV2::~HeptagonEffectV2() { if (dummy_texture_) wgpuTextureRelease(dummy_texture_); } -void HeptagonEffectV2::render(WGPUCommandEncoder encoder, +void HeptagonEffect::render(WGPUCommandEncoder encoder, const UniformsSequenceParams& params, NodeRegistry& nodes) { // Get output view (scene effects typically write to output, ignore input) diff --git a/src/effects/heptagon_effect_v2.h b/src/effects/heptagon_effect.h index 1737a46..9f148a1 100644 --- a/src/effects/heptagon_effect_v2.h +++ b/src/effects/heptagon_effect.h @@ -2,14 +2,14 @@ #pragma once -#include "gpu/effect_v2.h" +#include "gpu/effect.h" #include "gpu/uniform_helper.h" -class HeptagonEffectV2 : public EffectV2 { +class HeptagonEffect : public Effect { public: - HeptagonEffectV2(const GpuContext& ctx, const std::vector<std::string>& inputs, + HeptagonEffect(const GpuContext& ctx, const std::vector<std::string>& inputs, const std::vector<std::string>& outputs); - ~HeptagonEffectV2(); + ~HeptagonEffect(); void render(WGPUCommandEncoder encoder, const UniformsSequenceParams& params, NodeRegistry& nodes) override; @@ -22,3 +22,4 @@ class HeptagonEffectV2 : public EffectV2 { WGPUTextureView dummy_texture_view_; UniformBuffer<UniformsSequenceParams> uniforms_buffer_; }; + diff --git a/src/effects/hybrid3_d_effect_v2.cc b/src/effects/hybrid3_d_effect.cc index 38e4e66..ced5b42 100644 --- a/src/effects/hybrid3_d_effect_v2.cc +++ b/src/effects/hybrid3_d_effect.cc @@ -1,14 +1,14 @@ // This file is part of the 64k demo project. -// It implements Hybrid3DEffectV2 (simplified v2 port). +// It implements Hybrid3DEffect (simplified v2 port). // TODO: Full Renderer3D integration with texture manager, noise assets -#include "effects/hybrid3_d_effect_v2.h" +#include "effects/hybrid3_d_effect.h" #include <cmath> -Hybrid3DEffectV2::Hybrid3DEffectV2(const GpuContext& ctx, +Hybrid3DEffect::Hybrid3DEffect(const GpuContext& ctx, const std::vector<std::string>& inputs, const std::vector<std::string>& outputs) - : EffectV2(ctx, inputs, outputs), depth_node_(outputs[0] + "_depth"), + : Effect(ctx, inputs, outputs), depth_node_(outputs[0] + "_depth"), dummy_texture_(nullptr), dummy_texture_view_(nullptr) { // Initialize renderer (format is always RGBA8Unorm for v2) renderer_.init(ctx_.device, ctx_.queue, WGPUTextureFormat_RGBA8Unorm); @@ -82,7 +82,7 @@ Hybrid3DEffectV2::Hybrid3DEffectV2(const GpuContext& ctx, } } -Hybrid3DEffectV2::~Hybrid3DEffectV2() { +Hybrid3DEffect::~Hybrid3DEffect() { if (dummy_texture_view_) wgpuTextureViewRelease(dummy_texture_view_); if (dummy_texture_) @@ -90,12 +90,12 @@ Hybrid3DEffectV2::~Hybrid3DEffectV2() { renderer_.shutdown(); } -void Hybrid3DEffectV2::declare_nodes(NodeRegistry& registry) { +void Hybrid3DEffect::declare_nodes(NodeRegistry& registry) { // Declare depth buffer node registry.declare_node(depth_node_, NodeType::DEPTH24, -1, -1); } -void Hybrid3DEffectV2::render(WGPUCommandEncoder encoder, +void Hybrid3DEffect::render(WGPUCommandEncoder encoder, const UniformsSequenceParams& params, NodeRegistry& nodes) { // Update camera (orbiting) diff --git a/src/effects/hybrid3_d_effect_v2.h b/src/effects/hybrid3_d_effect.h index c8116b0..e6e0f49 100644 --- a/src/effects/hybrid3_d_effect_v2.h +++ b/src/effects/hybrid3_d_effect.h @@ -1,5 +1,5 @@ // This file is part of the 64k demo project. -// It declares Hybrid3DEffectV2 (simplified v2 port). +// It declares Hybrid3DEffect (simplified v2 port). // TODO: Full Renderer3D integration with Scene/Camera #pragma once @@ -7,14 +7,14 @@ #include "3d/camera.h" #include "3d/renderer.h" #include "3d/scene.h" -#include "gpu/effect_v2.h" +#include "gpu/effect.h" -class Hybrid3DEffectV2 : public EffectV2 { +class Hybrid3DEffect : public Effect { public: - Hybrid3DEffectV2(const GpuContext& ctx, + Hybrid3DEffect(const GpuContext& ctx, const std::vector<std::string>& inputs, const std::vector<std::string>& outputs); - ~Hybrid3DEffectV2() override; + ~Hybrid3DEffect() override; void declare_nodes(NodeRegistry& registry) override; void render(WGPUCommandEncoder encoder, diff --git a/src/effects/particles_effect_v2.cc b/src/effects/particles_effect.cc index 69da4da..9d73bf7 100644 --- a/src/effects/particles_effect_v2.cc +++ b/src/effects/particles_effect.cc @@ -1,15 +1,15 @@ // This file is part of the 64k demo project. -// It implements the ParticlesEffectV2. +// It implements the ParticlesEffect. -#include "effects/particles_effect_v2.h" +#include "effects/particles_effect.h" #include "gpu/gpu.h" #include "gpu/shaders.h" #include <vector> -ParticlesEffectV2::ParticlesEffectV2(const GpuContext& ctx, +ParticlesEffect::ParticlesEffect(const GpuContext& ctx, const std::vector<std::string>& inputs, const std::vector<std::string>& outputs) - : EffectV2(ctx, inputs, outputs) { + : Effect(ctx, inputs, outputs) { // Initialize uniforms uniforms_.init(ctx_.device); @@ -59,7 +59,7 @@ ParticlesEffectV2::ParticlesEffectV2(const GpuContext& ctx, render_pass_.instance_count = NUM_PARTICLES; } -void ParticlesEffectV2::render(WGPUCommandEncoder encoder, +void ParticlesEffect::render(WGPUCommandEncoder encoder, const UniformsSequenceParams& params, NodeRegistry& nodes) { // Update uniforms diff --git a/src/effects/particles_effect_v2.h b/src/effects/particles_effect.h index f0f260c..76c2ef4 100644 --- a/src/effects/particles_effect_v2.h +++ b/src/effects/particles_effect.h @@ -1,9 +1,9 @@ // This file is part of the 64k demo project. -// It declares the ParticlesEffectV2. +// It declares the ParticlesEffect. #pragma once -#include "gpu/effect_v2.h" +#include "gpu/effect.h" #include "gpu/gpu.h" #include "gpu/uniform_helper.h" #include <vector> @@ -18,9 +18,9 @@ struct Particle { float color[4]; }; -class ParticlesEffectV2 : public EffectV2 { +class ParticlesEffect : public Effect { public: - ParticlesEffectV2(const GpuContext& ctx, + ParticlesEffect(const GpuContext& ctx, const std::vector<std::string>& inputs, const std::vector<std::string>& outputs); void render(WGPUCommandEncoder encoder, @@ -33,3 +33,4 @@ class ParticlesEffectV2 : public EffectV2 { GpuBuffer particles_buffer_; UniformBuffer<UniformsSequenceParams> uniforms_; }; + diff --git a/src/effects/passthrough_effect_v2.cc b/src/effects/passthrough_effect.cc index 38bb63a..ba98657 100644 --- a/src/effects/passthrough_effect_v2.cc +++ b/src/effects/passthrough_effect.cc @@ -1,13 +1,13 @@ // Passthrough effect v2 implementation -#include "effects/passthrough_effect_v2.h" +#include "effects/passthrough_effect.h" #include "gpu/post_process_helper.h" #include "gpu/shaders.h" -PassthroughEffectV2::PassthroughEffectV2(const GpuContext& ctx, +PassthroughEffect::PassthroughEffect(const GpuContext& ctx, const std::vector<std::string>& inputs, const std::vector<std::string>& outputs) - : EffectV2(ctx, inputs, outputs), pipeline_(nullptr), bind_group_(nullptr), + : Effect(ctx, inputs, outputs), pipeline_(nullptr), bind_group_(nullptr), sampler_(nullptr) { // Init uniform buffer uniforms_buffer_.init(ctx_.device); @@ -27,7 +27,7 @@ PassthroughEffectV2::PassthroughEffectV2(const GpuContext& ctx, sampler_ = wgpuDeviceCreateSampler(ctx_.device, &sampler_desc); } -void PassthroughEffectV2::render(WGPUCommandEncoder encoder, +void PassthroughEffect::render(WGPUCommandEncoder encoder, const UniformsSequenceParams& params, NodeRegistry& nodes) { // Get input/output views diff --git a/src/effects/passthrough_effect_v2.h b/src/effects/passthrough_effect.h index a272b87..125ac5a 100644 --- a/src/effects/passthrough_effect_v2.h +++ b/src/effects/passthrough_effect.h @@ -2,12 +2,12 @@ #pragma once -#include "gpu/effect_v2.h" +#include "gpu/effect.h" #include "gpu/uniform_helper.h" -class PassthroughEffectV2 : public EffectV2 { +class PassthroughEffect : public Effect { public: - PassthroughEffectV2(const GpuContext& ctx, const std::vector<std::string>& inputs, + PassthroughEffect(const GpuContext& ctx, const std::vector<std::string>& inputs, const std::vector<std::string>& outputs); void render(WGPUCommandEncoder encoder, const UniformsSequenceParams& params, diff --git a/src/effects/placeholder_effect_v2.cc b/src/effects/placeholder_effect.cc index d1fa212..d3308de 100644 --- a/src/effects/placeholder_effect_v2.cc +++ b/src/effects/placeholder_effect.cc @@ -1,15 +1,15 @@ // Placeholder effect v2 implementation - logs TODO warning once -#include "effects/placeholder_effect_v2.h" +#include "effects/placeholder_effect.h" #include "gpu/post_process_helper.h" #include "gpu/shaders.h" #include <cstdio> -PlaceholderEffectV2::PlaceholderEffectV2(const GpuContext& ctx, +PlaceholderEffect::PlaceholderEffect(const GpuContext& ctx, const std::vector<std::string>& inputs, const std::vector<std::string>& outputs, const char* placeholder_name) - : EffectV2(ctx, inputs, outputs), pipeline_(nullptr), bind_group_(nullptr), + : Effect(ctx, inputs, outputs), pipeline_(nullptr), bind_group_(nullptr), sampler_(nullptr), name_(placeholder_name) { // Log once on construction fprintf(stderr, "TODO: %s not yet ported to v2, using passthrough\n", name_); @@ -29,7 +29,7 @@ PlaceholderEffectV2::PlaceholderEffectV2(const GpuContext& ctx, sampler_ = wgpuDeviceCreateSampler(ctx_.device, &sampler_desc); } -void PlaceholderEffectV2::render(WGPUCommandEncoder encoder, +void PlaceholderEffect::render(WGPUCommandEncoder encoder, const UniformsSequenceParams& params, NodeRegistry& nodes) { WGPUTextureView input_view = nodes.get_view(input_nodes_[0]); diff --git a/src/effects/placeholder_effect_v2.h b/src/effects/placeholder_effect.h index aa9ed75..f7917ab 100644 --- a/src/effects/placeholder_effect_v2.h +++ b/src/effects/placeholder_effect.h @@ -3,12 +3,12 @@ #pragma once -#include "gpu/effect_v2.h" +#include "gpu/effect.h" #include "gpu/uniform_helper.h" -class PlaceholderEffectV2 : public EffectV2 { +class PlaceholderEffect : public Effect { public: - PlaceholderEffectV2(const GpuContext& ctx, const std::vector<std::string>& inputs, + PlaceholderEffect(const GpuContext& ctx, const std::vector<std::string>& inputs, const std::vector<std::string>& outputs, const char* placeholder_name = "UnknownEffect"); @@ -22,3 +22,4 @@ class PlaceholderEffectV2 : public EffectV2 { UniformBuffer<UniformsSequenceParams> uniforms_buffer_; const char* name_; }; + diff --git a/src/effects/rotating_cube_effect_v2.cc b/src/effects/rotating_cube_effect.cc index 1a28cad..3f1d445 100644 --- a/src/effects/rotating_cube_effect_v2.cc +++ b/src/effects/rotating_cube_effect.cc @@ -1,15 +1,15 @@ // This file is part of the 64k demo project. -// It implements RotatingCubeEffectV2 (simplified v2 port). +// It implements RotatingCubeEffect (simplified v2 port). -#include "effects/rotating_cube_effect_v2.h" +#include "effects/rotating_cube_effect.h" #include "gpu/bind_group_builder.h" #include "gpu/gpu.h" #include "gpu/shaders.h" -RotatingCubeEffectV2::RotatingCubeEffectV2(const GpuContext& ctx, +RotatingCubeEffect::RotatingCubeEffect(const GpuContext& ctx, const std::vector<std::string>& inputs, const std::vector<std::string>& outputs) - : EffectV2(ctx, inputs, outputs), depth_node_(outputs[0] + "_depth") { + : Effect(ctx, inputs, outputs), depth_node_(outputs[0] + "_depth") { // Create uniform buffers uniform_buffer_ = gpu_create_buffer(ctx_.device, sizeof(Uniforms), @@ -96,19 +96,19 @@ RotatingCubeEffectV2::RotatingCubeEffectV2(const GpuContext& ctx, wgpuBindGroupLayoutRelease(bgl); } -RotatingCubeEffectV2::~RotatingCubeEffectV2() { +RotatingCubeEffect::~RotatingCubeEffect() { if (bind_group_) wgpuBindGroupRelease(bind_group_); if (pipeline_) wgpuRenderPipelineRelease(pipeline_); } -void RotatingCubeEffectV2::declare_nodes(NodeRegistry& registry) { +void RotatingCubeEffect::declare_nodes(NodeRegistry& registry) { // Declare depth buffer node registry.declare_node(depth_node_, NodeType::DEPTH24, -1, -1); } -void RotatingCubeEffectV2::render(WGPUCommandEncoder encoder, +void RotatingCubeEffect::render(WGPUCommandEncoder encoder, const UniformsSequenceParams& params, NodeRegistry& nodes) { rotation_ += 0.016f * 1.5f; diff --git a/src/effects/rotating_cube_effect_v2.h b/src/effects/rotating_cube_effect.h index 19ef410..1c0155a 100644 --- a/src/effects/rotating_cube_effect_v2.h +++ b/src/effects/rotating_cube_effect.h @@ -1,19 +1,19 @@ // This file is part of the 64k demo project. -// It declares RotatingCubeEffectV2 (simplified v2 port). +// It declares RotatingCubeEffect (simplified v2 port). #pragma once -#include "gpu/effect_v2.h" +#include "gpu/effect.h" #include "gpu/gpu.h" #include "gpu/uniform_helper.h" #include "util/mini_math.h" -class RotatingCubeEffectV2 : public EffectV2 { +class RotatingCubeEffect : public Effect { public: - RotatingCubeEffectV2(const GpuContext& ctx, + RotatingCubeEffect(const GpuContext& ctx, const std::vector<std::string>& inputs, const std::vector<std::string>& outputs); - ~RotatingCubeEffectV2() override; + ~RotatingCubeEffect() override; void declare_nodes(NodeRegistry& registry) override; void render(WGPUCommandEncoder encoder, diff --git a/src/gpu/demo_effects.h b/src/gpu/demo_effects.h index beccd46..b837ffe 100644 --- a/src/gpu/demo_effects.h +++ b/src/gpu/demo_effects.h @@ -9,21 +9,21 @@ #include "3d/scene.h" // Base effect classes (v2) -#include "gpu/effect_v2.h" +#include "gpu/effect.h" #include "gpu/post_process_helper.h" -#include "gpu/sequence_v2.h" +#include "gpu/sequence.h" #include "gpu/shaders.h" #include "gpu/texture_manager.h" #include "gpu/uniform_helper.h" // Individual Effect Headers (v2) -#include "effects/gaussian_blur_effect_v2.h" -#include "effects/heptagon_effect_v2.h" -#include "effects/hybrid3_d_effect_v2.h" -#include "effects/particles_effect_v2.h" -#include "effects/passthrough_effect_v2.h" -#include "effects/placeholder_effect_v2.h" -#include "effects/rotating_cube_effect_v2.h" +#include "effects/gaussian_blur_effect.h" +#include "effects/heptagon_effect.h" +#include "effects/hybrid3_d_effect.h" +#include "effects/particles_effect.h" +#include "effects/passthrough_effect.h" +#include "effects/placeholder_effect.h" +#include "effects/rotating_cube_effect.h" // TODO: Port CNN effects to v2 // #include "../../cnn_v1/src/cnn_v1_effect.h" // #include "../../cnn_v2/src/cnn_v2_effect.h" @@ -31,7 +31,7 @@ #include <memory> // Auto-generated functions from sequence compiler v2 -// See generated/timeline_v2.h for: +// See generated/timeline.h for: // - InitializeV2Sequences() // - GetActiveV2Sequence() // - RenderV2Timeline() diff --git a/src/gpu/effect_v2.cc b/src/gpu/effect.cc index 7ecdfbd..e4d3a90 100644 --- a/src/gpu/effect_v2.cc +++ b/src/gpu/effect.cc @@ -1,9 +1,9 @@ -// EffectV2 implementation +// Effect implementation -#include "gpu/effect_v2.h" +#include "gpu/effect.h" #include "util/fatal_error.h" -EffectV2::EffectV2(const GpuContext& ctx, const std::vector<std::string>& inputs, +Effect::Effect(const GpuContext& ctx, const std::vector<std::string>& inputs, const std::vector<std::string>& outputs) : ctx_(ctx), input_nodes_(inputs), output_nodes_(outputs) { FATAL_CHECK(!inputs.empty(), "Effect must have at least one input\n"); diff --git a/src/gpu/effect_v2.h b/src/gpu/effect.h index 0d4e18d..d40e750 100644 --- a/src/gpu/effect_v2.h +++ b/src/gpu/effect.h @@ -1,19 +1,21 @@ -// EffectV2: Base class for v2 effects with multi-input/multi-output support +// Effect: Base class for effects with multi-input/multi-output support +#ifndef EFFECT_H +#define EFFECT_H #pragma once #include "gpu/gpu.h" -#include "gpu/sequence_v2.h" +#include "gpu/sequence.h" #include <string> #include <vector> class NodeRegistry; -class EffectV2 { +class Effect { public: - EffectV2(const GpuContext& ctx, const std::vector<std::string>& inputs, - const std::vector<std::string>& outputs); - virtual ~EffectV2() = default; + Effect(const GpuContext& ctx, const std::vector<std::string>& inputs, + const std::vector<std::string>& outputs); + virtual ~Effect() = default; // Optional: Declare temporary nodes (e.g., multi-pass intermediate buffers) virtual void declare_nodes(NodeRegistry& registry) { @@ -45,3 +47,4 @@ class EffectV2 { int width_ = 1280; int height_ = 720; }; +#endif // EFFECT_H diff --git a/src/gpu/gpu.cc b/src/gpu/gpu.cc index 647833c..805e555 100644 --- a/src/gpu/gpu.cc +++ b/src/gpu/gpu.cc @@ -3,7 +3,7 @@ // Driven by audio peaks for synchronized visual effects. #include "gpu.h" -#include "generated/timeline_v2.h" +#include "generated/timeline.h" #include "gpu/shader_composer.h" #include "gpu/shaders.h" #include "platform/platform.h" diff --git a/src/gpu/sequence_v2.cc b/src/gpu/sequence.cc index 3912849..d0a925f 100644 --- a/src/gpu/sequence_v2.cc +++ b/src/gpu/sequence.cc @@ -1,7 +1,7 @@ -// Sequence v2 implementation +// Sequence implementation -#include "gpu/sequence_v2.h" -#include "gpu/effect_v2.h" +#include "gpu/sequence.h" +#include "gpu/effect.h" #include "util/fatal_error.h" #include <algorithm> @@ -183,15 +183,15 @@ void NodeRegistry::create_texture(Node& node) { FATAL_CHECK(node.view != nullptr, "Failed to create texture view\n"); } -// SequenceV2 implementation +// Sequence implementation -SequenceV2::SequenceV2(const GpuContext& ctx, int width, int height) +Sequence::Sequence(const GpuContext& ctx, int width, int height) : ctx_(ctx), width_(width), height_(height), nodes_(ctx.device, width, height) { uniforms_buffer_.init(ctx.device); } -void SequenceV2::preprocess(float seq_time, float beat_time, float beat_phase, +void Sequence::preprocess(float seq_time, float beat_time, float beat_phase, float audio_intensity) { params_.resolution = {static_cast<float>(width_), static_cast<float>(height_)}; params_.aspect_ratio = @@ -205,19 +205,19 @@ void SequenceV2::preprocess(float seq_time, float beat_time, float beat_phase, uniforms_buffer_.update(ctx_.queue, params_); } -void SequenceV2::postprocess(WGPUCommandEncoder encoder) { +void Sequence::postprocess(WGPUCommandEncoder encoder) { (void)encoder; // Default: No-op (last effect writes to sink directly) } -void SequenceV2::render_effects(WGPUCommandEncoder encoder) { +void Sequence::render_effects(WGPUCommandEncoder encoder) { // Execute DAG in topological order (pre-sorted by compiler) for (const auto& dag_node : effect_dag_) { dag_node.effect->render(encoder, params_, nodes_); } } -void SequenceV2::resize(int width, int height) { +void Sequence::resize(int width, int height) { width_ = width; height_ = height; nodes_.resize(width, height); @@ -228,7 +228,7 @@ void SequenceV2::resize(int width, int height) { } } -void SequenceV2::init_effect_nodes() { +void Sequence::init_effect_nodes() { for (auto& dag_node : effect_dag_) { dag_node.effect->declare_nodes(nodes_); } diff --git a/src/gpu/sequence_v2.h b/src/gpu/sequence.h index 2197a82..a33dedb 100644 --- a/src/gpu/sequence_v2.h +++ b/src/gpu/sequence.h @@ -1,6 +1,8 @@ -// Sequence v2: Explicit node system with DAG effect routing -// Replaces implicit framebuffer ping-pong with compile-time optimized nodes +// Sequence: Explicit node system with DAG effect routing +// DAG-based effect routing with ping-pong optimization +#ifndef SEQUENCE_H +#define SEQUENCE_H #pragma once #include "gpu/gpu.h" @@ -11,7 +13,7 @@ #include <string> #include <vector> -class EffectV2; +class Effect; enum class NodeType { U8X4_NORM, // RGBAu8 normalized (0-1) - default Source/Sink @@ -80,16 +82,16 @@ class NodeRegistry { }; struct EffectDAGNode { - std::shared_ptr<EffectV2> effect; + std::shared_ptr<Effect> effect; std::vector<std::string> input_nodes; std::vector<std::string> output_nodes; int execution_order; // Topologically sorted }; -class SequenceV2 { +class Sequence { public: - SequenceV2(const GpuContext& ctx, int width, int height); - virtual ~SequenceV2() = default; + Sequence(const GpuContext& ctx, int width, int height); + virtual ~Sequence() = default; // Virtual methods (most sequences use defaults) virtual void preprocess(float seq_time, float beat_time, float beat_phase, @@ -126,3 +128,4 @@ class SequenceV2 { UniformsSequenceParams params_; UniformBuffer<UniformsSequenceParams> uniforms_buffer_; }; +#endif // SEQUENCE_H diff --git a/src/tests/gpu/test_demo_effects.cc b/src/tests/gpu/test_demo_effects.cc index 02aee78..7bba831 100644 --- a/src/tests/gpu/test_demo_effects.cc +++ b/src/tests/gpu/test_demo_effects.cc @@ -14,7 +14,7 @@ #include <vector> // Helper: Test v2 effect construction -static int test_effect_v2(const char* name, std::shared_ptr<EffectV2> effect) { +static int test_effect(const char* name, std::shared_ptr<Effect> effect) { fprintf(stdout, " Testing %s...\n", name); if (!effect) { @@ -27,7 +27,7 @@ static int test_effect_v2(const char* name, std::shared_ptr<EffectV2> effect) { } // Test all available v2 effects -static void test_v2_effects() { +static void test_effects() { fprintf(stdout, "Testing V2 effects...\n"); WebGPUTestFixture fixture; @@ -36,40 +36,40 @@ static void test_v2_effects() { return; } - std::vector<std::pair<const char*, std::shared_ptr<EffectV2>>> effects = { - {"PassthroughEffectV2", - std::make_shared<PassthroughEffectV2>( + std::vector<std::pair<const char*, std::shared_ptr<Effect>>> effects = { + {"PassthroughEffect", + std::make_shared<PassthroughEffect>( fixture.ctx(), std::vector<std::string>{"source"}, std::vector<std::string>{"sink"})}, - {"GaussianBlurEffectV2", - std::make_shared<GaussianBlurEffectV2>( + {"GaussianBlurEffect", + std::make_shared<GaussianBlurEffect>( fixture.ctx(), std::vector<std::string>{"source"}, std::vector<std::string>{"sink"})}, - {"PlaceholderEffectV2", - std::make_shared<PlaceholderEffectV2>( + {"PlaceholderEffect", + std::make_shared<PlaceholderEffect>( fixture.ctx(), std::vector<std::string>{"source"}, std::vector<std::string>{"sink"})}, - {"HeptagonEffectV2", - std::make_shared<HeptagonEffectV2>( + {"HeptagonEffect", + std::make_shared<HeptagonEffect>( fixture.ctx(), std::vector<std::string>{"source"}, std::vector<std::string>{"sink"})}, - {"ParticlesEffectV2", - std::make_shared<ParticlesEffectV2>( + {"ParticlesEffect", + std::make_shared<ParticlesEffect>( fixture.ctx(), std::vector<std::string>{"source"}, std::vector<std::string>{"sink"})}, - {"RotatingCubeEffectV2", - std::make_shared<RotatingCubeEffectV2>( + {"RotatingCubeEffect", + std::make_shared<RotatingCubeEffect>( fixture.ctx(), std::vector<std::string>{"source"}, std::vector<std::string>{"sink"})}, - {"Hybrid3DEffectV2", - std::make_shared<Hybrid3DEffectV2>( + {"Hybrid3DEffect", + std::make_shared<Hybrid3DEffect>( fixture.ctx(), std::vector<std::string>{"source"}, std::vector<std::string>{"sink"})}, }; int passed = 0; for (const auto& [name, effect] : effects) { - passed += test_effect_v2(name, effect); + passed += test_effect(name, effect); } fprintf(stdout, " ✓ %d/%zu V2 effects tested\n", passed, effects.size()); @@ -81,7 +81,7 @@ int main() { extern void InitShaderComposer(); InitShaderComposer(); - test_v2_effects(); + test_effects(); fprintf(stdout, "=== All Tests Passed ===\n"); return 0; diff --git a/src/tests/gpu/test_effect_base.cc b/src/tests/gpu/test_effect_base.cc index ddccad4..8b0e6b2 100644 --- a/src/tests/gpu/test_effect_base.cc +++ b/src/tests/gpu/test_effect_base.cc @@ -1,13 +1,13 @@ // This file is part of the 64k demo project. -// It tests the EffectV2/SequenceV2 lifecycle using headless rendering. +// It tests the Effect/Sequence lifecycle using headless rendering. // Verifies effect initialization and basic rendering. #include "../common/effect_test_helpers.h" #include "../common/offscreen_render_target.h" #include "../common/webgpu_test_fixture.h" -#include "effects/passthrough_effect_v2.h" -#include "gpu/effect_v2.h" -#include "gpu/sequence_v2.h" +#include "effects/passthrough_effect.h" +#include "gpu/effect.h" +#include "gpu/sequence.h" #include <cassert> #include <cstdio> #include <memory> @@ -80,19 +80,19 @@ static void test_effect_construction() { return; } - // Create PassthroughEffectV2 (simple effect) - auto effect = std::make_shared<PassthroughEffectV2>( + // Create PassthroughEffect (simple effect) + auto effect = std::make_shared<PassthroughEffect>( fixture.ctx(), std::vector<std::string>{"source"}, std::vector<std::string>{"sink"}); assert(effect != nullptr && "Effect should be constructed"); - fprintf(stdout, " ✓ PassthroughEffectV2 constructed\n"); + fprintf(stdout, " ✓ PassthroughEffect constructed\n"); } // Test 4: Effect added to sequence DAG static void test_effect_in_sequence() { - fprintf(stdout, "Testing effect in SequenceV2 DAG...\n"); + fprintf(stdout, "Testing effect in Sequence DAG...\n"); WebGPUTestFixture fixture; if (!fixture.init()) { @@ -101,10 +101,10 @@ static void test_effect_in_sequence() { } // Create minimal sequence with one effect - class TestSequence : public SequenceV2 { + class TestSequence : public Sequence { public: - TestSequence(const GpuContext& ctx, int w, int h) : SequenceV2(ctx, w, h) { - auto effect = std::make_shared<PassthroughEffectV2>( + TestSequence(const GpuContext& ctx, int w, int h) : Sequence(ctx, w, h) { + auto effect = std::make_shared<PassthroughEffect>( ctx, std::vector<std::string>{"source"}, std::vector<std::string>{"sink"}); @@ -133,10 +133,10 @@ static void test_sequence_render() { OffscreenRenderTarget target(fixture.instance(), fixture.device(), 256, 256); - class TestSequence : public SequenceV2 { + class TestSequence : public Sequence { public: - TestSequence(const GpuContext& ctx, int w, int h) : SequenceV2(ctx, w, h) { - auto effect = std::make_shared<PassthroughEffectV2>( + TestSequence(const GpuContext& ctx, int w, int h) : Sequence(ctx, w, h) { + auto effect = std::make_shared<PassthroughEffect>( ctx, std::vector<std::string>{"source"}, std::vector<std::string>{"sink"}); @@ -176,15 +176,15 @@ static void test_sequence_time_params() { return; } - class TestSequence : public SequenceV2 { + class TestSequence : public Sequence { public: - TestSequence(const GpuContext& ctx, int w, int h) : SequenceV2(ctx, w, h) { + TestSequence(const GpuContext& ctx, int w, int h) : Sequence(ctx, w, h) { init_effect_nodes(); } void preprocess(float seq_time, float beat_time, float beat_phase, float audio_intensity) override { - SequenceV2::preprocess(seq_time, beat_time, beat_phase, audio_intensity); + Sequence::preprocess(seq_time, beat_time, beat_phase, audio_intensity); last_time = seq_time; } diff --git a/src/tests/gpu/test_sequence_v2.cc b/src/tests/gpu/test_sequence.cc index 54b544e..337381a 100644 --- a/src/tests/gpu/test_sequence_v2.cc +++ b/src/tests/gpu/test_sequence.cc @@ -1,18 +1,18 @@ // Test file for Sequence v2 system -// Phase 1: Foundation tests (NodeRegistry, SequenceV2 base class) +// Phase 1: Foundation tests (NodeRegistry, Sequence base class) -#include "gpu/sequence_v2.h" -#include "gpu/effect_v2.h" +#include "gpu/sequence.h" +#include "gpu/effect.h" #include "tests/common/webgpu_test_fixture.h" #include <cassert> #include <cstdio> // Simple test effect for DAG execution -class TestEffectV2 : public EffectV2 { +class TestEffect : public Effect { public: - TestEffectV2(const GpuContext& ctx, const std::vector<std::string>& inputs, + TestEffect(const GpuContext& ctx, const std::vector<std::string>& inputs, const std::vector<std::string>& outputs) - : EffectV2(ctx, inputs, outputs), render_called_(false) { + : Effect(ctx, inputs, outputs), render_called_(false) { } void render(WGPUCommandEncoder encoder, const UniformsSequenceParams& params, @@ -103,7 +103,7 @@ void test_node_registry_multi_output() { printf("PASS: NodeRegistry multi-output views\n"); } -// Test: SequenceV2 default preprocess +// Test: Sequence default preprocess void test_sequence_v2_preprocess() { WebGPUTestFixture fixture; if (!fixture.init()) { @@ -111,16 +111,16 @@ void test_sequence_v2_preprocess() { return; } - SequenceV2 seq(fixture.ctx(), 1280, 720); + Sequence seq(fixture.ctx(), 1280, 720); // Call preprocess with test values seq.preprocess(1.0f, 4.0f, 0.5f, 0.8f); // No crash = success (params updated internally) - printf("PASS: SequenceV2 preprocess\n"); + printf("PASS: Sequence preprocess\n"); } -// Test: SequenceV2 DAG execution +// Test: Sequence DAG execution void test_sequence_v2_dag_execution() { WebGPUTestFixture fixture; if (!fixture.init()) { @@ -129,13 +129,13 @@ void test_sequence_v2_dag_execution() { } // Create sequence - class TestSequence : public SequenceV2 { + class TestSequence : public Sequence { public: TestSequence(const GpuContext& ctx) - : SequenceV2(ctx, 1280, 720), - effect1_(std::make_shared<TestEffectV2>(ctx, std::vector<std::string>{"source"}, + : Sequence(ctx, 1280, 720), + effect1_(std::make_shared<TestEffect>(ctx, std::vector<std::string>{"source"}, std::vector<std::string>{"temp"})), - effect2_(std::make_shared<TestEffectV2>(ctx, std::vector<std::string>{"temp"}, + effect2_(std::make_shared<TestEffect>(ctx, std::vector<std::string>{"temp"}, std::vector<std::string>{"sink"})) { // Build DAG (2 effects in sequence) effect_dag_.push_back( @@ -144,8 +144,8 @@ void test_sequence_v2_dag_execution() { {effect2_, {"temp"}, {"sink"}, 1}); } - std::shared_ptr<TestEffectV2> effect1_; - std::shared_ptr<TestEffectV2> effect2_; + std::shared_ptr<TestEffect> effect1_; + std::shared_ptr<TestEffect> effect2_; }; TestSequence seq(fixture.ctx()); @@ -167,7 +167,7 @@ void test_sequence_v2_dag_execution() { wgpuCommandBufferRelease(cmd); wgpuCommandEncoderRelease(encoder); - printf("PASS: SequenceV2 DAG execution\n"); + printf("PASS: Sequence DAG execution\n"); } int main() { diff --git a/src/tests/gpu/test_sequence_v2_e2e.cc b/src/tests/gpu/test_sequence_e2e.cc index c015e0b..91a8da2 100644 --- a/src/tests/gpu/test_sequence_v2_e2e.cc +++ b/src/tests/gpu/test_sequence_e2e.cc @@ -1,11 +1,11 @@ // End-to-end test for Sequence v2 system // Tests compiler output instantiation and execution -#include "gpu/sequence_v2.h" -#include "gpu/effect_v2.h" -#include "effects/gaussian_blur_effect_v2.h" -#include "effects/heptagon_effect_v2.h" -#include "effects/passthrough_effect_v2.h" +#include "gpu/sequence.h" +#include "gpu/effect.h" +#include "effects/gaussian_blur_effect.h" +#include "effects/heptagon_effect.h" +#include "effects/passthrough_effect.h" #include "gpu/shaders.h" #include "tests/common/webgpu_test_fixture.h" #include <cassert> @@ -13,16 +13,16 @@ // Manually transcribed generated sequence (simulates compiler output) // Simple 2-effect chain to validate DAG execution -class SimpleTestSequence : public SequenceV2 { +class SimpleTestSequence : public Sequence { public: SimpleTestSequence(const GpuContext& ctx, int width, int height) - : SequenceV2(ctx, width, height) { + : Sequence(ctx, width, height) { // Node declarations (source/sink already created by NodeRegistry) nodes_.declare_node("temp", NodeType::U8X4_NORM, width_, height_); // Effect DAG construction (2 effects: source->temp->sink) effect_dag_.push_back({ - .effect = std::make_shared<PassthroughEffectV2>(ctx, + .effect = std::make_shared<PassthroughEffect>(ctx, std::vector<std::string>{"source"}, std::vector<std::string>{"temp"}), .input_nodes = {"source"}, @@ -30,7 +30,7 @@ class SimpleTestSequence : public SequenceV2 { .execution_order = 0 }); effect_dag_.push_back({ - .effect = std::make_shared<PassthroughEffectV2>(ctx, + .effect = std::make_shared<PassthroughEffect>(ctx, std::vector<std::string>{"temp"}, std::vector<std::string>{"sink"}), .input_nodes = {"temp"}, |
