summaryrefslogtreecommitdiff
path: root/src/gpu/effects
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-08 19:09:05 +0100
committerskal <pascal.massimino@gmail.com>2026-02-08 19:09:05 +0100
commitcd807732799904f6731f460cc0469143c410c2c9 (patch)
tree7eb49f0cd5eee9a9d4aabf2f9d64f053c081f70c /src/gpu/effects
parent63c391e803318158f239c02df5f53244bfd6a074 (diff)
feat(gpu): Add WGSL noise and hash function library (Task #59)
Implements comprehensive RNG and noise functions for procedural shader effects: Hash Functions: - hash_1f, hash_2f, hash_3f (float-based, fast) - hash_2f_2f, hash_3f_3f (vector output) - hash_1u, hash_1u_2f, hash_1u_3f (integer-based, high quality) Noise Functions: - noise_2d, noise_3d (value noise with smoothstep) - fbm_2d, fbm_3d (fractional Brownian motion) - gyroid (periodic minimal surface) Integration: - Added to ShaderComposer as "math/noise" snippet - Available via #include "math/noise" in WGSL shaders - Test suite validates all 11 functions compile Testing: - test_noise_functions.cc validates shader loading - All 33 tests pass (100%) Size Impact: ~200-400 bytes per function used (dead-code eliminated) Files: - assets/final/shaders/math/noise.wgsl (new, 4.2KB, 150 lines) - assets/final/demo_assets.txt (added SHADER_MATH_NOISE) - assets/final/test_assets_list.txt (added SHADER_MATH_NOISE) - src/gpu/effects/shaders.cc (registered snippet) - src/tests/test_noise_functions.cc (new test) - CMakeLists.txt (added test target) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Diffstat (limited to 'src/gpu/effects')
-rw-r--r--src/gpu/effects/shaders.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/gpu/effects/shaders.cc b/src/gpu/effects/shaders.cc
index 380b5b4..ce60a74 100644
--- a/src/gpu/effects/shaders.cc
+++ b/src/gpu/effects/shaders.cc
@@ -35,6 +35,7 @@ void InitShaderComposer() {
register_if_exists("math/sdf_utils", AssetId::ASSET_SHADER_MATH_SDF_UTILS);
register_if_exists("math/common_utils",
AssetId::ASSET_SHADER_MATH_COMMON_UTILS);
+ register_if_exists("math/noise", AssetId::ASSET_SHADER_MATH_NOISE);
register_if_exists("render/shadows", AssetId::ASSET_SHADER_RENDER_SHADOWS);
register_if_exists("render/scene_query_bvh",
AssetId::ASSET_SHADER_RENDER_SCENE_QUERY_BVH);