summaryrefslogtreecommitdiff
path: root/src/gpu/effects/cnn_effect.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/effects/cnn_effect.h')
-rw-r--r--src/gpu/effects/cnn_effect.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/gpu/effects/cnn_effect.h b/src/gpu/effects/cnn_effect.h
new file mode 100644
index 0000000..9cc4935
--- /dev/null
+++ b/src/gpu/effects/cnn_effect.h
@@ -0,0 +1,29 @@
+// CNN post-processing effect header
+// Multi-layer neural network stylization
+
+#pragma once
+#include "gpu/effect.h"
+#include "gpu/uniform_helper.h"
+
+struct CNNLayerParams {
+ int layer_index;
+ int use_residual;
+ float _pad[2];
+};
+static_assert(sizeof(CNNLayerParams) == 16);
+
+class CNNEffect : public PostProcessEffect {
+ public:
+ explicit CNNEffect(const GpuContext& ctx, int num_layers = 1);
+
+ void init(MainSequence* demo) override;
+ void render(WGPURenderPassEncoder pass, float time, float beat,
+ float intensity, float aspect_ratio) override;
+ void update_bind_group(WGPUTextureView input_view) override;
+
+ private:
+ int num_layers_;
+ WGPUTextureView input_view_;
+ UniformBuffer<CNNLayerParams> params_buffer_;
+ WGPUBindGroup bind_group_;
+};