summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-08 16:46:27 +0100
committerskal <pascal.massimino@gmail.com>2026-02-08 16:46:27 +0100
commitb650afa7e05bfc127275778042443a729cb395f8 (patch)
tree5ac2472a5550a5ded2cb238277198e4a366eb4d0
parent775c0ea61faeaa8a09638d94b2399117f8b8cea3 (diff)
update doc
-rw-r--r--PROJECT_CONTEXT.md5
-rw-r--r--TODO.md11
-rw-r--r--doc/COMPLETED.md19
-rw-r--r--log.txt23
4 files changed, 34 insertions, 24 deletions
diff --git a/PROJECT_CONTEXT.md b/PROJECT_CONTEXT.md
index effc1c3..e28319d 100644
--- a/PROJECT_CONTEXT.md
+++ b/PROJECT_CONTEXT.md
@@ -35,10 +35,11 @@ Style:
### Current Status
- Audio system: Sample-accurate synchronization achieved. Uses hardware playback time as master clock. Variable tempo support integrated. **Pipeline optimized (Task #72)**: Zero heap allocations per frame, direct ring buffer writes, explicit clipping. Comprehensive test coverage maintained.
- Build system: Optimized with proper asset dependency tracking
-- Shader system: Modular with comprehensive compilation tests. **WGSL composability improved**: Common utilities extracted (`math/common_utils.wgsl`) with 12 call sites deduplicated across renderer shaders.
+- Shader system: **Parameterization complete**: UniformHelper template, per-frame dynamic params, .seq syntax support. Modular with comprehensive compilation tests. **WGSL composability improved**: Common utilities extracted (`math/common_utils.wgsl`) with 12 call sites deduplicated across renderer shaders.
- 3D rendering: Hybrid SDF/rasterization with BVH acceleration and binary scene loader. **Object data loading and parsing pipeline enhanced for primitives (e.g., plane_distance).**
- Asset pipeline: Blender export script and binary scene ingestion supported
- Error handling: **Dual macro system**: `FATAL_XXX` for programming errors (abort), `CHECK_RETURN` for recoverable errors (graceful return). Messages stripped in STRIP_ALL builds.
+- Testing: **32/32 tests passing (100%)** - All GPU validation errors resolved
---
## Next Up
@@ -89,6 +90,8 @@ Style:
## Recently Completed (February 2026)
+- **Shader Parametrization System** (February 8) - Full uniform parameter system with .seq syntax support. FlashEffect now supports dynamic color/decay parameters computed per-frame. Critical WGSL alignment bugfix (vec3 = 16-byte aligned). Size: ~400-500 bytes. See `doc/COMPLETED.md` for details.
+
- **WGSL Shader Composability** - Extracted common utilities to `math/common_utils.wgsl`:
- `transform_normal()` - 2 call sites (renderer_3d, mesh_render)
- `spherical_uv()` / `spherical_uv_from_dir()` - 8 call sites (renderer_3d, skybox)
diff --git a/TODO.md b/TODO.md
index 58ec954..0d789e3 100644
--- a/TODO.md
+++ b/TODO.md
@@ -4,6 +4,12 @@ This file tracks prioritized tasks with detailed attack plans.
**Note:** For a history of recently completed tasks, see `COMPLETED.md`.
+## Recently Completed (February 8, 2026)
+
+- [x] **Shader Parametrization System**: Full uniform parameter system with .seq syntax support. FlashEffect now supports color/decay parameters with per-frame animation. See `COMPLETED.md` for details.
+
+---
+
## Priority 1: Audio Pipeline Simplification & Jitter Fix (Task #71) [COMPLETED]
**Goal**: Address audio jittering in the miniaudio backend and simplify the entire audio pipeline (Synth, Tracker, AudioEngine, AudioBackend) for better maintainability and performance.
@@ -250,6 +256,11 @@ This file tracks prioritized tasks with detailed attack plans.
- **Priority**: Low (current workflow acceptable, but nice-to-have for rapid iteration)
### Visual Effects
+- [ ] **Task #73: Extend Shader Parametrization**: Apply parametrization system to other effects
+ - **Goal**: Extend uniform parameter system to ChromaAberrationEffect, GaussianBlurEffect, DistortEffect, SolarizeEffect
+ - **Pattern**: Follow FlashEffect implementation (UniformHelper, params struct, .seq syntax)
+ - **Priority**: Medium (quality-of-life improvement for artists)
+ - **Estimated Impact**: ~200-300 bytes per effect
- [ ] **Task #52: Procedural SDF Font**: Minimal bezier/spline set for [A-Z, 0-9] and SDF rendering.
- [ ] **Task #55: SDF Random Planes Intersection**: Implement `sdPolyhedron` (crystal/gem shapes) via plane intersection.
- [ ] **Task #54: Tracy Integration**: Integrate Tracy debugger for performance profiling.
diff --git a/doc/COMPLETED.md b/doc/COMPLETED.md
index bac7206..a4e6a94 100644
--- a/doc/COMPLETED.md
+++ b/doc/COMPLETED.md
@@ -4,6 +4,25 @@ This file tracks recently completed tasks, organized by completion date.
## Recently Completed (February 8, 2026)
+- [x] **Shader Parametrization System (Task #73 Phase 0)** (February 8, 2026)
+ - **Goal**: Enable per-frame dynamic parameters for shaders and effects via uniform buffers and .seq syntax
+ - **Implementation**:
+ - **Phase 1**: Created `UniformHelper` template in `src/gpu/uniform_helper.h` for type-safe uniform buffer management
+ - **Phase 2**: Added `FlashEffectParams` struct (color[3], decay_rate, trigger_threshold) and `FlashUniforms` struct with proper WGSL alignment
+ - **Phase 3**: Updated `flash_effect.cc` WGSL shader to use parameterized `flash_color` instead of hardcoded white
+ - **Phase 4**: Implemented per-frame parameter computation in `render()` method - animates color based on time/beat using sinusoidal modulation
+ - **Phase 5**: Extended `seq_compiler.cc` to parse key=value parameters from .seq files and generate struct initialization code
+ - **Critical Bugfix**: Fixed WGSL alignment issue where FlashUniforms was 24 bytes in C++ but shader expected 32 bytes
+ - Root cause: `vec3<f32>` has 16-byte alignment despite 12-byte size
+ - Solution: Added explicit padding (`_pad1[2]`, `_pad2`) and static_assert to enforce 32-byte struct size
+ - Result: Eliminated "Buffer is bound with size 24 where the shader expects 32" validation error
+ - **Syntax**: `EFFECT + FlashEffect 0 1 color=1.0,0.5,0.5 decay=0.95` in demo.seq
+ - **Files**: 11 changed (808+ / 40-), 3 new (uniform_helper.h, test_uniform_helper.cc, SHADER_PARAMETRIZATION_PLAN.md)
+ - **Result**: All 32/32 tests passing, demo runs without validation errors, system ready for extension to other effects
+ - **Commits**: c7d1dd7 (feature implementation), 775c0ea (alignment fix)
+ - **Size Impact**: ~400-500 bytes net (UniformHelper overhead + per-effect params)
+ - **Next**: Task #73 - Extend to ChromaAberrationEffect, GaussianBlurEffect, DistortEffect, SolarizeEffect
+
- [x] **3D Rendering & Shadow Improvements (Task A)** (February 8, 2026)
- [x] **Task A.1 (Shadow Investigation)**: Investigated mesh shadows appearing as bounding boxes. Documented that this is a design limitation of the hybrid renderer (AABB proxy for meshes in SDF pass). Created `doc/DEBUG_SHADOWS.md` with detailed analysis.
- [x] **Task A.2 (Plane Scaling Fix)**: Fixed `ObjectType::PLANE` distance calculation for non-uniform scaling.
diff --git a/log.txt b/log.txt
deleted file mode 100644
index ae994c6..0000000
--- a/log.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-
-thread '<unnamed>' (15208210) panicked at src/lib.rs:606:5:
-Error in wgpuQueueSubmit: Validation Error
-
-Caused by:
- In a draw command, kind: Draw
- Buffer is bound with size 24 where the shader expects 32 in group[0] compact index 0
-
-note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
-fatal runtime error: failed to initiate panic, error 5, aborting
-[GraphicsT=0.23, AudioT=0.13, Beat=0, Frac=0.26, Peak=1.00]
-[SEQUENCE START] priority=0, start_time=0.00
- [EFFECT START] 15FlashCubeEffect (priority=-1, time=0.20-1.50)
- [EFFECT START] 11FlashEffect (priority=0, time=0.00-1.00)
- [EFFECT START] 10FadeEffect (priority=1, time=0.10-1.00)
- [EFFECT START] 14SolarizeEffect (priority=2, time=0.00-2.00)
-WebGPU Error: Validation Error
-
-Caused by:
- In wgpuCommandEncoderFinish
- In a draw command, kind: Draw
- Buffer is bound with size 24 where the shader expects 32 in group[0] compact index 0
-