diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-14 15:26:55 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-14 15:26:55 +0100 |
| commit | 0127c747a41f972fd68e3e6e6b472859bfdb80dd (patch) | |
| tree | 85d7277dbce1581f583a259368471e874b372a19 /src/tests/gpu | |
| parent | de7514e6b9ff9c0b9320975ba7d44754b5115b54 (diff) | |
refactor(wgsl): consolidate SDF shapes into single common file
Merge sdf_primitives.wgsl into math/sdf_shapes.wgsl to eliminate
duplication and establish single source of truth for all SDF functions.
Changes:
- Delete common/shaders/sdf_primitives.wgsl (duplicate of math/sdf_shapes.wgsl)
- Add sdBox2D() and sdEllipse() to math/sdf_shapes.wgsl
- Update ellipse.wgsl (main/test) to use #include "math/sdf_shapes"
- Update scene1.wgsl to use math/sdf_shapes instead of sdf_primitives
- Rename asset SHADER_SDF_PRIMITIVES → SHADER_SDF_SHAPES
- Update shader registration and tests
Impact:
- ~60 lines eliminated from ellipse shaders
- Single source for 3D primitives (sphere, box, torus, plane) and 2D (box, ellipse)
- Consistent include path across codebase
All tests passing (34/34).
handoff(Claude): SDF shapes consolidated to math/sdf_shapes.wgsl
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Diffstat (limited to 'src/tests/gpu')
| -rw-r--r-- | src/tests/gpu/test_shader_assets.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/tests/gpu/test_shader_assets.cc b/src/tests/gpu/test_shader_assets.cc index 1736dc0..135c477 100644 --- a/src/tests/gpu/test_shader_assets.cc +++ b/src/tests/gpu/test_shader_assets.cc @@ -42,8 +42,8 @@ int main() { all_passed &= validate_shader(AssetId::ASSET_SHADER_COMMON_UNIFORMS, "COMMON_UNIFORMS", {"struct", "GlobalUniforms"}); - all_passed &= validate_shader(AssetId::ASSET_SHADER_SDF_PRIMITIVES, - "SDF_PRIMITIVES", {"fn", "sd"}); + all_passed &= validate_shader(AssetId::ASSET_SHADER_SDF_SHAPES, + "SDF_SHAPES", {"fn", "sd"}); all_passed &= validate_shader(AssetId::ASSET_SHADER_LIGHTING, "LIGHTING", {"fn", "calc"}); all_passed &= validate_shader(AssetId::ASSET_SHADER_RAY_BOX, "RAY_BOX", |
