blob: 9cc4935f6ef995892b3950425e3e8b798cfcd5d6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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_;
};
|