From 4c0907bf71150794f7b235f1c2abfab48e728df3 Mon Sep 17 00:00:00 2001 From: skal Date: Thu, 19 Mar 2026 20:57:15 +0100 Subject: docs: archive stale/completed docs, compact active refs (-1300 lines) - Archive WORKSPACE_SYSTEM.md (completed); replace with 36-line operational ref - Archive SHADER_REUSE_INVESTIGATION.md (implemented Feb 2026) - Archive GPU_PROCEDURAL_PHASE4.md (completed feature) - Archive GEOM_BUFFER.md (ideation only, never implemented) - Archive SPECTRAL_BRUSH_EDITOR.md (v1 DCT approach, superseded by MQ v2) - Update CLAUDE.md Tier 3 refs; point Audio to SPECTRAL_BRUSH_2.md - Update TODO.md Task #5 design link to SPECTRAL_BRUSH_2.md - Update COMPLETED.md archive index handoff(Claude): doc cleanup done, 30 active docs (was 34), -1300 lines --- doc/archive/GPU_PROCEDURAL_PHASE4.md | 70 ++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 doc/archive/GPU_PROCEDURAL_PHASE4.md (limited to 'doc/archive/GPU_PROCEDURAL_PHASE4.md') diff --git a/doc/archive/GPU_PROCEDURAL_PHASE4.md b/doc/archive/GPU_PROCEDURAL_PHASE4.md new file mode 100644 index 0000000..4cfc271 --- /dev/null +++ b/doc/archive/GPU_PROCEDURAL_PHASE4.md @@ -0,0 +1,70 @@ +# GPU Procedural Phase 4: Texture Composition + +**Status:** ✅ Complete + +## Implementation + +Multi-input composite shaders with configurable sampler support. + +### API + +```cpp +enum class SamplerType { + LinearClamp, LinearRepeat, NearestClamp, NearestRepeat +}; + +void create_gpu_composite_texture( + const std::string& name, + const std::string& shader_func, + const char* shader_code, + const void* uniform_data, + size_t uniform_size, + int width, int height, + const std::vector& input_names, + SamplerType sampler = SamplerType::LinearClamp); +``` + +### Shaders + +**gen_blend.wgsl** - Blend two textures with lerp factor: +- Bindings: output (0), uniform (1), input_a (2), input_b (3), sampler (4) +- Uniform: `{u32 width, height; f32 blend_factor, _pad0}` + +**gen_mask.wgsl** - Multiply textures (masking): +- Bindings: output (0), uniform (1), input_a (2), input_b (3), sampler (4) +- Uniform: `{u32 width, height}` + +### Usage + +```cpp +extern const char* gen_blend_compute_wgsl; + +struct { uint32_t width, height; float blend_factor, _pad0; } uni = {256, 256, 0.5f, 0.0f}; + +tex_mgr.create_gpu_composite_texture( + "blended", "gen_blend", gen_blend_compute_wgsl, + &uni, sizeof(uni), 256, 256, + {"noise_a", "noise_b"}, + SamplerType::LinearClamp); +``` + +### Features + +- **Dynamic bind groups:** N input textures + 1 sampler +- **Lazy sampler creation:** Map-based cache, 4 preset types +- **Multi-stage composition:** Composite of composites supported +- **Guarded with `#if !defined(STRIP_GPU_COMPOSITE)`** + +### Size Impact + +- Code: ~460 lines added +- Compressed: ~830 bytes (2 shaders + dispatch logic) + +### Tests + +`test_gpu_composite.cc`: +- Blend two noise textures +- Mask noise with grid +- Multi-stage composite (composite of composites) + +All 35 tests passing. -- cgit v1.2.3