summaryrefslogtreecommitdiff
path: root/src/tests/webgpu_test_fixture.cc
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-08 19:14:55 +0100
committerskal <pascal.massimino@gmail.com>2026-02-08 19:14:55 +0100
commitb7d282249394a8c0a48d5dfe5af410b541c724cc (patch)
tree19020b59ae03b5029db33cee8932589c92bde11e /src/tests/webgpu_test_fixture.cc
parent6071c9f6bea2d3890024cb47083b92d9ddbf0447 (diff)
refactor(procedural): Use hash-based noise instead of lattice approach
Replaces lattice-based noise generation with deterministic hash functions matching the WGSL implementation. Eliminates heap allocations and rand() dependency. Changes: - Added hash_2f() and noise_2d() C++ functions (matches WGSL) - Refactored gen_perlin() to use hash-based FBM (no malloc/free) - Refactored gen_noise() to use hash_based value noise - Removed all rand()/srand() calls (now deterministic via seed offset) - Eliminated lattice allocation/deallocation per octave Benefits: - Zero heap allocations (was allocating lattice per octave) - Deterministic output (seed-based, not rand-based) - 28% smaller code (270 → 194 lines, -75 lines) - Matches WGSL noise implementation behavior - Faster (no malloc overhead, better cache locality) Testing: - All 33 tests pass (100%) - test_procedural validates noise/perlin/grid generation - No visual regressions Size Impact: ~200-300 bytes smaller (malloc/free overhead eliminated) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Diffstat (limited to 'src/tests/webgpu_test_fixture.cc')
0 files changed, 0 insertions, 0 deletions