summaryrefslogtreecommitdiff
path: root/cnn_v1/src
diff options
context:
space:
mode:
Diffstat (limited to 'cnn_v1/src')
-rw-r--r--cnn_v1/src/cnn_v1_effect.cc (renamed from cnn_v1/src/cnn_effect.cc)18
-rw-r--r--cnn_v1/src/cnn_v1_effect.h (renamed from cnn_v1/src/cnn_effect.h)14
2 files changed, 16 insertions, 16 deletions
diff --git a/cnn_v1/src/cnn_effect.cc b/cnn_v1/src/cnn_v1_effect.cc
index 49c5239..1f44619 100644
--- a/cnn_v1/src/cnn_effect.cc
+++ b/cnn_v1/src/cnn_v1_effect.cc
@@ -1,7 +1,7 @@
// CNN post-processing effect implementation
// Neural network-based stylization with modular WGSL
-#include "effects/cnn_effect.h"
+#include "cnn_v1_effect.h"
#include "gpu/bind_group_builder.h"
#include "gpu/effect.h"
#include "gpu/pipeline_builder.h"
@@ -33,7 +33,7 @@ static WGPURenderPipeline create_cnn_pipeline(WGPUDevice device,
return pipeline;
}
-CNNEffect::CNNEffect(const GpuContext& ctx)
+CNNv1Effect::CNNv1Effect(const GpuContext& ctx)
: PostProcessEffect(ctx), layer_index_(0), total_layers_(1),
blend_amount_(1.0f), input_view_(nullptr), original_view_(nullptr),
bind_group_(nullptr) {
@@ -41,7 +41,7 @@ CNNEffect::CNNEffect(const GpuContext& ctx)
create_cnn_pipeline(ctx_.device, ctx_.format, cnn_layer_shader_wgsl);
}
-CNNEffect::CNNEffect(const GpuContext& ctx, const CNNEffectParams& params)
+CNNv1Effect::CNNv1Effect(const GpuContext& ctx, const CNNv1EffectParams& params)
: PostProcessEffect(ctx), layer_index_(params.layer_index),
total_layers_(params.total_layers), blend_amount_(params.blend_amount),
input_view_(nullptr), original_view_(nullptr), bind_group_(nullptr) {
@@ -49,7 +49,7 @@ CNNEffect::CNNEffect(const GpuContext& ctx, const CNNEffectParams& params)
create_cnn_pipeline(ctx_.device, ctx_.format, cnn_layer_shader_wgsl);
}
-void CNNEffect::init(MainSequence* demo) {
+void CNNv1Effect::init(MainSequence* demo) {
PostProcessEffect::init(demo);
demo_ = demo;
params_buffer_.init(ctx_.device);
@@ -62,11 +62,11 @@ void CNNEffect::init(MainSequence* demo) {
// Initialize uniforms BEFORE any bind group creation
uniforms_.update(ctx_.queue, get_common_uniforms());
- CNNLayerParams params = {layer_index_, blend_amount_, {0.0f, 0.0f}};
+ CNNv1LayerParams params = {layer_index_, blend_amount_, {0.0f, 0.0f}};
params_buffer_.update(ctx_.queue, params);
}
-void CNNEffect::resize(int width, int height) {
+void CNNv1Effect::resize(int width, int height) {
if (width == width_ && height == height_)
return;
@@ -78,7 +78,7 @@ void CNNEffect::resize(int width, int height) {
}
}
-void CNNEffect::render(WGPURenderPassEncoder pass,
+void CNNv1Effect::render(WGPURenderPassEncoder pass,
const CommonPostProcessUniforms& uniforms) {
if (!bind_group_) {
fprintf(stderr, "CNN render: no bind_group\n");
@@ -90,7 +90,7 @@ void CNNEffect::render(WGPURenderPassEncoder pass,
effective_blend = blend_amount_ * uniforms.beat_phase * beat_scale_;
}
- CNNLayerParams params = {layer_index_, effective_blend, {0.0f, 0.0f}};
+ CNNv1LayerParams params = {layer_index_, effective_blend, {0.0f, 0.0f}};
params_buffer_.update(ctx_.queue, params);
wgpuRenderPassEncoderSetPipeline(pass, pipeline_);
@@ -98,7 +98,7 @@ void CNNEffect::render(WGPURenderPassEncoder pass,
wgpuRenderPassEncoderDraw(pass, 3, 1, 0, 0);
}
-void CNNEffect::update_bind_group(WGPUTextureView input_view) {
+void CNNv1Effect::update_bind_group(WGPUTextureView input_view) {
input_view_ = input_view;
// Update common uniforms (CRITICAL for UV calculation!)
diff --git a/cnn_v1/src/cnn_effect.h b/cnn_v1/src/cnn_v1_effect.h
index cdcd656..e820275 100644
--- a/cnn_v1/src/cnn_effect.h
+++ b/cnn_v1/src/cnn_v1_effect.h
@@ -5,23 +5,23 @@
#include "gpu/effect.h"
#include "gpu/uniform_helper.h"
-struct CNNLayerParams {
+struct CNNv1LayerParams {
int layer_index;
float blend_amount; // Blend: mix(input, output, blend_amount)
float _pad[2];
};
-static_assert(sizeof(CNNLayerParams) == 16);
+static_assert(sizeof(CNNv1LayerParams) == 16);
-struct CNNEffectParams {
+struct CNNv1EffectParams {
int layer_index = 0; // Which layer to render (0-based)
int total_layers = 1; // Total number of layers in the CNN
float blend_amount = 1.0f; // Final blend with original input
};
-class CNNEffect : public PostProcessEffect {
+class CNNv1Effect : public PostProcessEffect {
public:
- explicit CNNEffect(const GpuContext& ctx);
- explicit CNNEffect(const GpuContext& ctx, const CNNEffectParams& params);
+ explicit CNNv1Effect(const GpuContext& ctx);
+ explicit CNNv1Effect(const GpuContext& ctx, const CNNv1EffectParams& params);
void init(MainSequence* demo) override;
void resize(int width, int height) override;
@@ -47,7 +47,7 @@ class CNNEffect : public PostProcessEffect {
float beat_scale_ = 1.0f;
WGPUTextureView input_view_;
WGPUTextureView original_view_;
- UniformBuffer<CNNLayerParams> params_buffer_;
+ UniformBuffer<CNNv1LayerParams> params_buffer_;
WGPUBindGroup bind_group_;
MainSequence* demo_ = nullptr;
};