summaryrefslogtreecommitdiff
path: root/src/gpu/sampler_cache.h
AgeCommit message (Collapse)Author
29 hoursrefactor(headless): convert nullptr checks to strippable macrosskal
Added HEADLESS_RETURN_IF_NULL/HEADLESS_RETURN_VAL_IF_NULL macros that compile to no-ops in STRIP_ALL/FINAL_STRIP modes. Files updated: - fatal_error.h: New headless check macros - sequence.cc: NodeRegistry::create_texture - post_process_helper.cc: Pipeline creation functions - sampler_cache.h: SamplerCache::get_or_create - bind_group_builder.h: Layout/group builders - pipeline_builder.h: Shader and pipeline builders - All effect constructors (7 files) Headless tests passing. STRIP_ALL builds will have zero overhead. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
29 hoursfix(headless): add nullptr checks for GPU resource creationskal
- NodeRegistry::create_texture: skip texture creation when device is nullptr - Post-process helpers: skip pipeline/bind group creation in headless mode - SamplerCache: return nullptr for headless mode - BindGroupLayoutBuilder/BindGroupBuilder: skip creation with null device - RenderPipelineBuilder: skip shader module and pipeline creation in headless - PlaceholderEffect: skip sampler creation in headless mode - RotatingCubeEffect: early return in constructor for headless mode WIP: Some effects (GaussianBlur, etc.) still need headless checks Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
3 daysstyle: Apply clang-format to codebaseskal
6 daysfix: Release cached samplers before WGPU shutdownskal
SamplerCache singleton never released samplers, causing device to retain references at shutdown. Add clear() method and call before fixture cleanup. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
7 daysrefactor: Factor WGPU boilerplate into builder pattern helpersskal
Add BindGroupLayoutBuilder, BindGroupBuilder, RenderPipelineBuilder, and SamplerCache to reduce repetitive WGPU code. Refactor post_process_helper, cnn_effect, and rotating_cube_effect. Changes: - Bind group creation: 19 instances, 14→4 lines each - Pipeline creation: 30-50→8 lines - Sampler deduplication: 6 instances → cached - Total boilerplate reduction: -122 lines across 3 files Builder pattern prevents binding index errors and consolidates platform-specific #ifdef in fewer locations. Binary size unchanged (6.3M debug). Tests pass. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>