summaryrefslogtreecommitdiff
path: root/src/gpu/effects/passthrough_effect.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/effects/passthrough_effect.cc')
-rw-r--r--src/gpu/effects/passthrough_effect.cc18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/gpu/effects/passthrough_effect.cc b/src/gpu/effects/passthrough_effect.cc
index d567caf..93cf948 100644
--- a/src/gpu/effects/passthrough_effect.cc
+++ b/src/gpu/effects/passthrough_effect.cc
@@ -7,17 +7,19 @@
// --- PassthroughEffect ---
PassthroughEffect::PassthroughEffect(const GpuContext& ctx)
: PostProcessEffect(ctx) {
- uniforms_ =
- gpu_create_buffer(ctx_.device, sizeof(float) * 6,
- WGPUBufferUsage_Uniform | WGPUBufferUsage_CopyDst);
+ uniforms_.init(ctx_.device);
pipeline_ = create_post_process_pipeline(ctx_.device, ctx_.format,
passthrough_shader_wgsl);
}
void PassthroughEffect::update_bind_group(WGPUTextureView input_view) {
- struct {
- float t, b, i, a, w, h;
- } u = {0, 0, 0, 0, (float)width_, (float)height_};
- wgpuQueueWriteBuffer(ctx_.queue, uniforms_.buffer, 0, &u, sizeof(u));
+ const CommonPostProcessUniforms u = {
+ .resolution = {(float)width_, (float)height_},
+ .aspect_ratio = 1.0f,
+ .time = 0.0f,
+ .beat = 0.0f,
+ .audio_intensity = 0.0f,
+ };
+ uniforms_.update(ctx_.queue, u);
pp_update_bind_group(ctx_.device, pipeline_, &bind_group_, input_view,
- uniforms_);
+ uniforms_.get(), {});
}