summaryrefslogtreecommitdiff
path: root/src/gpu/effects/cnn_effect.h
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-11 11:46:53 +0100
committerskal <pascal.massimino@gmail.com>2026-02-11 11:46:53 +0100
commitc809790015b4ddc354c6b1993a633eddd042930f (patch)
treecb89e52e0c3b804b62544941e5cfc9b7d9ffc0c1 /src/gpu/effects/cnn_effect.h
parent5fb1bcc25fef7388a2d68be6c1f062bcf996fd85 (diff)
refactor: Use lazy initialization for auxiliary textures
Prevents init/resize ordering bug and avoids unnecessary reallocation. Changes: - Auxiliary textures created on first use (compute/update_bind_group) - Added ensure_texture() methods to defer registration until resize() - Added early return in resize() if dimensions unchanged - Removed texture registration from init() methods Benefits: - No reallocation on window resize if dimensions match - Texture created with correct dimensions from start - Memory saved if effect never renders Tests: All 36 tests passing Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Diffstat (limited to 'src/gpu/effects/cnn_effect.h')
-rw-r--r--src/gpu/effects/cnn_effect.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/gpu/effects/cnn_effect.h b/src/gpu/effects/cnn_effect.h
index 1c9f0f3..f79fac7 100644
--- a/src/gpu/effects/cnn_effect.h
+++ b/src/gpu/effects/cnn_effect.h
@@ -35,9 +35,12 @@ class CNNEffect : public PostProcessEffect {
}
private:
+ void ensure_texture();
+
int layer_index_;
int total_layers_;
float blend_amount_;
+ bool texture_initialized_ = false;
WGPUTextureView input_view_;
WGPUTextureView original_view_;
UniformBuffer<CNNLayerParams> params_buffer_;