From 744bcadfe8f4bb1b2d4f1daf9f880fa511d65405 Mon Sep 17 00:00:00 2001 From: skal Date: Mon, 9 Feb 2026 13:59:07 +0100 Subject: feat(gpu): Phase 2 - Add gen_perlin and gen_grid GPU compute shaders 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 --- tools/asset_packer.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'tools/asset_packer.cc') diff --git a/tools/asset_packer.cc b/tools/asset_packer.cc index 72592ae..4aaa0e7 100644 --- a/tools/asset_packer.cc +++ b/tools/asset_packer.cc @@ -230,9 +230,11 @@ int main(int argc, char* argv[]) { } // Validate GPU procedural function name - if (info.proc_func_name != "gen_noise") { + if (info.proc_func_name != "gen_noise" && + info.proc_func_name != "gen_perlin" && + info.proc_func_name != "gen_grid") { fprintf(stderr, - "Error: PROC_GPU only supports gen_noise, got: %s for asset: %s\n", + "Error: PROC_GPU only supports gen_noise, gen_perlin, gen_grid, got: %s for asset: %s\n", info.proc_func_name.c_str(), info.name.c_str()); return 1; } -- cgit v1.2.3