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 /tools | |
| 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 'tools')
| -rwxr-xr-x | tools/seq_compiler.py (renamed from tools/seq_compiler_v2.py) | 76 | ||||
| -rw-r--r-- | tools/test_demo.seq | 2 |
2 files changed, 35 insertions, 43 deletions
diff --git a/tools/seq_compiler_v2.py b/tools/seq_compiler.py index f835295..6b72ebd 100755 --- a/tools/seq_compiler_v2.py +++ b/tools/seq_compiler.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 -"""Sequence v2 Compiler - DAG-based timeline compiler with ping-pong optimization. +"""Sequence Compiler - DAG-based timeline compiler with ping-pong optimization. -Converts v2 timeline syntax into optimized C++ SequenceV2 subclasses. +Converts timeline syntax into optimized C++ Sequence subclasses. Performs DAG validation, topological sorting, and lifetime analysis. """ @@ -47,7 +47,7 @@ class SequenceDecl: self.effects: List[EffectDecl] = [] def parse_timeline(filename: str) -> List[SequenceDecl]: - """Parse v2 timeline file.""" + """Parse timeline file.""" sequences = [] current_seq = None @@ -364,7 +364,7 @@ def detect_ping_pong(seq: SequenceDecl, sorted_effects: List[EffectDecl]) -> Dic def generate_cpp(seq: SequenceDecl, sorted_effects: List[EffectDecl], aliases: Dict[str, str], flatten: bool = False) -> str: - """Generate C++ SequenceV2 subclass.""" + """Generate C++ Sequence subclass.""" class_name = seq.name.replace(' ', '_').replace('-', '_') if not class_name[0].isalpha(): @@ -375,31 +375,26 @@ def generate_cpp(seq: SequenceDecl, sorted_effects: List[EffectDecl], includes = set() for effect in seq.effects: # Convert ClassName to snake_case header - # Remove V2 suffix first if present - base_name = effect.class_name - if base_name.endswith('V2'): - base_name = base_name[:-2] - - header = re.sub('([A-Z])', r'_\1', base_name).lower().lstrip('_') + header = re.sub('([A-Z])', r'_\1', effect.class_name).lower().lstrip('_') if header.endswith('_effect'): header = header[:-7] # Remove _effect suffix - includes.add(f'#include "effects/{header}_effect_v2.h"') + includes.add(f'#include "effects/{header}_effect.h"') - cpp = f'''// Generated by seq_compiler_v2.py + cpp = f'''// Generated by seq_compiler.py // Sequence: {seq.name} -#include "gpu/sequence_v2.h" -#include "gpu/effect_v2.h" +#include "gpu/sequence.h" +#include "gpu/effect.h" ''' for inc in sorted(includes): cpp += inc + '\n' cpp += f''' -class {class_name} : public SequenceV2 {{ +class {class_name} : public Sequence {{ public: {class_name}(const GpuContext& ctx, int width, int height) - : SequenceV2(ctx, width, height) {{ + : Sequence(ctx, width, height) {{ ''' # Node declarations @@ -419,11 +414,8 @@ class {class_name} : public SequenceV2 {{ inputs_str = ', '.join(f'"{inp}"' for inp in effect.inputs) outputs_str = ', '.join(f'"{out}"' for out in effect.outputs) - # Ensure class name has V2 suffix (add if not present) - effect_class = effect.class_name if effect.class_name.endswith('V2') else effect.class_name + 'V2' - cpp += f''' effect_dag_.push_back({{ - .effect = std::make_shared<{effect_class}>(ctx, + .effect = std::make_shared<{effect.class_name}>(ctx, std::vector<std::string>{{{inputs_str}}}, std::vector<std::string>{{{outputs_str}}}), .input_nodes = {{{inputs_str}}}, @@ -440,7 +432,7 @@ class {class_name} : public SequenceV2 {{ return cpp def main(): - parser = argparse.ArgumentParser(description='Sequence v2 compiler with DAG optimization') + parser = argparse.ArgumentParser(description='Sequence compiler with DAG optimization') parser.add_argument('input', help='Input .seq file') parser.add_argument('--output', '-o', help='Output .cc file', required=True) parser.add_argument('--flatten', action='store_true', help='Generate flattened code (FINAL_STRIP mode)') @@ -455,11 +447,11 @@ def main(): sys.exit(1) # Process each sequence - all_cpp = '''// Generated by seq_compiler_v2.py + all_cpp = '''// Generated by seq_compiler.py // DO NOT EDIT -#include "gpu/sequence_v2.h" -#include "gpu/effect_v2.h" +#include "gpu/sequence.h" +#include "gpu/effect.h" ''' @@ -482,37 +474,37 @@ def main(): # Generate sequence registry and accessors all_cpp += ''' -// V2 Sequence Registry +// Sequence Registry #include <vector> #include <memory> -struct SequenceV2Entry { +struct SequenceEntry { float start_time; int priority; - std::unique_ptr<SequenceV2> sequence; + std::unique_ptr<Sequence> sequence; }; -static std::vector<SequenceV2Entry> g_v2_sequences; -static bool g_v2_initialized = false; +static std::vector<SequenceEntry> g_sequences; +static bool g_initialized = false; -void InitializeV2Sequences(const GpuContext& ctx, int width, int height) { - if (g_v2_initialized) return; - g_v2_initialized = true; +void InitializeSequences(const GpuContext& ctx, int width, int height) { + if (g_initialized) return; + g_initialized = true; ''' # Instantiate each sequence for seq in sequences: class_name = f"{seq.name}Sequence" - all_cpp += f' g_v2_sequences.push_back({{{seq.start_time}f, {seq.priority}, std::make_unique<{class_name}>(ctx, width, height)}});\n' + all_cpp += f' g_sequences.push_back({{{seq.start_time}f, {seq.priority}, std::make_unique<{class_name}>(ctx, width, height)}});\n' all_cpp += ''' } -SequenceV2* GetActiveV2Sequence(float time) { +Sequence* GetActiveSequence(float time) { // Find active sequence (latest start_time <= current time) - SequenceV2* active = nullptr; - for (auto& entry : g_v2_sequences) { + Sequence* active = nullptr; + for (auto& entry : g_sequences) { if (entry.start_time <= time) { active = entry.sequence.get(); } @@ -520,9 +512,9 @@ SequenceV2* GetActiveV2Sequence(float time) { return active; } -void RenderV2Timeline(WGPUCommandEncoder encoder, float time, int width, int height, +void RenderTimeline(WGPUCommandEncoder encoder, float time, int width, int height, float beat_time, float audio_intensity) { - SequenceV2* seq = GetActiveV2Sequence(time); + Sequence* seq = GetActiveSequence(time); if (seq) { seq->preprocess(time, beat_time, 0.0f, audio_intensity); seq->render_effects(encoder); @@ -530,7 +522,7 @@ void RenderV2Timeline(WGPUCommandEncoder encoder, float time, int width, int hei } float GetDemoDuration() { - return 40.0f; // TODO: Calculate from v2 sequences + return 40.0f; // TODO: Calculate from sequences } // Surface-based rendering with framebuffers @@ -574,9 +566,9 @@ static void ensure_framebuffers(WGPUDevice device, int width, int height) { g_fb_height = height; } -void RenderV2Timeline(WGPUSurface surface, float time, int width, int height, +void RenderTimeline(WGPUSurface surface, float time, int width, int height, float beat_time, float audio_intensity) { - SequenceV2* seq = GetActiveV2Sequence(time); + Sequence* seq = GetActiveSequence(time); if (!seq) return; const GpuContext* ctx = gpu_get_context(); @@ -642,7 +634,7 @@ void RenderV2Timeline(WGPUSurface surface, float time, int width, int height, if (!blit_pipeline) { blit_pipeline = create_post_process_pipeline(ctx->device, - ctx->format, passthrough_v2_shader_wgsl); + ctx->format, passthrough_shader_wgsl); } // Update blit uniforms diff --git a/tools/test_demo.seq b/tools/test_demo.seq index fa4dae8..da5d064 100644 --- a/tools/test_demo.seq +++ b/tools/test_demo.seq @@ -2,4 +2,4 @@ # BPM 120 (set in test_demo.track) SEQUENCE 0.0 0 "test_loop" - EFFECT + HeptagonEffectV2 source -> sink 0.0 16.0 + EFFECT + HeptagonEffect source -> sink 0.0 16.0 |
