# To-Do List This file tracks prioritized tasks with detailed attack plans. ## Recently Completed (February 4, 2026) - [x] **Task #47: Improve Asset Manager Coverage**: - [x] **New Tests**: Added tests for unknown procedural functions, generation failures, and edge cases in `src/tests/test_assets.cc`. - [x] **Tooling Update**: Downgraded `asset_packer` validation error to warning to allow testing invalid assets. - [x] **Coverage Boost**: Increased `src/util/asset_manager.cc` coverage from 71% to 88%. - [x] **Task #46: Enhance Coverage Script**: Updated `scripts/gen_coverage_report.sh` to accept an optional directory argument for targeted coverage reports (e.g., `src/procedural`). - [x] **Task #45: Improve Procedural Generation Coverage**: - [x] **Unit Tests:** Implemented comprehensive tests for `gen_perlin`, `make_periodic`, and default parameter handling in `src/tests/test_procedural.cc`. - [x] **Coverage Boost:** Increased `src/procedural/generator.cc` coverage from 38% to 96%. - [x] **Task #44: Developer Tooling (Coverage)**: - [x] **Implement Code Coverage:** Added `DEMO_ENABLE_COVERAGE` CMake option and created `scripts/gen_coverage_report.sh` to generate HTML coverage reports using `lcov` on macOS. - [x] **Documentation:** Updated `doc/HOWTO.md` with usage instructions. - [x] **Skybox & Two-pass Rendering Stability**: - [x] **Fixed Two-pass Rendering:** Implemented mandatory clear operations for color and depth when the skybox is absent, preventing black screens and depth validation errors. - [x] **Implemented Rotating Skybox:** Added `inv_view_proj` to `GlobalUniforms` and updated the skybox shader to perform world-space ray unprojection, enabling correct rotation with the camera. - [x] **Enhanced Procedural Noise:** Implemented a multi-octave Value Noise generator for higher-quality skybox textures. - [x] **Scene Integrity:** Restored proper object indexing and removed redundant geometry, ensuring the floor grid and objects render correctly. ## Recently Completed (February 3, 2026) - [x] **Task #20: Platform & Code Hygiene**: - [x] **Header Consolidation:** Moved all `#ifdef` logic for WebGPU headers and platform-specific shims into `src/platform.h`. - [x] **Refactor platform_init:** Changed `void platform_init(PlatformState* state, ...)` to `PlatformState platform_init(...)` for cleaner value-based initialization. - [x] **Unified Poll:** Incorporated `time` and `aspect_ratio` updates into `platform_poll()`, abstracting away direct GLFW calls from main loop. - [x] **Standard Container Removal (AssetManager):** Replaced `std::map`, `std::string`, and `std::vector` in `AssetManager` and `procedural` generators with C-style alternatives (static arrays, raw pointers, malloc/free). - [x] **Music System Bug Fixes & Rock Track Implementation**: - [x] **Fixed Critical Pool Exhaustion Bug**: Tracker pool slots were never freed, causing music to stop after 8 patterns. Implemented round-robin slot allocation with proper cleanup. - [x] **Fixed Note Name Parsing**: Added automatic note-name-to-frequency conversion (E2→82.4Hz, A4→440Hz, etc.) in `tracker_compiler.cc`. Bass and melody now play correctly. - [x] **Fixed Timing Mismatch**: Patterns are 4 beats (2 seconds at 120 BPM), but SCORE was triggering every 4 seconds. Updated to trigger every 2 seconds for continuous playback. - [x] **Implemented Dynamic Resource Sizing**: `tracker_compiler` now analyzes scores to determine optimal MAX_VOICES/MAX_SPECTROGRAMS values (max simultaneous patterns: 5, recommended: 10 each). - [x] **Created Rock Demo Track**: 11 patterns (drums, bass, melody, power chords) with 49 triggers over 25 seconds, using 14 drum samples + 10 procedural notes. **Known Issues**: - Audio playback quality could be improved (some artifacts/cuts remain) - Note synthesis parameters (duration, harmonics) use default values - need tuning for better sound - Pattern overlaps might cause voice exhaustion under heavy load - No dynamic volume/envelope control for melodic notes ## Recently Completed (Previous) - [x] **Task #26: Shader Asset Testing & Validation**: - [x] **Attack Plan - `ShaderComposer` Unit Tests**: Add tests to `test_shader_composer.cc` to verify correct snippet registration, retrieval, and composition for various WGSL shader assets. - [x] **Attack Plan - Asset Content Validation**: Implement checks (e.g., in `test_assets.cc`) to ensure loaded WGSL shader assets are non-empty and contain expected entry points (`vs_main`, `fs_main`, `main` for compute shaders). - [x] **Attack Plan - Runtime Shader Validation**: Integrate basic validation steps into the rendering pipeline (e.g., in `gpu.cc`) to log warnings or errors if compiled shader modules are invalid, providing earlier feedback than WebGPU validation errors. - [x] **Asset Pipeline Improvement**: Automated audio asset conversion with a new `gen_spectrograms.sh` script and added 13 new samples to the asset list. - [x] **Build System Consolidation (Task #25)**: Modularized the build into subsystem libraries and implemented helper macros to simplify CMake maintenance. - [x] **Asset System Robustness**: Fixed static initialization order issues by wrapping the asset table in a singleton-style getter (`GetAssetRecordTable()`). - [x] **Shader Asset Integration (Task #24)**: Extracted hardcoded shaders to `.wgsl` assets, updated `asset_packer` for string safety, and refactored C++ code to use `GetAsset`. - [x] **WebGPU Stability & macOS Fixes**: Resolved surface creation failures by adding `GLFW_EXPOSE_NATIVE_COCOA` and fixed validation errors in surface configuration and render pass attachments. ## Priority 1: 3D System Enhancements (Task #18) **Goal:** Establish a pipeline for importing complex 3D scenes to replace hardcoded geometry. - [ ] **Task #36: Blender Exporter:** Create a Python script (`tools/blender_export.py`) to export meshes/cameras/lights to a binary asset format. - [ ] **Task #37: Asset Ingestion:** Update `asset_packer` to handle the new 3D binary format. - [ ] **Task #38: Runtime Loader:** Implement a minimal C++ parser to load the scene data into the ECS/Renderer. ## Priority 2: Developer Tooling & CI **Goal**: Improve developer workflows, code quality, and release processes. *(No active tasks)* ## Phase 2: Size Optimization (Final Goal) - [ ] **Task #34: Full STL Removal**: Replace all remaining `std::vector`, `std::map`, and `std::string` usage with custom minimal containers or C-style arrays to allow for CRT replacement. (Minimal Priority - deferred to end). - [ ] **Task #22: Windows Native Platform**: Replace GLFW with direct Win32 API calls for the final 64k push. - [ ] **Task #28: Spectrogram Quantization**: Research optimal frequency bin distribution and implement quantization. - [ ] **Task #35: CRT Replacement**: investigation and implementation of CRT-free entry point. ## Future Goals