diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-17 13:05:11 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-17 13:05:11 +0100 |
| commit | bdb1a4e95a545f3f4d88630b8aec6ab771776d99 (patch) | |
| tree | 97a3a15381a7ff9780644ec8876535dd219f23cf /src/gpu/effect.cc | |
| parent | a32c7456588abf4f44866d0c055fa94d105e8ef7 (diff) | |
refactor(effects): Streamline uniforms initialization
Centralized uniforms_buffer_ initialization and updates to Effect base class:
- init_uniforms_buffer() now automatic in Effect::Effect()
- uniforms_buffer_.update() now automatic in dispatch_render()
- Removed redundant calls from all effect subclasses
- Updated effect.h comments to reflect automatic behavior
- Updated EFFECT_WORKFLOW.md templates
Benefits:
- 16 lines removed from effect implementations
- Consistent pattern enforced at compile time
- Reduced boilerplate for new effects
Tests: 34/34 passing
handoff(Claude): Effect base class now handles uniforms automatically
Diffstat (limited to 'src/gpu/effect.cc')
| -rw-r--r-- | src/gpu/effect.cc | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/gpu/effect.cc b/src/gpu/effect.cc index d0693ec..a94b4a0 100644 --- a/src/gpu/effect.cc +++ b/src/gpu/effect.cc @@ -15,6 +15,7 @@ Effect::Effect(const GpuContext& ctx, const std::vector<std::string>& inputs, FATAL_CHECK(start_time <= end_time, "Invalid time range: %f > %f\n", start_time, end_time); HEADLESS_RETURN_IF_NULL(ctx_.device); + uniforms_buffer_.init(ctx_.device); } void Effect::dispatch_render(WGPUCommandEncoder encoder, @@ -28,6 +29,7 @@ void Effect::dispatch_render(WGPUCommandEncoder encoder, if (!active && input_nodes_.size() == 1 && output_nodes_.size() == 1) { blit_input_to_output(encoder, nodes); } else if (active) { + uniforms_buffer_.update(ctx_.queue, params); render(encoder, params, nodes); } // Multi-output effects: output undefined when inactive (validated at compile time) @@ -57,10 +59,6 @@ void Effect::blit_input_to_output(WGPUCommandEncoder encoder, &extent); } -void Effect::init_uniforms_buffer() { - uniforms_buffer_.init(ctx_.device); -} - void Effect::create_linear_sampler() { sampler_.set(gpu_create_linear_sampler(ctx_.device)); } |
