diff options
| -rw-r--r-- | PROJECT_CONTEXT.md | 6 | ||||
| -rw-r--r-- | TODO.md | 4 | ||||
| -rw-r--r-- | cmake/DemoCodegen.cmake | 8 | ||||
| -rw-r--r-- | cmake/DemoExecutables.cmake | 8 | ||||
| -rw-r--r-- | cmake/DemoSourceLists.cmake | 18 | ||||
| -rw-r--r-- | cmake/DemoTests.cmake | 29 | ||||
| -rw-r--r-- | cmake/DemoTools.cmake | 6 | ||||
| -rw-r--r-- | cmake/Validation.cmake | 14 | ||||
| -rw-r--r-- | common/shaders/combined_postprocess.wgsl (renamed from common/shaders/combined_postprocess_v2.wgsl) | 2 | ||||
| -rw-r--r-- | common/shaders/gaussian_blur.wgsl (renamed from common/shaders/gaussian_blur_v2.wgsl) | 2 | ||||
| -rw-r--r-- | common/shaders/heptagon.wgsl (renamed from common/shaders/heptagon_v2.wgsl) | 2 | ||||
| -rw-r--r-- | common/shaders/passthrough.wgsl | 32 | ||||
| -rw-r--r-- | common/shaders/passthrough_v2.wgsl | 24 | ||||
| -rw-r--r-- | common/shaders/sequence_uniforms.wgsl (renamed from common/shaders/sequence_v2_uniforms.wgsl) | 0 | ||||
| -rw-r--r-- | doc/EFFECT_WORKFLOW.md | 68 | ||||
| -rw-r--r-- | doc/SEQUENCE.md (renamed from doc/SEQUENCE_v2.md) | 52 | ||||
| -rw-r--r-- | doc/archive/timeline_v1.seq | 97 | ||||
| -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 | ||||
| -rwxr-xr-x | tools/seq_compiler.py (renamed from tools/seq_compiler_v2.py) | 76 | ||||
| -rw-r--r-- | tools/test_demo.seq | 2 | ||||
| -rw-r--r-- | workspaces/main/assets.txt | 16 | ||||
| -rw-r--r-- | workspaces/main/shaders/particle_compute.wgsl | 5 | ||||
| -rw-r--r-- | workspaces/main/shaders/particle_compute_v2.wgsl | 31 | ||||
| -rw-r--r-- | workspaces/main/shaders/particle_render.wgsl | 5 | ||||
| -rw-r--r-- | workspaces/main/shaders/particle_render_v2.wgsl | 53 | ||||
| -rw-r--r-- | workspaces/main/shaders/rotating_cube.wgsl (renamed from workspaces/main/shaders/rotating_cube_v2.wgsl) | 0 | ||||
| -rw-r--r-- | workspaces/main/timeline.seq | 124 | ||||
| -rw-r--r-- | workspaces/main/timeline_v2.seq | 45 | ||||
| -rw-r--r-- | workspaces/main/workspace.cfg | 2 | ||||
| -rw-r--r-- | workspaces/test/assets.txt | 10 |
55 files changed, 496 insertions, 593 deletions
diff --git a/PROJECT_CONTEXT.md b/PROJECT_CONTEXT.md index f4bde1a..e8071c3 100644 --- a/PROJECT_CONTEXT.md +++ b/PROJECT_CONTEXT.md @@ -39,8 +39,8 @@ - **Effects:** CNN post-processing: CNNEffect (v1) and CNNv2Effect operational. CNN v2: sigmoid activation, storage buffer weights (~3.2 KB), 7D static features, dynamic layers. Training stable, convergence validated. - **Tools:** CNN test tool operational. Texture readback utility functional. Timeline editor (web-based, beat-aligned, audio playback). - **Build:** Asset dependency tracking. Size measurement. Hot-reload (debug-only). -- **Sequence v2:** DAG-based effect routing with explicit node system. Python compiler with topological sort and ping-pong optimization. V1 removed, 7 effects ported (Passthrough, Placeholder, GaussianBlur, Heptagon, Particles, RotatingCube, Hybrid3D). See `doc/SEQUENCE_v2.md`. -- **Testing:** **35/35 passing** (all v2 tests operational) +- **Sequence:** DAG-based effect routing with explicit node system. Python compiler with topological sort and ping-pong optimization. 7 effects operational (Passthrough, Placeholder, GaussianBlur, Heptagon, Particles, RotatingCube, Hybrid3D). See `doc/SEQUENCE.md`. +- **Testing:** **35/35 passing** --- @@ -58,7 +58,7 @@ See `TODO.md` for current priorities and active tasks. - `doc/CONTRIBUTING.md` - Development protocols **Technical Reference:** -- Core: `ASSET_SYSTEM.md`, `SEQUENCE_v2.md`, `TRACKER.md`, `3D.md`, `cnn_v1/docs/CNN_V1_EFFECT.md`, `cnn_v2/docs/CNN_V2.md` +- Core: `ASSET_SYSTEM.md`, `SEQUENCE.md`, `TRACKER.md`, `3D.md`, `cnn_v1/docs/CNN_V1_EFFECT.md`, `cnn_v2/docs/CNN_V2.md` - Formats: `SCENE_FORMAT.md`, `MASKING_SYSTEM.md` - Tools: `BUILD.md`, `WORKSPACE_SYSTEM.md`, `SIZE_MEASUREMENT.md`, `cnn_v1/docs/CNN_TEST_TOOL.md`, `tools/timeline_editor/README.md` @@ -56,9 +56,9 @@ Enhanced CNN post-processing with multi-dimensional feature inputs. - All other tests validate the same functionality - Issue: Hangs/crashes during render with external sink view -2. **test_sequence.cc** - Port v1 sequence tests to v2 (currently disabled) +2. **test_sequence.cc** - Port legacy sequence tests (currently disabled) - Uses legacy Effect/MainSequence system - - Lines 168, 173, 182: Re-enable lifecycle and simulation tests after v2 port + - Lines 168, 173, 182: Re-enable lifecycle and simulation tests after port 3. **test_audio_engine.cc:152** - Re-enable commented test after debugging diff --git a/cmake/DemoCodegen.cmake b/cmake/DemoCodegen.cmake index e84e17b..1e0badf 100644 --- a/cmake/DemoCodegen.cmake +++ b/cmake/DemoCodegen.cmake @@ -119,16 +119,16 @@ endfunction() # Generation Targets # ============================================================================= -# Timeline compilation (v2) +# Timeline compilation set(DEMO_SEQ_PATH ${WORKSPACE_TIMELINE}) set(GENERATED_TIMELINE_CC ${CMAKE_CURRENT_SOURCE_DIR}/src/generated/timeline.cc) add_custom_command( OUTPUT ${GENERATED_TIMELINE_CC} COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_SOURCE_DIR}/src/generated - COMMAND ${SEQ_COMPILER_V2_CMD} ${DEMO_SEQ_PATH} --output ${GENERATED_TIMELINE_CC} - DEPENDS ${SEQ_COMPILER_V2_DEPENDS} ${DEMO_SEQ_PATH} + COMMAND ${SEQ_COMPILER_CMD} ${DEMO_SEQ_PATH} --output ${GENERATED_TIMELINE_CC} + DEPENDS ${SEQ_COMPILER_DEPENDS} ${DEMO_SEQ_PATH} src/gpu/demo_effects.h - COMMENT "Compiling v2 demo sequence from workspace ${DEMO_WORKSPACE}..." + COMMENT "Compiling demo sequence from workspace ${DEMO_WORKSPACE}..." ) add_custom_target(generate_timeline ALL DEPENDS ${GENERATED_TIMELINE_CC}) diff --git a/cmake/DemoExecutables.cmake b/cmake/DemoExecutables.cmake index 5131936..69e4a30 100644 --- a/cmake/DemoExecutables.cmake +++ b/cmake/DemoExecutables.cmake @@ -47,16 +47,16 @@ endif() # test_demo - Audio/Visual Sync Tool # ============================================================================= -# Timeline generation (v2) +# Timeline generation set(TEST_DEMO_SEQ_PATH ${CMAKE_CURRENT_SOURCE_DIR}/tools/test_demo.seq) set(GENERATED_TEST_DEMO_TIMELINE_CC ${CMAKE_CURRENT_SOURCE_DIR}/src/generated/test_timeline.cc) add_custom_command( OUTPUT ${GENERATED_TEST_DEMO_TIMELINE_CC} COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_SOURCE_DIR}/src/generated - COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tools/seq_compiler_v2.py + COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tools/seq_compiler.py ${TEST_DEMO_SEQ_PATH} --output ${GENERATED_TEST_DEMO_TIMELINE_CC} DEPENDS ${TEST_DEMO_SEQ_PATH} - COMMENT "Compiling test_demo sequence (v2)..." + COMMENT "Compiling test_demo sequence..." ) add_custom_target(generate_test_demo_timeline ALL DEPENDS ${GENERATED_TEST_DEMO_TIMELINE_CC}) @@ -75,7 +75,7 @@ add_custom_target(generate_test_demo_music ALL DEPENDS ${GENERATED_TEST_DEMO_MUS # Mark test_demo generated files as GENERATED set_source_files_properties(${GENERATED_TEST_DEMO_TIMELINE_CC} PROPERTIES GENERATED TRUE) set_source_files_properties(${GENERATED_TEST_DEMO_MUSIC_CC} PROPERTIES GENERATED TRUE) -set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/src/generated/test_timeline_v2.h PROPERTIES GENERATED TRUE) +set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/src/generated/test_timeline.h PROPERTIES GENERATED TRUE) # Build executable (uses main demo assets) if(NOT DEMO_STRIP_EXTERNAL_LIBS) diff --git a/cmake/DemoSourceLists.cmake b/cmake/DemoSourceLists.cmake index f142ce1..65f3518 100644 --- a/cmake/DemoSourceLists.cmake +++ b/cmake/DemoSourceLists.cmake @@ -28,15 +28,15 @@ set(UTIL_SOURCES src/util/asset_manager.cc src/util/file_watcher.cc) # Common effect sources (shared between headless and normal modes) set(COMMON_GPU_EFFECTS - src/gpu/sequence_v2.cc - src/gpu/effect_v2.cc - src/effects/passthrough_effect_v2.cc - src/effects/placeholder_effect_v2.cc - src/effects/gaussian_blur_effect_v2.cc - src/effects/heptagon_effect_v2.cc - src/effects/particles_effect_v2.cc - src/effects/rotating_cube_effect_v2.cc - src/effects/hybrid3_d_effect_v2.cc + src/gpu/sequence.cc + src/gpu/effect.cc + src/effects/passthrough_effect.cc + src/effects/placeholder_effect.cc + src/effects/gaussian_blur_effect.cc + src/effects/heptagon_effect.cc + src/effects/particles_effect.cc + src/effects/rotating_cube_effect.cc + src/effects/hybrid3_d_effect.cc # TODO: Port CNN effects to v2 (complex v1 dependencies) # cnn_v1/src/cnn_v1_effect.cc # cnn_v2/src/cnn_v2_effect.cc diff --git a/cmake/DemoTests.cmake b/cmake/DemoTests.cmake index a23202a..b24d9e2 100644 --- a/cmake/DemoTests.cmake +++ b/cmake/DemoTests.cmake @@ -97,10 +97,11 @@ target_link_libraries(test_assets PRIVATE util procedural ${DEMO_LIBS}) demo_add_asset_deps(test_assets test) set_source_files_properties(src/tests/assets/test_assets.cc PROPERTIES COMPILE_DEFINITIONS "USE_TEST_ASSETS") -add_demo_test(test_sequence SequenceSystemTest assets src/tests/assets/test_sequence.cc ${GEN_DEMO_CC} ${GENERATED_TIMELINE_CC} ${PLATFORM_SOURCES}) -target_link_libraries(test_sequence PRIVATE 3d gpu util procedural ${DEMO_LIBS}) -demo_add_asset_deps(test_sequence all) -add_dependencies(test_sequence generate_timeline) +# Disabled: Old v1 sequence system test +# add_demo_test(test_sequence SequenceSystemTest assets src/tests/assets/test_sequence.cc ${GEN_DEMO_CC} ${GENERATED_TIMELINE_CC} ${PLATFORM_SOURCES}) +# target_link_libraries(test_sequence PRIVATE 3d gpu util procedural ${DEMO_LIBS}) +# demo_add_asset_deps(test_sequence all) +# add_dependencies(test_sequence generate_timeline) add_demo_test(test_procedural ProceduralGenTest util src/tests/util/test_procedural.cc) target_link_libraries(test_procedural PRIVATE procedural ${DEMO_LIBS}) @@ -230,23 +231,23 @@ add_demo_test(test_gpu_composite GpuCompositeTest gpu target_link_libraries(test_gpu_composite PRIVATE 3d gpu audio procedural util ${DEMO_LIBS}) demo_add_asset_deps(test_gpu_composite shaders) -# Sequence v2 Test (Foundation) -add_demo_test(test_sequence_v2 SequenceV2Test gpu - src/tests/gpu/test_sequence_v2.cc +# Sequence Test (Foundation) +add_demo_test(test_sequence SequenceTest gpu + src/tests/gpu/test_sequence.cc src/tests/common/webgpu_test_fixture.cc ${PLATFORM_SOURCES} ${GEN_DEMO_CC}) -target_link_libraries(test_sequence_v2 PRIVATE 3d gpu audio procedural util ${DEMO_LIBS}) -demo_add_asset_deps(test_sequence_v2 shaders) +target_link_libraries(test_sequence PRIVATE 3d gpu audio procedural util ${DEMO_LIBS}) +demo_add_asset_deps(test_sequence shaders) -# Sequence v2 End-to-End Test -add_demo_test(test_sequence_v2_e2e SequenceV2E2ETest gpu - src/tests/gpu/test_sequence_v2_e2e.cc +# Sequence End-to-End Test +add_demo_test(test_sequence_e2e SequenceE2ETest gpu + src/tests/gpu/test_sequence_e2e.cc src/tests/common/webgpu_test_fixture.cc ${PLATFORM_SOURCES} ${GEN_DEMO_CC}) -target_link_libraries(test_sequence_v2_e2e PRIVATE 3d gpu audio procedural util ${DEMO_LIBS}) -demo_add_asset_deps(test_sequence_v2_e2e shaders) +target_link_libraries(test_sequence_e2e PRIVATE 3d gpu audio procedural util ${DEMO_LIBS}) +demo_add_asset_deps(test_sequence_e2e shaders) # Subsystem test targets add_custom_target(run_audio_tests diff --git a/cmake/DemoTools.cmake b/cmake/DemoTools.cmake index f3a9470..43c4716 100644 --- a/cmake/DemoTools.cmake +++ b/cmake/DemoTools.cmake @@ -24,9 +24,9 @@ else() endif() # Sequence compiler tool (v2 - Python) -set(SEQ_COMPILER_V2_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/tools/seq_compiler_v2.py) -set(SEQ_COMPILER_V2_CMD ${CMAKE_COMMAND} -E env python3 ${SEQ_COMPILER_V2_SCRIPT}) -set(SEQ_COMPILER_V2_DEPENDS ${SEQ_COMPILER_V2_SCRIPT}) +set(SEQ_COMPILER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/tools/seq_compiler.py) +set(SEQ_COMPILER_CMD ${CMAKE_COMMAND} -E env python3 ${SEQ_COMPILER_SCRIPT}) +set(SEQ_COMPILER_DEPENDS ${SEQ_COMPILER_SCRIPT}) # Tracker compiler tool if(DEFINED TRACKER_COMPILER_PATH) diff --git a/cmake/Validation.cmake b/cmake/Validation.cmake index ee150f4..b4a3784 100644 --- a/cmake/Validation.cmake +++ b/cmake/Validation.cmake @@ -14,13 +14,13 @@ file(GLOB WGSL_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE set(VALIDATION_CPP_FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/gpu/post_process_helper.h ${CMAKE_CURRENT_SOURCE_DIR}/src/gpu/demo_effects.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/effects/heptagon_effect_v2.cc - ${CMAKE_CURRENT_SOURCE_DIR}/src/effects/gaussian_blur_effect_v2.cc - ${CMAKE_CURRENT_SOURCE_DIR}/src/effects/passthrough_effect_v2.cc - ${CMAKE_CURRENT_SOURCE_DIR}/src/effects/placeholder_effect_v2.cc - ${CMAKE_CURRENT_SOURCE_DIR}/src/effects/particles_effect_v2.cc - ${CMAKE_CURRENT_SOURCE_DIR}/src/effects/rotating_cube_effect_v2.cc - ${CMAKE_CURRENT_SOURCE_DIR}/src/effects/hybrid3_d_effect_v2.cc + ${CMAKE_CURRENT_SOURCE_DIR}/src/effects/heptagon_effect.cc + ${CMAKE_CURRENT_SOURCE_DIR}/src/effects/gaussian_blur_effect.cc + ${CMAKE_CURRENT_SOURCE_DIR}/src/effects/passthrough_effect.cc + ${CMAKE_CURRENT_SOURCE_DIR}/src/effects/placeholder_effect.cc + ${CMAKE_CURRENT_SOURCE_DIR}/src/effects/particles_effect.cc + ${CMAKE_CURRENT_SOURCE_DIR}/src/effects/rotating_cube_effect.cc + ${CMAKE_CURRENT_SOURCE_DIR}/src/effects/hybrid3_d_effect.cc ) # Add custom command to run the validator diff --git a/common/shaders/combined_postprocess_v2.wgsl b/common/shaders/combined_postprocess.wgsl index a934dce..ea65761 100644 --- a/common/shaders/combined_postprocess_v2.wgsl +++ b/common/shaders/combined_postprocess.wgsl @@ -1,7 +1,7 @@ // Example: Combined post-process using inline functions // Demonstrates how to chain multiple simple effects without separate classes -#include "sequence_v2_uniforms" +#include "sequence_uniforms" #include "postprocess_inline" @group(0) @binding(0) var input_sampler: sampler; diff --git a/common/shaders/gaussian_blur_v2.wgsl b/common/shaders/gaussian_blur.wgsl index 0f29140..293977f 100644 --- a/common/shaders/gaussian_blur_v2.wgsl +++ b/common/shaders/gaussian_blur.wgsl @@ -1,5 +1,5 @@ // Gaussian blur shader for Sequence v2 -#include "sequence_v2_uniforms" +#include "sequence_uniforms" @group(0) @binding(0) var input_sampler: sampler; @group(0) @binding(1) var input_texture: texture_2d<f32>; diff --git a/common/shaders/heptagon_v2.wgsl b/common/shaders/heptagon.wgsl index cb07c18..3bfc59d 100644 --- a/common/shaders/heptagon_v2.wgsl +++ b/common/shaders/heptagon.wgsl @@ -1,5 +1,5 @@ // Heptagon shader for Sequence v2 -#include "sequence_v2_uniforms" +#include "sequence_uniforms" // Standard v2 post-process layout (bindings 0,1 unused for scene effects) @group(0) @binding(2) var<uniform> uniforms: UniformsSequenceParams; 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); } 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<f32>; -@group(0) @binding(2) var<uniform> uniforms: UniformsSequenceParams; - -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> { - return textureSample(input_texture, input_sampler, in.uv); -} diff --git a/common/shaders/sequence_v2_uniforms.wgsl b/common/shaders/sequence_uniforms.wgsl index b302329..b302329 100644 --- a/common/shaders/sequence_v2_uniforms.wgsl +++ b/common/shaders/sequence_uniforms.wgsl diff --git a/doc/EFFECT_WORKFLOW.md b/doc/EFFECT_WORKFLOW.md index bdec2b6..c4010db 100644 --- a/doc/EFFECT_WORKFLOW.md +++ b/doc/EFFECT_WORKFLOW.md @@ -1,8 +1,8 @@ -# Effect Creation Workflow (v2) +# Effect Creation Workflow **Target Audience:** AI coding agents and developers -Checklist for adding visual effects using Sequence v2 system. +Checklist for adding visual effects. --- @@ -10,7 +10,7 @@ Checklist for adding visual effects using Sequence v2 system. **ShaderToy:** `tools/shadertoy/convert_shadertoy.py` then follow steps below **SDF/Raymarching:** See `doc/SDF_EFFECT_GUIDE.md` -**Custom v2 effects:** Follow all steps 1-6 +**Custom effects:** Follow all steps 1-6 --- @@ -18,18 +18,18 @@ Checklist for adding visual effects using Sequence v2 system. ### 1. Create Effect Files -**Files** (v2 naming): -- Header: `src/effects/<name>_effect_v2.h` -- Implementation: `src/effects/<name>_effect_v2.cc` -- Shader: `workspaces/main/shaders/<name>_v2.wgsl` +**Files**: +- Header: `src/effects/<name>_effect.h` +- Implementation: `src/effects/<name>_effect.cc` +- Shader: `workspaces/main/shaders/<name>.wgsl` -**Class name**: `<Name>EffectV2` (e.g., `TunnelEffectV2`) +**Class name**: `<Name>Effect` (e.g., `TunnelEffect`) -**Base class**: `EffectV2` (all effects) +**Base class**: `Effect` (all effects) **Constructor**: ```cpp -MyEffectV2(const GpuContext& ctx, +MyEffect(const GpuContext& ctx, const std::vector<std::string>& inputs, const std::vector<std::string>& outputs); ``` @@ -59,7 +59,7 @@ params.aspect_ratio; // width/height **File**: `workspaces/main/assets.txt` ``` -SHADER_<UPPER_NAME>, NONE, shaders/<name>_v2.wgsl, "Description" +SHADER_<UPPER_NAME>, NONE, shaders/<name>.wgsl, "Description" ``` Asset ID: `AssetId::ASSET_SHADER_<UPPER_NAME>` @@ -68,7 +68,7 @@ Asset ID: `AssetId::ASSET_SHADER_<UPPER_NAME>` **File**: `CMakeLists.txt` -Add `src/effects/<name>_effect_v2.cc` to **BOTH** GPU_SOURCES sections: +Add `src/effects/<name>_effect.cc` to **BOTH** GPU_SOURCES sections: - Headless mode (around line 141-167) - Normal mode (around line 171-197) @@ -77,16 +77,16 @@ Add `src/effects/<name>_effect_v2.cc` to **BOTH** GPU_SOURCES sections: **File**: `src/gpu/demo_effects.h` ```cpp -#include "effects/<name>_effect_v2.h" +#include "effects/<name>_effect.h" ``` ### 5. Add to Timeline -**File**: `workspaces/main/timeline_v2.seq` +**File**: `workspaces/main/timeline.seq` ``` SEQUENCE <start> <priority> "name" - EFFECT + MyEffectV2 source -> sink 0.0 4.0 + EFFECT + MyEffect source -> sink 0.0 4.0 ``` **Priority modifiers** (REQUIRED): `+` (increment), `=` (same), `-` (decrement) @@ -95,7 +95,7 @@ SEQUENCE <start> <priority> "name" ```bash # Regenerate timeline.cc -python3 tools/seq_compiler_v2.py workspaces/main/timeline_v2.seq \ +python3 tools/seq_compiler.py workspaces/main/timeline.seq \ --output src/generated/timeline.cc # Build @@ -112,17 +112,17 @@ cmake --build build -j4 ### Standard Post-Process Effect ```cpp -// my_effect_v2.h +// my_effect.h #pragma once -#include "gpu/effect_v2.h" +#include "gpu/effect.h" #include "gpu/uniform_helper.h" -class MyEffectV2 : public EffectV2 { +class MyEffect : public Effect { public: - MyEffectV2(const GpuContext& ctx, + MyEffect(const GpuContext& ctx, const std::vector<std::string>& inputs, const std::vector<std::string>& outputs); - ~MyEffectV2() override; + ~MyEffect() override; void render(WGPUCommandEncoder encoder, const UniformsSequenceParams& params, @@ -136,27 +136,27 @@ class MyEffectV2 : public EffectV2 { ``` ```cpp -// my_effect_v2.cc -#include "effects/my_effect_v2.h" +// my_effect.cc +#include "effects/my_effect.h" #include "gpu/post_process_helper.h" #include "gpu/shaders.h" -MyEffectV2::MyEffectV2(const GpuContext& ctx, +MyEffect::MyEffect(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) { uniforms_buffer_.init(ctx_.device); pipeline_ = create_post_process_pipeline(ctx_.device, WGPUTextureFormat_RGBA8Unorm, - my_shader_v2_wgsl); + my_shader_wgsl); } -MyEffectV2::~MyEffectV2() { +MyEffect::~MyEffect() { if (bind_group_) wgpuBindGroupRelease(bind_group_); if (pipeline_) wgpuRenderPipelineRelease(pipeline_); } -void MyEffectV2::render(WGPUCommandEncoder encoder, +void MyEffect::render(WGPUCommandEncoder encoder, const UniformsSequenceParams& params, NodeRegistry& nodes) { WGPUTextureView input_view = nodes.get_view(input_nodes_[0]); @@ -193,11 +193,11 @@ void MyEffectV2::render(WGPUCommandEncoder encoder, ### 3D Effect with Depth ```cpp -class My3DEffectV2 : public EffectV2 { +class My3DEffect : public Effect { std::string depth_node_; - My3DEffectV2(const GpuContext& ctx, ...) - : EffectV2(ctx, inputs, outputs), + My3DEffect(const GpuContext& ctx, ...) + : Effect(ctx, inputs, outputs), depth_node_(outputs[0] + "_depth") {} void declare_nodes(NodeRegistry& registry) override { @@ -251,6 +251,6 @@ class My3DEffectV2 : public EffectV2 { ## See Also -- `doc/SEQUENCE_v2.md` - Timeline syntax and architecture -- `tools/seq_compiler_v2.py` - Compiler implementation -- `src/effects/*_v2.{h,cc}` - Example effects +- `doc/SEQUENCE.md` - Timeline syntax and architecture +- `tools/seq_compiler.py` - Compiler implementation +- `src/effects/*.{h,cc}` - Example effects diff --git a/doc/SEQUENCE_v2.md b/doc/SEQUENCE.md index 7ce6efc..76e19d4 100644 --- a/doc/SEQUENCE_v2.md +++ b/doc/SEQUENCE.md @@ -1,17 +1,17 @@ -# Sequence v2: DAG-based Effect Routing +# Sequence: DAG-based Effect Routing -**Status:** ✅ Operational (Phase 4 complete, v1 removed) +**Status:** ✅ Operational -Explicit node system with DAG effect routing. Replaces v1 implicit framebuffer ping-pong. +Explicit node system with DAG effect routing. ## Quick Start ```bash # Compile timeline -python3 tools/seq_compiler_v2.py workspaces/main/timeline_v2.seq --output src/generated/timeline.cc +python3 tools/seq_compiler.py workspaces/main/timeline.seq --output src/generated/timeline.cc # Flatten mode (future: inline effects, no vtables) -python3 tools/seq_compiler_v2.py timeline.seq --output timeline.cc --flatten +python3 tools/seq_compiler.py timeline.seq --output timeline.cc --flatten ``` ## Timeline Syntax @@ -72,10 +72,10 @@ SEQUENCE 0.0 0 "blur" ## Architecture -### SequenceV2 Class +### Sequence Class ```cpp -class SequenceV2 { +class Sequence { NodeRegistry nodes_; // Typed texture management std::vector<EffectDAGNode> effect_dag_; // Topologically sorted UniformsSequenceParams params_; // Per-frame uniforms @@ -85,10 +85,10 @@ class SequenceV2 { }; ``` -### EffectV2 Class +### Effect Class ```cpp -class EffectV2 { +class Effect { std::vector<std::string> input_nodes_; std::vector<std::string> output_nodes_; @@ -112,30 +112,30 @@ class EffectV2 { ## Compiler Features -**seq_compiler_v2.py** generates optimized C++ from `.seq`: +**seq_compiler.py** generates optimized C++ from `.seq`: 1. **DAG Validation**: Cycle detection, connectivity checks 2. **Topological Sort**: Execution order from dependencies 3. **Ping-pong Detection**: Automatic node aliasing -4. **Code Generation**: SequenceV2 subclasses with node declarations and effect DAG +4. **Code Generation**: Sequence subclasses with node declarations and effect DAG **Output**: Single `.cc` file with: -- Multiple `SequenceV2` subclasses (one per SEQUENCE) -- `InitializeV2Sequences()` - Registry initialization -- `GetActiveV2Sequence(float time)` - Active sequence lookup -- `RenderV2Timeline()` - Encoder-based and surface-based variants +- Multiple `Sequence` subclasses (one per SEQUENCE) +- `InitializeSequences()` - Registry initialization +- `GetActiveSequence(float time)` - Active sequence lookup +- `RenderTimeline()` - Encoder-based and surface-based variants ## Creating Effects **For standard post-process:** ```cpp -class MyEffectV2 : public EffectV2 { +class MyEffect : public Effect { WGPURenderPipeline pipeline_; UniformBuffer<UniformsSequenceParams> uniforms_; - MyEffectV2(const GpuContext& ctx, const std::vector<std::string>& inputs, + MyEffect(const GpuContext& ctx, const std::vector<std::string>& inputs, const std::vector<std::string>& outputs); const std::vector<std::string>& outputs) - : EffectV2(ctx, inputs, outputs) { + : Effect(ctx, inputs, outputs) { uniforms_.init(ctx_.device); pipeline_ = create_post_process_pipeline(ctx_.device, WGPUTextureFormat_RGBA8Unorm, @@ -154,10 +154,10 @@ class MyEffectV2 : public EffectV2 { **For 3D effects with depth:** ```cpp -class My3DEffectV2 : public EffectV2 { +class My3DEffect : public Effect { std::string depth_node_; - My3DEffectV2(...) : EffectV2(...), depth_node_(outputs[0] + "_depth") {} + My3DEffect(...) : Effect(...), depth_node_(outputs[0] + "_depth") {} void declare_nodes(NodeRegistry& registry) override { registry.declare_node(depth_node_, NodeType::DEPTH24, -1, -1); @@ -201,21 +201,21 @@ params.aspect_ratio; // width/height **TODO**: - Port remaining effects (10+ effects, CNN effects) - Implement flatten mode (inline effects, direct members) -- Update HTML timeline editor for v2 graph visualization +- Update HTML timeline editor for graph visualization ## Migration Notes -**V1 → V2 Differences**: +**Key Features**: - V1: Implicit framebuffer ping-pong (framebuffer_a_ ↔ framebuffer_b_) -- V2: Explicit node declarations with routing +- Explicit node declarations with routing **Breaking Changes**: -- Effect base class changed (Effect → EffectV2) +- Effect base class standardized - Constructor signature: `(GpuContext, inputs[], outputs[])` - Render signature: Added `NodeRegistry& nodes` parameter - No `is_post_process()` method (routing makes it explicit) **See Also**: - `doc/EFFECT_WORKFLOW.md` - Step-by-step effect creation -- `tools/seq_compiler_v2.py` - Compiler implementation -- `workspaces/main/timeline_v2.seq` - Example timeline +- `tools/seq_compiler.py` - Compiler implementation +- `workspaces/main/timeline.seq` - Example timeline diff --git a/doc/archive/timeline_v1.seq b/doc/archive/timeline_v1.seq new file mode 100644 index 0000000..b4663bb --- /dev/null +++ b/doc/archive/timeline_v1.seq @@ -0,0 +1,97 @@ +# Demo Timeline +# Generated by Timeline Editor +# BPM 90 + +SEQUENCE 0.00 0 + EFFECT - FlashCubeEffect 0.00 4.00 +# EFFECT + FlashEffect 0.00 2.00 color=1.0,0.5,0.5 decay=0.95 +# EFFECT + FadeEffect 2.00 4.00 +# EFFECT + SolarizeEffect 0.00 4.00 + EFFECT + VignetteEffect 0.00 4.00 radius=0.6 softness=0.1 + +SEQUENCE 4.00 0 "rotating cube" + EFFECT + CircleMaskEffect 0.00 4.00 0.50 + EFFECT + RotatingCubeEffect 0.00 4.00 + EFFECT + GaussianBlurEffect 1.00 4.00 strength=1.0 + +SEQUENCE 8.00 0 "Flash Cube" + EFFECT - FlashCubeEffect 0.00 4.02 + EFFECT + FlashEffect 0.00 0.40 + +SEQUENCE 12.00 1 "spray" + EFFECT + ParticleSprayEffect 0.00 2.00 + EFFECT + ParticlesEffect 2.00 4.00 + EFFECT = GaussianBlurEffect 0.00 4.00 strength=3.0 + +SEQUENCE 16.00 2 "Hybrid3D + CNN" + EFFECT + ThemeModulationEffect 0.00 4.00 + EFFECT + HeptagonEffect 0.00 4.00 + EFFECT + ParticleSprayEffect 0.00 2.00 + EFFECT = ParticlesEffect 2.00 4.00 + EFFECT + Hybrid3DEffect 0.00 4.00 + EFFECT + CNNv1Effect 0.00 4.00 layers=3 blend=.9 + +SEQUENCE 20.00 0 "CNN effect" + EFFECT + HeptagonEffect 0.00 8.00 + EFFECT + Scene1Effect 0.00 8.00 + EFFECT + CNNv1Effect 6.00 8.00 layers=3 blend=.5 + +SEQUENCE 28.00 0 "buggy" + EFFECT + HeptagonEffect 0.00 2.00 + EFFECT + FadeEffect 0.00 2.00 + +SEQUENCE 30.00 3 "Seq-8" + EFFECT + ThemeModulationEffect 0.00 10.00 + EFFECT = HeptagonEffect 0.00 10.00 + EFFECT + GaussianBlurEffect 0.00 10.00 strength=1.5 + EFFECT + ChromaAberrationEffect 0.00 10.00 offset=0.03 angle=0.785 + EFFECT + SolarizeEffect 0.00 10.00 + +SEQUENCE 40.00 2 + EFFECT - FlashCubeEffect 0.00 4.00 + EFFECT + HeptagonEffect 0.00 4.00 + EFFECT + ParticleSprayEffect 0.00 4.00 + +SEQUENCE 44.00 2 "Fade" + EFFECT - FlashCubeEffect 0.00 2.00 + EFFECT + FlashEffect 1.00 2.00 + +SEQUENCE 46.00 10 + EFFECT - FlashCubeEffect 0.00 3.00 + EFFECT + GaussianBlurEffect 0.00 3.00 + EFFECT + FlashEffect 0.00 3.00 + +SEQUENCE 49.00 1 + EFFECT + ThemeModulationEffect 0.00 8.00 + EFFECT + HeptagonEffect 0.00 8.00 + EFFECT + ParticleSprayEffect 0.00 8.00 + EFFECT + Hybrid3DEffect 0.00 8.00 + EFFECT + GaussianBlurEffect 0.00 8.00 + EFFECT + ChromaAberrationEffect 0.00 8.00 + +SEQUENCE 57.00 0 + EFFECT + ThemeModulationEffect 0.00 7.00 + EFFECT + VignetteEffect 0.00 7.00 radius=0.6 softness=0.3 + EFFECT + SolarizeEffect 0.00 7.00 + +SEQUENCE 64.00 0 + EFFECT + ThemeModulationEffect 0.00 4.00 + EFFECT + HeptagonEffect 0.00 4.00 + EFFECT + GaussianBlurEffect 0.00 4.00 + EFFECT + SolarizeEffect 0.00 4.00 + +SEQUENCE 68.00 0 "double hepta!" + EFFECT + ThemeModulationEffect 0.00 4.00 + EFFECT = HeptagonEffect 0.00 4.00 + EFFECT + Hybrid3DEffect 0.00 4.00 + EFFECT + ParticleSprayEffect 0.00 4.00 + EFFECT + HeptagonEffect 0.00 4.00 + EFFECT + ChromaAberrationEffect 0.00 4.00 + EFFECT + GaussianBlurEffect 0.00 4.00 + +SEQUENCE 72.00 0 "The End" + EFFECT + ThemeModulationEffect 0.00 7.00 + EFFECT + HeptagonEffect 0.00 7.00 + EFFECT + ChromaAberrationEffect 0.00 7.00 + EFFECT + GaussianBlurEffect 0.00 7.00 + 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"}, 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 diff --git a/workspaces/main/assets.txt b/workspaces/main/assets.txt index 9d15213..71dd7e0 100644 --- a/workspaces/main/assets.txt +++ b/workspaces/main/assets.txt @@ -33,9 +33,9 @@ SHADER_RAY_TRIANGLE, NONE, ../../common/shaders/ray_triangle.wgsl, "Ray-Triangle SHADER_MAIN, NONE, shaders/main_shader.wgsl, "Main Heptagon Shader" SHADER_PARTICLE_COMPUTE, NONE, shaders/particle_compute.wgsl, "Particle Compute Shader" SHADER_PARTICLE_RENDER, NONE, shaders/particle_render.wgsl, "Particle Render Shader" -SHADER_PARTICLE_COMPUTE_V2, NONE, shaders/particle_compute_v2.wgsl, "Particle Compute Shader V2" -SHADER_PARTICLE_RENDER_V2, NONE, shaders/particle_render_v2.wgsl, "Particle Render Shader V2" -SHADER_ROTATING_CUBE_V2, NONE, shaders/rotating_cube_v2.wgsl, "Rotating Cube Shader V2" +SHADER_PARTICLE_COMPUTE_V2, NONE, shaders/particle_compute.wgsl, "Particle Compute Shader" +SHADER_PARTICLE_RENDER_V2, NONE, shaders/particle_render.wgsl, "Particle Render Shader" +SHADER_ROTATING_CUBE_V2, NONE, shaders/rotating_cube.wgsl, "Rotating Cube Shader" SHADER_PASSTHROUGH, NONE, ../../common/shaders/passthrough.wgsl, "Passthrough Shader" SHADER_ELLIPSE, NONE, shaders/ellipse.wgsl, "Ellipse Shader" SHADER_PARTICLE_SPRAY_COMPUTE, NONE, shaders/particle_spray_compute.wgsl, "Particle Spray Compute" @@ -82,9 +82,9 @@ CIRCLE_MASK_RENDER_SHADER, NONE, shaders/circle_mask_render.wgsl, "Circle mask r MASKED_CUBE_SHADER, NONE, shaders/masked_cube.wgsl, "Masked cube shader" SHADER_SCENE1, NONE, shaders/scene1.wgsl, "Scene1 effect shader" -# --- Sequence v2 Shaders --- -SHADER_SEQUENCE_V2_UNIFORMS, NONE, ../../common/shaders/sequence_v2_uniforms.wgsl, "Sequence v2 Uniforms Snippet" +# --- Sequence Shaders --- +SHADER_SEQUENCE_V2_UNIFORMS, NONE, ../../common/shaders/sequence_uniforms.wgsl, "Sequence Uniforms Snippet" SHADER_POSTPROCESS_INLINE, NONE, ../../common/shaders/postprocess_inline.wgsl, "Inline Post-Process Functions" -SHADER_PASSTHROUGH_V2, NONE, ../../common/shaders/passthrough_v2.wgsl, "Passthrough Shader (v2)" -SHADER_GAUSSIAN_BLUR_V2, NONE, ../../common/shaders/gaussian_blur_v2.wgsl, "Gaussian Blur Shader (v2)" -SHADER_HEPTAGON_V2, NONE, ../../common/shaders/heptagon_v2.wgsl, "Heptagon Shader (v2)" +SHADER_PASSTHROUGH_V2, NONE, ../../common/shaders/passthrough.wgsl, "Passthrough Shader" +SHADER_GAUSSIAN_BLUR_V2, NONE, ../../common/shaders/gaussian_blur.wgsl, "Gaussian Blur Shader" +SHADER_HEPTAGON_V2, NONE, ../../common/shaders/heptagon.wgsl, "Heptagon Shader" diff --git a/workspaces/main/shaders/particle_compute.wgsl b/workspaces/main/shaders/particle_compute.wgsl index ae513c8..d7a24b6 100644 --- a/workspaces/main/shaders/particle_compute.wgsl +++ b/workspaces/main/shaders/particle_compute.wgsl @@ -1,3 +1,4 @@ +// Particle simulation (compute shader) - V2 struct Particle { pos: vec4<f32>, vel: vec4<f32>, @@ -5,10 +6,10 @@ struct Particle { color: vec4<f32>, }; -#include "common_uniforms" +#include "sequence_uniforms" @group(0) @binding(0) var<storage, read_write> particles: array<Particle>; -@group(0) @binding(1) var<uniform> uniforms: CommonUniforms; +@group(0) @binding(1) var<uniform> uniforms: UniformsSequenceParams; @compute @workgroup_size(64) fn main(@builtin(global_invocation_id) id: vec3<u32>) { diff --git a/workspaces/main/shaders/particle_compute_v2.wgsl b/workspaces/main/shaders/particle_compute_v2.wgsl deleted file mode 100644 index 3683826..0000000 --- a/workspaces/main/shaders/particle_compute_v2.wgsl +++ /dev/null @@ -1,31 +0,0 @@ -// Particle simulation (compute shader) - V2 -struct Particle { - pos: vec4<f32>, - vel: vec4<f32>, - rot: vec4<f32>, - color: vec4<f32>, -}; - -#include "sequence_v2_uniforms" - -@group(0) @binding(0) var<storage, read_write> particles: array<Particle>; -@group(0) @binding(1) var<uniform> uniforms: UniformsSequenceParams; - -@compute @workgroup_size(64) -fn main(@builtin(global_invocation_id) id: vec3<u32>) { - let i = id.x; - if (i >= arrayLength(&particles)) { - return; - } - var p = particles[i]; - let new_pos = p.pos.xyz + p.vel.xyz * 0.016; - p.pos = vec4<f32>(new_pos, p.pos.w); - p.vel.y = p.vel.y - 0.01 * (1.0 + uniforms.audio_intensity * 5.0); - p.rot.x = p.rot.x + p.rot.y * 0.016; - if (p.pos.y < -1.5) { - p.pos.y = 1.5; - p.pos.x = (f32(i % 100u) / 50.0) - 1.0 + (uniforms.audio_intensity * 0.5); - p.vel.y = 0.0; - } - particles[i] = p; -} diff --git a/workspaces/main/shaders/particle_render.wgsl b/workspaces/main/shaders/particle_render.wgsl index 6a2b636..dd83220 100644 --- a/workspaces/main/shaders/particle_render.wgsl +++ b/workspaces/main/shaders/particle_render.wgsl @@ -1,3 +1,4 @@ +// Particle rendering (vertex + fragment) - V2 struct Particle { pos: vec4<f32>, vel: vec4<f32>, @@ -5,10 +6,10 @@ struct Particle { color: vec4<f32>, }; -#include "common_uniforms" +#include "sequence_uniforms" @group(0) @binding(0) var<storage, read> particles: array<Particle>; -@group(0) @binding(1) var<uniform> uniforms: CommonUniforms; +@group(0) @binding(1) var<uniform> uniforms: UniformsSequenceParams; struct VSOut { @builtin(position) pos: vec4<f32>, diff --git a/workspaces/main/shaders/particle_render_v2.wgsl b/workspaces/main/shaders/particle_render_v2.wgsl deleted file mode 100644 index 8663658..0000000 --- a/workspaces/main/shaders/particle_render_v2.wgsl +++ /dev/null @@ -1,53 +0,0 @@ -// Particle rendering (vertex + fragment) - V2 -struct Particle { - pos: vec4<f32>, - vel: vec4<f32>, - rot: vec4<f32>, - color: vec4<f32>, -}; - -#include "sequence_v2_uniforms" - -@group(0) @binding(0) var<storage, read> particles: array<Particle>; -@group(0) @binding(1) var<uniform> uniforms: UniformsSequenceParams; - -struct VSOut { - @builtin(position) pos: vec4<f32>, - @location(0) color: vec4<f32>, - @location(1) uv: vec2<f32>, -}; - -@vertex fn vs_main(@builtin(vertex_index) vi: u32, @builtin(instance_index) ii: u32) -> VSOut { - let p = particles[ii]; - let size = 0.02 + p.pos.z * 0.01 + uniforms.audio_intensity * 0.02; - var offsets = array<vec2<f32>, 6>( - vec2<f32>(-1, -1), - vec2<f32>(1, -1), - vec2<f32>(-1, 1), - vec2<f32>(-1, 1), - vec2<f32>(1, -1), - vec2<f32>(1, 1) - ); - let offset = offsets[vi]; - let c = cos(p.rot.x); - let s = sin(p.rot.x); - let rotated_offset = vec2<f32>(offset.x * c - offset.y * s, offset.x * s + offset.y * c); - let pos = vec2<f32>(p.pos.x + rotated_offset.x * size / uniforms.aspect_ratio, p.pos.y + rotated_offset.y * size); - - // Fade based on lifetime (p.pos.w goes from 1.0 to 0.0) - let lifetime_fade = p.pos.w; - let color_with_fade = vec4<f32>(p.color.rgb * (0.5 + 0.5 * uniforms.audio_intensity), p.color.a * lifetime_fade); - - return VSOut(vec4<f32>(pos, 0.0, 1.0), color_with_fade, offset); -} - -@fragment fn fs_main(@location(0) color: vec4<f32>, @location(1) uv: vec2<f32>) -> @location(0) vec4<f32> { - // Calculate distance from center for circular shape - let dist = length(uv); - - // Smooth circular falloff (1.0 at center, 0.0 at edge) - let circle_alpha = smoothstep(1.0, 0.5, dist); - - // Apply circular fade to alpha channel - return vec4<f32>(color.rgb, color.a * circle_alpha); -} diff --git a/workspaces/main/shaders/rotating_cube_v2.wgsl b/workspaces/main/shaders/rotating_cube.wgsl index d7e4cae..d7e4cae 100644 --- a/workspaces/main/shaders/rotating_cube_v2.wgsl +++ b/workspaces/main/shaders/rotating_cube.wgsl diff --git a/workspaces/main/timeline.seq b/workspaces/main/timeline.seq index b4663bb..57e1c50 100644 --- a/workspaces/main/timeline.seq +++ b/workspaces/main/timeline.seq @@ -1,97 +1,45 @@ -# Demo Timeline -# Generated by Timeline Editor +# Demo Timeline v2 # BPM 90 -SEQUENCE 0.00 0 - EFFECT - FlashCubeEffect 0.00 4.00 -# EFFECT + FlashEffect 0.00 2.00 color=1.0,0.5,0.5 decay=0.95 -# EFFECT + FadeEffect 2.00 4.00 -# EFFECT + SolarizeEffect 0.00 4.00 - EFFECT + VignetteEffect 0.00 4.00 radius=0.6 softness=0.1 +SEQUENCE 0.00 0 "intro" + # FlashCube (placeholder) -> Vignette -> sink + EFFECT + PlaceholderEffect source -> temp1 0.00 4.00 + EFFECT + PlaceholderEffect temp1 -> sink 0.00 4.00 -SEQUENCE 4.00 0 "rotating cube" - EFFECT + CircleMaskEffect 0.00 4.00 0.50 - EFFECT + RotatingCubeEffect 0.00 4.00 - EFFECT + GaussianBlurEffect 1.00 4.00 strength=1.0 +SEQUENCE 4.00 0 "rotating_cube" + # RotatingCube -> Blur -> sink + EFFECT + RotatingCubeEffect source -> temp1 0.00 4.00 + EFFECT + GaussianBlurEffect temp1 -> sink 1.00 4.00 -SEQUENCE 8.00 0 "Flash Cube" - EFFECT - FlashCubeEffect 0.00 4.02 - EFFECT + FlashEffect 0.00 0.40 +SEQUENCE 8.00 0 "flash_cube" + # FlashCube (placeholder) -> Flash (placeholder) -> sink + EFFECT - PlaceholderEffect source -> temp1 0.00 4.02 + EFFECT + PlaceholderEffect temp1 -> sink 0.00 0.40 -SEQUENCE 12.00 1 "spray" - EFFECT + ParticleSprayEffect 0.00 2.00 - EFFECT + ParticlesEffect 2.00 4.00 - EFFECT = GaussianBlurEffect 0.00 4.00 strength=3.0 +SEQUENCE 12.00 1 "particles" + # Particles -> Blur -> sink + EFFECT + ParticlesEffect source -> temp1 0.00 4.00 + EFFECT = GaussianBlurEffect temp1 -> sink 0.00 4.00 -SEQUENCE 16.00 2 "Hybrid3D + CNN" - EFFECT + ThemeModulationEffect 0.00 4.00 - EFFECT + HeptagonEffect 0.00 4.00 - EFFECT + ParticleSprayEffect 0.00 2.00 - EFFECT = ParticlesEffect 2.00 4.00 - EFFECT + Hybrid3DEffect 0.00 4.00 - EFFECT + CNNv1Effect 0.00 4.00 layers=3 blend=.9 +SEQUENCE 16.00 2 "hybrid_heptagon" + # Heptagon -> Hybrid3D -> sink + EFFECT + HeptagonEffect source -> temp1 0.00 4.00 + EFFECT + Hybrid3DEffect temp1 -> sink 0.00 4.00 -SEQUENCE 20.00 0 "CNN effect" - EFFECT + HeptagonEffect 0.00 8.00 - EFFECT + Scene1Effect 0.00 8.00 - EFFECT + CNNv1Effect 6.00 8.00 layers=3 blend=.5 +SEQUENCE 20.00 0 "heptagon_scene" + # Heptagon -> Scene1 (placeholder) -> sink + EFFECT + HeptagonEffect source -> temp1 0.00 8.00 + EFFECT + PlaceholderEffect temp1 -> sink 0.00 8.00 -SEQUENCE 28.00 0 "buggy" - EFFECT + HeptagonEffect 0.00 2.00 - EFFECT + FadeEffect 0.00 2.00 - -SEQUENCE 30.00 3 "Seq-8" - EFFECT + ThemeModulationEffect 0.00 10.00 - EFFECT = HeptagonEffect 0.00 10.00 - EFFECT + GaussianBlurEffect 0.00 10.00 strength=1.5 - EFFECT + ChromaAberrationEffect 0.00 10.00 offset=0.03 angle=0.785 - EFFECT + SolarizeEffect 0.00 10.00 - -SEQUENCE 40.00 2 - EFFECT - FlashCubeEffect 0.00 4.00 - EFFECT + HeptagonEffect 0.00 4.00 - EFFECT + ParticleSprayEffect 0.00 4.00 - -SEQUENCE 44.00 2 "Fade" - EFFECT - FlashCubeEffect 0.00 2.00 - EFFECT + FlashEffect 1.00 2.00 - -SEQUENCE 46.00 10 - EFFECT - FlashCubeEffect 0.00 3.00 - EFFECT + GaussianBlurEffect 0.00 3.00 - EFFECT + FlashEffect 0.00 3.00 - -SEQUENCE 49.00 1 - EFFECT + ThemeModulationEffect 0.00 8.00 - EFFECT + HeptagonEffect 0.00 8.00 - EFFECT + ParticleSprayEffect 0.00 8.00 - EFFECT + Hybrid3DEffect 0.00 8.00 - EFFECT + GaussianBlurEffect 0.00 8.00 - EFFECT + ChromaAberrationEffect 0.00 8.00 - -SEQUENCE 57.00 0 - EFFECT + ThemeModulationEffect 0.00 7.00 - EFFECT + VignetteEffect 0.00 7.00 radius=0.6 softness=0.3 - EFFECT + SolarizeEffect 0.00 7.00 - -SEQUENCE 64.00 0 - EFFECT + ThemeModulationEffect 0.00 4.00 - EFFECT + HeptagonEffect 0.00 4.00 - EFFECT + GaussianBlurEffect 0.00 4.00 - EFFECT + SolarizeEffect 0.00 4.00 - -SEQUENCE 68.00 0 "double hepta!" - EFFECT + ThemeModulationEffect 0.00 4.00 - EFFECT = HeptagonEffect 0.00 4.00 - EFFECT + Hybrid3DEffect 0.00 4.00 - EFFECT + ParticleSprayEffect 0.00 4.00 - EFFECT + HeptagonEffect 0.00 4.00 - EFFECT + ChromaAberrationEffect 0.00 4.00 - EFFECT + GaussianBlurEffect 0.00 4.00 - -SEQUENCE 72.00 0 "The End" - EFFECT + ThemeModulationEffect 0.00 7.00 - EFFECT + HeptagonEffect 0.00 7.00 - EFFECT + ChromaAberrationEffect 0.00 7.00 - EFFECT + GaussianBlurEffect 0.00 7.00 +SEQUENCE 28.00 0 "fade_test" + # Heptagon -> Fade (placeholder) -> sink + EFFECT + HeptagonEffect source -> temp1 0.00 2.00 + EFFECT + PlaceholderEffect temp1 -> sink 0.00 2.00 +SEQUENCE 30.00 3 "complex_chain" + # Theme (placeholder) -> Heptagon -> Blur -> ChromaAberration (placeholder) -> Solarize (placeholder) -> sink + EFFECT + PlaceholderEffect source -> temp1 0.00 10.00 + EFFECT = HeptagonEffect temp1 -> temp2 0.00 10.00 + EFFECT + GaussianBlurEffect temp2 -> temp3 0.00 10.00 + EFFECT + PlaceholderEffect temp3 -> temp4 0.00 10.00 + EFFECT + PlaceholderEffect temp4 -> sink 0.00 10.00 diff --git a/workspaces/main/timeline_v2.seq b/workspaces/main/timeline_v2.seq deleted file mode 100644 index 4b51023..0000000 --- a/workspaces/main/timeline_v2.seq +++ /dev/null @@ -1,45 +0,0 @@ -# Demo Timeline v2 -# BPM 90 - -SEQUENCE 0.00 0 "intro" - # FlashCube (placeholder) -> Vignette -> sink - EFFECT + PlaceholderEffect source -> temp1 0.00 4.00 - EFFECT + PlaceholderEffect temp1 -> sink 0.00 4.00 - -SEQUENCE 4.00 0 "rotating_cube" - # RotatingCube -> Blur -> sink - EFFECT + RotatingCubeEffectV2 source -> temp1 0.00 4.00 - EFFECT + GaussianBlurEffect temp1 -> sink 1.00 4.00 - -SEQUENCE 8.00 0 "flash_cube" - # FlashCube (placeholder) -> Flash (placeholder) -> sink - EFFECT - PlaceholderEffect source -> temp1 0.00 4.02 - EFFECT + PlaceholderEffect temp1 -> sink 0.00 0.40 - -SEQUENCE 12.00 1 "particles" - # Particles -> Blur -> sink - EFFECT + ParticlesEffectV2 source -> temp1 0.00 4.00 - EFFECT = GaussianBlurEffect temp1 -> sink 0.00 4.00 - -SEQUENCE 16.00 2 "hybrid_heptagon" - # Heptagon -> Hybrid3D -> sink - EFFECT + HeptagonEffect source -> temp1 0.00 4.00 - EFFECT + Hybrid3DEffectV2 temp1 -> sink 0.00 4.00 - -SEQUENCE 20.00 0 "heptagon_scene" - # Heptagon -> Scene1 (placeholder) -> sink - EFFECT + HeptagonEffect source -> temp1 0.00 8.00 - EFFECT + PlaceholderEffect temp1 -> sink 0.00 8.00 - -SEQUENCE 28.00 0 "fade_test" - # Heptagon -> Fade (placeholder) -> sink - EFFECT + HeptagonEffect source -> temp1 0.00 2.00 - EFFECT + PlaceholderEffect temp1 -> sink 0.00 2.00 - -SEQUENCE 30.00 3 "complex_chain" - # Theme (placeholder) -> Heptagon -> Blur -> ChromaAberration (placeholder) -> Solarize (placeholder) -> sink - EFFECT + PlaceholderEffect source -> temp1 0.00 10.00 - EFFECT = HeptagonEffect temp1 -> temp2 0.00 10.00 - EFFECT + GaussianBlurEffect temp2 -> temp3 0.00 10.00 - EFFECT + PlaceholderEffect temp3 -> temp4 0.00 10.00 - EFFECT + PlaceholderEffect temp4 -> sink 0.00 10.00 diff --git a/workspaces/main/workspace.cfg b/workspaces/main/workspace.cfg index feaa3f1..5eff423 100644 --- a/workspaces/main/workspace.cfg +++ b/workspaces/main/workspace.cfg @@ -5,7 +5,7 @@ version = "1.0" [build] target = "demo64k" -timeline = "timeline_v2.seq" +timeline = "timeline.seq" # music = "pop_punk_drums.track" music = "beat_test.track" assets = "assets.txt" diff --git a/workspaces/test/assets.txt b/workspaces/test/assets.txt index 8550eca..0f065d3 100644 --- a/workspaces/test/assets.txt +++ b/workspaces/test/assets.txt @@ -68,12 +68,12 @@ CIRCLE_MASK_COMPUTE_SHADER, NONE, shaders/circle_mask_compute.wgsl, "Circle mask CIRCLE_MASK_RENDER_SHADER, NONE, shaders/circle_mask_render.wgsl, "Circle mask render shader" MASKED_CUBE_SHADER, NONE, shaders/masked_cube.wgsl, "Masked cube shader" -# --- Sequence v2 Shaders --- -SHADER_SEQUENCE_V2_UNIFORMS, NONE, ../../common/shaders/sequence_v2_uniforms.wgsl, "Sequence v2 Uniforms Snippet" +# --- Sequence Shaders --- +SHADER_SEQUENCE_V2_UNIFORMS, NONE, ../../common/shaders/sequence_uniforms.wgsl, "Sequence Uniforms Snippet" SHADER_POSTPROCESS_INLINE, NONE, ../../common/shaders/postprocess_inline.wgsl, "Inline Post-Process Functions" -SHADER_PASSTHROUGH_V2, NONE, ../../common/shaders/passthrough_v2.wgsl, "Passthrough Shader (v2)" -SHADER_GAUSSIAN_BLUR_V2, NONE, ../../common/shaders/gaussian_blur_v2.wgsl, "Gaussian Blur Shader (v2)" -SHADER_HEPTAGON_V2, NONE, ../../common/shaders/heptagon_v2.wgsl, "Heptagon Shader (v2)" +SHADER_PASSTHROUGH_V2, NONE, ../../common/shaders/passthrough.wgsl, "Passthrough Shader" +SHADER_GAUSSIAN_BLUR_V2, NONE, ../../common/shaders/gaussian_blur.wgsl, "Gaussian Blur Shader" +SHADER_HEPTAGON_V2, NONE, ../../common/shaders/heptagon.wgsl, "Heptagon Shader" # --- Test Assets (for test_assets.cc) --- TEST_ASSET_1, NONE, test_assets/test_asset_1.txt, "Test static asset" |
