summaryrefslogtreecommitdiff
path: root/src/shaders
AgeCommit message (Collapse)Author
9 daysfix: audio & effects cleanup — dead code removal, simplificationsskal
9 daysfix: code review cleanup — bugs, dead code, factorization (-167 lines)skal
Bugs: - B1: fix dead tempo debug (prev_tempo captured after assignment) - B2: fix ReloadAssetsFromFile leak for disk-loaded assets; simplify DropAsset - B3: fix get_free_pool_slot leak (unregister synth + free data on reuse) - B4: volatile -> std::atomic with acquire/release in miniaudio_backend, synth - B5: fix unaligned reads in scene_loader (memcpy-based read_f32/read_u32) - B6: fix shader module + BGL + pipeline layout leaks in gpu.cc, pipeline_builder Dead code: - D1: remove unused particle_defs.h - D3: remove create_post_process_pipeline_simple (zero callers) - D4: remove empty gpu_draw() - D5: remove write-only Hybrid3D::initialized_ - D6: remove legacy pending buffer path in audio.cc Factorization: - F1: Effect::run_fullscreen_pass() replaces boilerplate in 5 effects - F2: particle_common.wgsl snippet, #include in 3 WGSL shaders - F3: gpu_create_shader_module() helper, used in 3 call sites - F5: get_world_aabb() shared between bvh.cc and physics.cc - F6: samples_to_seconds() replaces 6 inline expressions - F7: gpu_create_linear/nearest_sampler use SamplerCache; add nearest() preset 37/37 tests passing. handoff(Claude): code review batch — all items verified, no regressions.
2026-03-22feat(shaders): add ray_sphere snippet, use in gbuf_raster impostorskal
2026-03-22refactor(shaders): extract oct-normal encode/decode into math/normal snippetskal
New src/shaders/math/normal.wgsl: oct_encode, oct_decode, oct_encode_unorm, oct_decode_unorm. Registered in InitShaderComposer as "math/normal". Removed inline copies from gbuf_raster.wgsl and gbuf_pack.wgsl. 18/18 tests passing.
2026-03-21make the heptagon effect more interestingskal
2026-03-11factorize render_ntsc()skal
2026-03-10fix(effects): particle sync and heptagon SDF bugsskal
- particles: stagger respawn y by golden-ratio index offset to break per-row synchronization (100 particles per row fell in lock-step) - heptagon: fix swapped atan2(x,y)->atan2(y,x) and WGSL % truncation for negative angles (broke SDF for entire lower half of shape) handoff(Gemini): heptagon now correct; particles desynchronized Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-10change dither_c64() signature to take 'dimension' directlyskal
2026-03-10ntsc: factor common code into snippet; add RGB and YIQ input variantsskal
- Extract shared NTSC logic into render/ntsc_common.wgsl snippet - sample_ntsc_signal() hook decouples input format from processing - ntsc_rgb.wgsl: RGB input (converts via rgba_to_luma_chroma_phase) - ntsc_yiq.wgsl: YIQ passthrough for RotatingCube output - Add NtscYiq WgslEffect thin wrapper; register both in tests handoff(Claude): NTSC refactor complete; NtscYiq ready for timeline use with RotatingCube. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-10rotating_cube: use VSOut, and store to yiqskal
2026-03-09NTSC: use 6-taps filtering instead of 12-tapskal
2026-03-09refactor: mv get_border_col() to color_c64.wgsl as get_border_c64()skal
2026-03-09refactor: extract YIQ and C64 dither to common WGSL shadersskal
- math/color.wgsl: add rgba_to_yiqa, yiqa_to_rgba, rgba_to_luma_chroma_phase - math/color_c64.wgsl: new file with C64 palette, Bayer 8x8, Dither() - ntsc.wgsl: include both, remove local duplicates; Dither() now takes xsize/ysize handoff(Claude): YIQ/dither helpers now reusable by other effects
2026-03-08ntsc effect for realskal
2026-03-08feat: extend debug_print with full ASCII and debug_str()skal
- Replace _dbg_pixel() with _dbg_char(ascii, r, c) covering printable ASCII 0x20-0x7E (95 glyphs, C64-style 8x8 bitmaps) - Update debug_f32() to use ASCII codes directly - Add debug_str(col, pos, origin, s: vec4u, len) for rendering up to 16 chars packed 4-per-u32 big-endian handoff(Claude): debug_print now supports full ASCII strings. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-08feat: add WGSL debug_f32() snippet with C64 8x8 fontskal
Renders a f32 value (±999.999, 3 decimal digits) at a given screen position using authentic C64 8x8 bitmap glyphs in yellow. Usage: col = debug_f32(col, pos.xy, vec2f(10.0, 10.0), value); Include: #include "debug/debug_print" handoff(Gemini): new snippet at src/shaders/debug/debug_print.wgsl Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-08fix(shaders): enforce y-up screen-space convention + document coordinate ↵skal
conventions - Add textureSampleYUp() helper to fullscreen_uv_vs.wgsl to correct y-flip when sampling WebGPU textures with y-up UV coordinates - Use textureSampleYUp() in passthrough, gaussian_blur, combined_postprocess - Fix skybox.wgsl: remove erroneous (1.0 - uv.y) flip (double-flip bug) - Document world/view/screen conventions in doc/3D.md, camera_common.wgsl, and fullscreen_uv_vs.wgsl Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-06feat(effects): add Scratch post-process effect with reusable scratch_lines ↵skal
snippet - src/shaders/render/scratch_lines.wgsl: reusable WGSL snippet registered as "render/scratch_lines"; call scratch_lines(uv, resolution, time)->f32 from any effect. Uses hash_1f from math/noise; 8 lines/frame, ~24fps flicker. - src/effects/scratch.{wgsl,h,cc}: thin Scratch effect wrapping the snippet. - Applied to "intro" and "rotating_cube" sequences as the final step. - 35/35 tests passing. handoff(Gemini): Scratch effect added. render/scratch_lines snippet is reusable. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-28refactor: move common/shaders/ to src/shaders/skal
Relocates shared WGSL shaders under src/ where all source code lives, eliminating the top-level common/ directory. - Update asset references in workspaces/main/assets.txt and workspaces/test/assets.txt - Update docs: PROJECT_CONTEXT.md, ARCHITECTURE.md, WORKSPACE_SYSTEM.md, SHADER_REUSE_INVESTIGATION.md Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>