diff options
| -rw-r--r-- | PROJECT_CONTEXT.md | 6 | ||||
| -rw-r--r-- | TODO.md | 11 | ||||
| -rw-r--r-- | doc/ASSET_SYSTEM.md | 11 |
3 files changed, 26 insertions, 2 deletions
diff --git a/PROJECT_CONTEXT.md b/PROJECT_CONTEXT.md index a0dd4a6..19e704a 100644 --- a/PROJECT_CONTEXT.md +++ b/PROJECT_CONTEXT.md @@ -34,6 +34,12 @@ Style: - [ ] Consolidate WebGPU header inclusions. - [ ] Remove `std::map`/`std::vector` from hot paths. +- **Task #24: Shader Asset Integration** + - [ ] Extract hardcoded WGSL strings into `assets/final/shaders/`. + - [ ] Register shader assets in `demo_assets.txt`. + - [ ] Update `ShaderComposer` to load snippets from `AssetManager`. + - [ ] Refactor `Renderer3D` and `demo64k` to use asset-based shaders. + - **Task #18: 3D System Enhancements** - [ ] **Blender Exporter**: Create script to export scenes to internal binary format. - [ ] **Asset Pipeline**: Update `asset_packer` and runtime loader for 3D scenes. @@ -9,13 +9,20 @@ This file tracks prioritized tasks with detailed attack plans. - [ ] **Attack Plan - Unified Poll:** Incorporate `platform_get_time()` and `platform_get_aspect_ratio()` updates into `platform_poll()`. - [ ] **Attack Plan - Standard Container Removal:** Replace `std::map`, `std::string`, and `std::vector` in performance-critical or size-sensitive paths with simpler C-style alternatives. -## Priority 2: 3D System Enhancements (Task #18) +## Priority 2: Shader Asset Integration (Task #24) +**Goal:** Treat shader snippets as regular assets managed by `AssetManager` and `ShaderComposer`. +- [ ] **Attack Plan - Extract Shaders:** Move hardcoded WGSL strings (from `renderer.cc`, `gpu.cc`) into `assets/final/shaders/*.wgsl`. +- [ ] **Attack Plan - Asset Entry:** Add new shader files to `assets/final/demo_assets.txt` and `test_assets_list.txt`. +- [ ] **Attack Plan - ShaderComposer Update:** Update `ShaderComposer` to optionally register snippets from `AssetId`. +- [ ] **Attack Plan - Integration:** Update `Renderer3D` and `demo64k` to use `ShaderComposer` with asset-based snippets. + +## Priority 3: 3D System Enhancements (Task #18) **Goal:** Establish a pipeline for importing complex 3D scenes to replace hardcoded geometry. - [ ] **Attack Plan - Blender Exporter:** Create a Python script (`tools/blender_export.py`) to export meshes/cameras/lights to a binary asset format. - [ ] **Attack Plan - Asset Ingestion:** Update `asset_packer` to handle the new 3D binary format. - [ ] **Attack Plan - Runtime Loader:** Implement a minimal C++ parser to load the scene data into the ECS/Renderer. -## Priority 3: Shader Optimization (Task #21) +## Priority 4: Shader Optimization (Task #21) **Goal:** Improve GPU performance and reduce shader source bloat. - [ ] **Attack Plan - Normal Factorization:** Create a standard WGSL helper for normal calculation to avoid duplicate code in every effect. - [ ] **Attack Plan - Tri-planar Mapping:** Implement bi/tri-planar mapping for procedural textures to improve visual quality on complex SDFs. diff --git a/doc/ASSET_SYSTEM.md b/doc/ASSET_SYSTEM.md index 250be07..bd5a266 100644 --- a/doc/ASSET_SYSTEM.md +++ b/doc/ASSET_SYSTEM.md @@ -55,3 +55,14 @@ we need a simple tool that: * generates the assets_data.cc file with all the data * put these in the source tree * this process needs a script for automation + +# Shader Snippets + +Shader code (WGSL) can also be managed as assets. +1. Create `.wgsl` files in `assets/final/shaders/` (or similar). +2. Add them to `assets/final/demo_assets.txt` with compression `NONE`. + Example: `SHADER_COMMON, shaders/common.wgsl, NONE` +3. In C++, retrieve them using `GetAsset()`. Since they are binary blobs, + construct a `std::string` or `std::string_view` using the returned pointer + and size. +4. Register them with the `ShaderComposer`. |
