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.cc17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/gpu/effects/cnn_effect.cc b/src/gpu/effects/cnn_effect.cc
index e12c26f..3f6d3b3 100644
--- a/src/gpu/effects/cnn_effect.cc
+++ b/src/gpu/effects/cnn_effect.cc
@@ -53,6 +53,9 @@ void CNNEffect::init(MainSequence* demo) {
demo_ = demo;
params_buffer_.init(ctx_.device);
+ // Initialize uniforms BEFORE any bind group creation
+ uniforms_.update(ctx_.queue, get_common_uniforms());
+
// Register captured_frame texture (used by all layers for original input)
if (layer_index_ == 0) {
demo_->register_auxiliary_texture("captured_frame", width_, height_);
@@ -62,8 +65,9 @@ void CNNEffect::init(MainSequence* demo) {
params_buffer_.update(ctx_.queue, params);
}
-void CNNEffect::render(WGPURenderPassEncoder pass, float time, float beat,
- float intensity, float aspect_ratio) {
+void CNNEffect::render(WGPURenderPassEncoder pass,
+ const CommonPostProcessUniforms& uniforms) {
+ (void)uniforms;
if (!bind_group_) {
fprintf(stderr, "CNN render: no bind_group\n");
return;
@@ -78,14 +82,7 @@ void CNNEffect::update_bind_group(WGPUTextureView input_view) {
input_view_ = input_view;
// Update common uniforms (CRITICAL for UV calculation!)
- const CommonPostProcessUniforms u = {
- .resolution = {(float)width_, (float)height_},
- .aspect_ratio = (float)width_ / (float)height_,
- .time = 0.0f,
- .beat = 0.0f,
- .audio_intensity = 0.0f,
- };
- uniforms_.update(ctx_.queue, u);
+ uniforms_.update(ctx_.queue, get_common_uniforms());
// All layers: get captured frame (original input from layer 0)
if (demo_) {