summaryrefslogtreecommitdiff
path: root/src/gpu/texture_manager.h
AgeCommit message (Collapse)Author
23 hoursrefactor: Generic sampler system for compositesskal
Replace hardcoded linear_sampler_ with configurable sampler map. - SamplerType enum (LinearClamp, LinearRepeat, NearestClamp, NearestRepeat) - get_or_create_sampler() for lazy sampler creation - Default to LinearClamp for backward compatibility Eliminates hardcoded assumptions, more flexible for future use cases.
23 hoursfeat: GPU procedural Phase 4 - texture compositionskal
Multi-input composite shaders with sampler support. - Dynamic bind group layouts (N input textures + 1 sampler) - dispatch_composite() for multi-input compute dispatch - create_gpu_composite_texture() API - gen_blend.wgsl and gen_mask.wgsl shaders Guarded with #if !defined(STRIP_GPU_COMPOSITE) for easy removal. Tests: - Blend two noise textures - Mask noise with grid - Multi-stage composite (composite of composites) Size: ~830 bytes (2 shaders + dispatch logic) handoff(Claude): GPU procedural Phase 4 complete
23 hoursrefactor: Unify TextureManager compute pipeline managementskal
Replace individual pipeline pointers with map-based system. - Changed from 3 pointers to std::map<string, ComputePipelineInfo> - Unified get_or_create_compute_pipeline() for lazy init - Unified dispatch_compute() for all shaders - Simplified create_gpu_*_texture() methods (~390 lines removed) handoff(Claude): GPU procedural texture refactoring complete
24 hoursfeat(gpu): Phase 2 - Add gen_perlin and gen_grid GPU compute shadersskal
Complete Phase 2 implementation: - gen_perlin.wgsl: FBM with configurable octaves, amplitude decay - gen_grid.wgsl: Grid pattern with configurable spacing/thickness - TextureManager extensions: create_gpu_perlin_texture(), create_gpu_grid_texture() - Asset packer now validates gen_noise, gen_perlin, gen_grid for PROC_GPU() - 3 compute pipelines (lazy-init on first use) Shader parameters: - gen_perlin: seed, frequency, amplitude, amplitude_decay, octaves (32 bytes) - gen_grid: width, height, grid_size, thickness (16 bytes) test_3d_render migration: - Replaced CPU sky texture (gen_perlin) with GPU version - Replaced CPU noise texture (gen_noise) with GPU version - Added new GPU grid texture (256x256, 32px grid, 2px lines) Size impact: - gen_perlin.wgsl: ~200 bytes (compressed) - gen_grid.wgsl: ~100 bytes (compressed) - Total Phase 2 code: ~300 bytes - Cumulative (Phase 1+2): ~600 bytes Testing: - All 34 tests passing (100%) - test_gpu_procedural validates all generators - test_3d_render uses 3 GPU textures (noise, perlin, grid) Next: Phase 3 - Variable dimensions, async generation, pipeline caching Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
24 hoursfeat(gpu): Add GPU procedural texture generation systemskal
Phase 1 implementation complete: - GPU compute shader for noise generation (gen_noise.wgsl) - TextureManager extensions: create_gpu_noise_texture(), dispatch_noise_compute() - Asset packer PROC_GPU() syntax support with validation - ShaderComposer integration for #include resolution - Zero CPU memory overhead (GPU-only textures) - Init-time and on-demand generation modes Technical details: - 8×8 workgroup size for 256×256 textures - UniformBuffer for params (width, height, seed, frequency) - Storage texture binding (rgba8unorm, write-only) - Lazy pipeline compilation on first use - ~300 bytes code (Phase 1) Testing: - New test: test_gpu_procedural.cc (passes) - All 34 tests passing (100%) Future phases: - Phase 2: Add gen_perlin, gen_grid compute shaders - Phase 3: Variable dimensions, async generation Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
7 daysfeat: side-quest - Perlin noise sky and ProcGenFunc error handlingskal
- Updated ProcGenFunc signature to return bool for error reporting. - Implemented gen_perlin (Fractional Brownian Motion) in procedural/generator.cc. - Added support for sky texture in Renderer3D and its shader. - Integrated Perlin noise sky texture in test_3d_render.cc. - Caught and handled memory/generation errors in AssetManager and TextureManager. - Assigned reference numbers to all remaining tasks in documentation. handoff(Gemini): Side-quest complete. ProcGenFunc now returns bool. Perlin noise added and used for sky in 3D test. Windows build remains stable. All tasks numbered.
7 daysrefactor: Task #20 - Platform & Code Hygieneskal
- Consolidated all WebGPU shims and platform-specific logic into src/platform.h. - Refactored platform_init to return PlatformState by value and platform_poll to automatically refresh time and aspect_ratio. - Removed STL dependencies (std::map, std::vector, std::string) from AssetManager and Procedural subsystems. - Fixed Windows cross-compilation by adjusting include paths and linker flags in CMakeLists.txt and updating build_win.sh. - Removed redundant direct inclusions of GLFW/glfw3.h and WebGPU headers across the project. - Applied clang-format and updated documentation. handoff(Gemini): Completed Task #20 and 20.1. Platform abstraction is now unified, and core paths are STL-free. Windows build is stable.
9 daysfeat(gpu/assets): Fix tests, integrate bumpy 3D renderer and procedural assetsskal
- Fixed test_sequence by restoring MainSequence::init_test for mocking. - Corrected CMakeLists.txt dependencies and source groupings to prevent duplicate symbols. - standardizing Effect constructor signature for seq_compiler compatibility. - Implemented Hybrid3DEffect using bumpy Renderer3D and procedural NOISE_TEX. - Updated MainSequence to support depth buffer for 3D elements. - Formatted all source files with clang-format.
9 daysfeat(gpu): Integrate bumpy 3D renderer into main demoskal
- Added depth buffer support to MainSequence. - Implemented Hybrid3DEffect for the main timeline. - Fixed effect initialization order in MainSequence. - Ensured depth-stencil compatibility for all scene effects. - Updated demo sequence with 3D elements and post-processing.
9 daysfeat: Implement 3D system and procedural texture managerskal
- Extended mini_math.h with mat4 multiplication and affine transforms. - Implemented TextureManager for runtime procedural texture generation and GPU upload. - Added 3D system components: Camera, Object, Scene, and Renderer3D. - Created test_3d_render mini-demo for interactive 3D verification. - Fixed WebGPU validation errors regarding depthSlice and unimplemented WaitAny.