diff options
| author | skal <pascal.massimino@gmail.com> | 2026-05-20 22:44:44 +0200 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-05-20 22:44:44 +0200 |
| commit | 5d20c892dedce7bc7486acbd72fbd35da69e413e (patch) | |
| tree | 05e04d5e689504c2421cd5772e91a42ee69608ab /src/gpu/post_process_helper.cc | |
| parent | 6ef8f578817ee0134fd5867ca3b80590e3eb2368 (diff) | |
fix: code review cleanup — bugs, dead code, factorization (-167 lines)
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.
Diffstat (limited to 'src/gpu/post_process_helper.cc')
| -rw-r--r-- | src/gpu/post_process_helper.cc | 34 |
1 files changed, 7 insertions, 27 deletions
diff --git a/src/gpu/post_process_helper.cc b/src/gpu/post_process_helper.cc index 79fda20..871a238 100644 --- a/src/gpu/post_process_helper.cc +++ b/src/gpu/post_process_helper.cc @@ -39,33 +39,13 @@ WGPURenderPipeline create_post_process_pipeline(WGPUDevice device, return pipeline; } -// Helper to create a simple post-processing pipeline (no effect params) -WGPURenderPipeline -create_post_process_pipeline_simple(WGPUDevice device, WGPUTextureFormat format, - const char* shader_code) { - // Headless mode: skip pipeline creation (compiled out in STRIP_ALL) - HEADLESS_RETURN_VAL_IF_NULL(device, nullptr); - - WGPUBindGroupLayout bgl = - BindGroupLayoutBuilder() - .sampler(PP_BINDING_SAMPLER, WGPUShaderStage_Fragment) - .texture(PP_BINDING_TEXTURE, WGPUShaderStage_Fragment) - .uniform(PP_BINDING_UNIFORMS, - WGPUShaderStage_Vertex | WGPUShaderStage_Fragment) - .build(device); - - const std::string composed_shader = - ShaderComposer::Get().Compose({}, shader_code); - - WGPURenderPipeline pipeline = RenderPipelineBuilder(device) - .shader(composed_shader.c_str()) - .bind_group_layout(bgl) - .format(format) - .build(); - - wgpuBindGroupLayoutRelease(bgl); - return pipeline; -} +// NOTE: create_post_process_pipeline_simple() was removed (zero callers). +// If a 3-binding pipeline is needed in the future, add a `bool use_effect_params` +// parameter to create_post_process_pipeline() instead. +// Example: +// WGPURenderPipeline p = create_post_process_pipeline(device, format, code); +// // Then pass {nullptr, 0} as effect_params to pp_update_bind_group — +// // the dummy buffer fallback handles it automatically. void gpu_upload_mat4(WGPUQueue queue, WGPUBuffer buffer, size_t offset, const mat4& m) { |
