summaryrefslogtreecommitdiff
path: root/src/gpu/effects/cnn_effect.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/effects/cnn_effect.cc')
-rw-r--r--src/gpu/effects/cnn_effect.cc16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/gpu/effects/cnn_effect.cc b/src/gpu/effects/cnn_effect.cc
index 8673127..b2305b2 100644
--- a/src/gpu/effects/cnn_effect.cc
+++ b/src/gpu/effects/cnn_effect.cc
@@ -53,6 +53,11 @@ void CNNEffect::init(MainSequence* demo) {
demo_ = demo;
params_buffer_.init(ctx_.device);
+ // Register auxiliary texture for layer 0 (width_/height_ set by resize())
+ if (layer_index_ == 0) {
+ demo_->register_auxiliary_texture("captured_frame", width_, height_);
+ }
+
// Initialize uniforms BEFORE any bind group creation
uniforms_.update(ctx_.queue, get_common_uniforms());
@@ -60,13 +65,6 @@ void CNNEffect::init(MainSequence* demo) {
params_buffer_.update(ctx_.queue, params);
}
-void CNNEffect::ensure_texture() {
- if (!texture_initialized_ && layer_index_ == 0 && demo_) {
- demo_->register_auxiliary_texture("captured_frame", width_, height_);
- texture_initialized_ = true;
- }
-}
-
void CNNEffect::resize(int width, int height) {
if (width == width_ && height == height_)
return;
@@ -74,7 +72,7 @@ void CNNEffect::resize(int width, int height) {
PostProcessEffect::resize(width, height);
// Only layer 0 owns the captured_frame texture
- if (layer_index_ == 0 && demo_ && texture_initialized_) {
+ if (layer_index_ == 0 && demo_) {
demo_->resize_auxiliary_texture("captured_frame", width, height);
}
}
@@ -93,8 +91,6 @@ void CNNEffect::render(WGPURenderPassEncoder pass,
}
void CNNEffect::update_bind_group(WGPUTextureView input_view) {
- ensure_texture();
-
input_view_ = input_view;
// Update common uniforms (CRITICAL for UV calculation!)