diff options
Diffstat (limited to 'src/gpu/effects/cnn_v2_effect.h')
| -rw-r--r-- | src/gpu/effects/cnn_v2_effect.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/gpu/effects/cnn_v2_effect.h b/src/gpu/effects/cnn_v2_effect.h index 6005cf5..4389e4f 100644 --- a/src/gpu/effects/cnn_v2_effect.h +++ b/src/gpu/effects/cnn_v2_effect.h @@ -5,9 +5,14 @@ #include "gpu/effect.h" #include <vector> +struct CNNv2EffectParams { + float blend_amount = 1.0f; +}; + class CNNv2Effect : public PostProcessEffect { public: explicit CNNv2Effect(const GpuContext& ctx); + explicit CNNv2Effect(const GpuContext& ctx, const CNNv2EffectParams& params); ~CNNv2Effect(); void init(MainSequence* demo) override; @@ -18,6 +23,11 @@ public: const CommonPostProcessUniforms& uniforms) override; void update_bind_group(WGPUTextureView input_view) override; + void set_beat_modulation(bool enabled, float scale = 1.0f) { + beat_modulated_ = enabled; + beat_scale_ = scale; + } + private: struct LayerInfo { uint32_t kernel_size; @@ -33,6 +43,7 @@ private: uint32_t out_channels; uint32_t weight_offset; uint32_t is_output_layer; + float blend_amount; }; void create_textures(); @@ -49,7 +60,7 @@ private: // CNN layers (storage buffer architecture) WGPUComputePipeline layer_pipeline_; // Single pipeline for all layers WGPUBuffer weights_buffer_; // Storage buffer for weights - WGPUBuffer layer_params_buffer_; // Uniform buffer for per-layer params + std::vector<WGPUBuffer> layer_params_buffers_; // Uniform buffers (one per layer) std::vector<LayerInfo> layer_info_; // Layer metadata std::vector<WGPUBindGroup> layer_bind_groups_; // Per-layer bind groups std::vector<WGPUTexture> layer_textures_; // Ping-pong buffers @@ -60,5 +71,8 @@ private: WGPUTextureView input_mip_view_[3]; WGPUTextureView current_input_view_; + float blend_amount_ = 1.0f; + bool beat_modulated_ = false; + float beat_scale_ = 1.0f; bool initialized_; }; |
