diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-11 11:34:08 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-11 11:34:08 +0100 |
| commit | d378da77eec4d506bc01e4c08c38644d72969cc7 (patch) | |
| tree | 5cc38517320ba3aefb46a2f9c939c9fdc8ed5fae /doc | |
| parent | 4da0a3a5369142078fd7c681e3f0f1817bd6e2f3 (diff) | |
refactor: Simplify effect render API and fix uniform initialization
Root cause: Uniform buffers created but not initialized before bind group
creation, causing undefined UV coordinates in circle_mask_compute.wgsl.
Changes:
- Add get_common_uniforms() helper to Effect base class
- Refactor render()/compute() signatures: 5 params → CommonPostProcessUniforms&
- Fix uninitialized uniforms in CircleMaskEffect and CNNEffect
- Update all 19 effect implementations and headers
- Fix WGSL syntax error in FlashEffect (u.audio_intensity → audio_intensity)
- Update test files (test_sequence.cc)
Benefits:
- Cleaner API: construct uniforms once per frame, reuse across effects
- More maintainable: CommonPostProcessUniforms changes need no call site updates
- Fixes UV coordinate bug in circle_mask_compute.wgsl
All 36 tests passing (100%)
handoff(Claude): Effect API refactor complete
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/COMPLETED.md | 16 | ||||
| -rw-r--r-- | doc/EFFECT_WORKFLOW.md | 6 |
2 files changed, 22 insertions, 0 deletions
diff --git a/doc/COMPLETED.md b/doc/COMPLETED.md index 67f223d..01c4408 100644 --- a/doc/COMPLETED.md +++ b/doc/COMPLETED.md @@ -31,6 +31,22 @@ Use `read @doc/archive/FILENAME.md` to access archived documents. ## Recently Completed (February 11, 2026) +- [x] **Effect Render API Refactor** + - **Goal**: Simplify effect API and fix uniform initialization bugs + - **Root Cause**: Uniform buffers created but not initialized before bind group creation + - **Changes**: + - Added `get_common_uniforms()` helper to Effect base class + - Refactored all render()/compute() signatures from 5 parameters to single `CommonPostProcessUniforms&` + - Fixed uninitialized uniforms in CircleMaskEffect and CNNEffect + - Updated 19 effect implementations + headers + - Fixed WGSL syntax error in FlashEffect (u.audio_intensity → audio_intensity) + - **Impact**: + - Cleaner API: construct uniforms once per frame, reuse across effects + - More maintainable: changes to CommonPostProcessUniforms don't require updating all call sites + - Fixes UV coordinate bug in circle_mask_compute.wgsl + - **Result**: All 36 tests passing (100%) + - **Docs**: Updated EFFECT_WORKFLOW.md with new render() signature + - [x] **CNN Shader Testing Tool** - **Goal**: Offline validation of trained CNN shaders with GPU-to-CPU readback - **Implementation**: diff --git a/doc/EFFECT_WORKFLOW.md b/doc/EFFECT_WORKFLOW.md index 45c47b7..d68d148 100644 --- a/doc/EFFECT_WORKFLOW.md +++ b/doc/EFFECT_WORKFLOW.md @@ -31,6 +31,12 @@ Automated checklist for adding new visual effects to the demo. - Post-process effects: inherit from `PostProcessEffect` - Scene effects: inherit from `Effect` +**Render Signature:** +```cpp +void render(WGPURenderPassEncoder pass, + const CommonPostProcessUniforms& uniforms) override; +``` + **Template:** See `tools/shadertoy/template.*` or use `convert_shadertoy.py` ### 2. Add Shader to Assets |
