summaryrefslogtreecommitdiff
path: root/src/gpu/effects
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/effects')
-rw-r--r--src/gpu/effects/distort_effect.cc7
-rw-r--r--src/gpu/effects/fade_effect.cc12
-rw-r--r--src/gpu/effects/flash_cube_effect.cc3
-rw-r--r--src/gpu/effects/flash_effect.cc12
-rw-r--r--src/gpu/effects/gaussian_blur_effect.cc4
-rw-r--r--src/gpu/effects/heptagon_effect.cc7
-rw-r--r--src/gpu/effects/hybrid_3d_effect.cc7
-rw-r--r--src/gpu/effects/moving_ellipse_effect.cc7
-rw-r--r--src/gpu/effects/particle_spray_effect.cc7
-rw-r--r--src/gpu/effects/particles_effect.cc7
-rw-r--r--src/gpu/effects/passthrough_effect.cc7
-rw-r--r--src/gpu/effects/post_process_helper.h6
-rw-r--r--src/gpu/effects/shader_composer.cc2
-rw-r--r--src/gpu/effects/solarize_effect.cc7
-rw-r--r--src/gpu/effects/theme_modulation_effect.cc9
15 files changed, 52 insertions, 52 deletions
diff --git a/src/gpu/effects/distort_effect.cc b/src/gpu/effects/distort_effect.cc
index 3bd4540..b7e27a7 100644
--- a/src/gpu/effects/distort_effect.cc
+++ b/src/gpu/effects/distort_effect.cc
@@ -5,13 +5,12 @@
#include "gpu/gpu.h"
// --- DistortEffect ---
-DistortEffect::DistortEffect(const GpuContext& ctx)
- : PostProcessEffect(ctx) {
+DistortEffect::DistortEffect(const GpuContext& ctx) : PostProcessEffect(ctx) {
uniforms_ =
gpu_create_buffer(ctx_.device, sizeof(float) * 6,
WGPUBufferUsage_Uniform | WGPUBufferUsage_CopyDst);
- pipeline_ =
- create_post_process_pipeline(ctx_.device, ctx_.format, distort_shader_wgsl);
+ pipeline_ = create_post_process_pipeline(ctx_.device, ctx_.format,
+ distort_shader_wgsl);
}
void DistortEffect::render(WGPURenderPassEncoder pass, float t, float b,
float i, float a) {
diff --git a/src/gpu/effects/fade_effect.cc b/src/gpu/effects/fade_effect.cc
index 8aad6b3..359d341 100644
--- a/src/gpu/effects/fade_effect.cc
+++ b/src/gpu/effects/fade_effect.cc
@@ -5,8 +5,7 @@
#include "gpu/effects/post_process_helper.h"
#include <cmath>
-FadeEffect::FadeEffect(const GpuContext& ctx)
- : PostProcessEffect(ctx) {
+FadeEffect::FadeEffect(const GpuContext& ctx) : PostProcessEffect(ctx) {
const char* shader_code = R"(
struct VertexOutput {
@builtin(position) position: vec4<f32>,
@@ -45,13 +44,15 @@ FadeEffect::FadeEffect(const GpuContext& ctx)
}
)";
- pipeline_ = create_post_process_pipeline(ctx_.device, ctx_.format, shader_code);
+ pipeline_ =
+ create_post_process_pipeline(ctx_.device, ctx_.format, shader_code);
uniforms_ = gpu_create_buffer(
ctx_.device, 16, WGPUBufferUsage_Uniform | WGPUBufferUsage_CopyDst);
}
void FadeEffect::update_bind_group(WGPUTextureView input_view) {
- pp_update_bind_group(ctx_.device, pipeline_, &bind_group_, input_view, uniforms_);
+ pp_update_bind_group(ctx_.device, pipeline_, &bind_group_, input_view,
+ uniforms_);
}
void FadeEffect::render(WGPURenderPassEncoder pass, float time, float beat,
@@ -73,7 +74,8 @@ void FadeEffect::render(WGPURenderPassEncoder pass, float time, float beat,
}
float uniforms[4] = {fade_amount, 0.0f, 0.0f, 0.0f};
- wgpuQueueWriteBuffer(ctx_.queue, uniforms_.buffer, 0, uniforms, sizeof(uniforms));
+ wgpuQueueWriteBuffer(ctx_.queue, uniforms_.buffer, 0, uniforms,
+ sizeof(uniforms));
wgpuRenderPassEncoderSetPipeline(pass, pipeline_);
wgpuRenderPassEncoderSetBindGroup(pass, 0, bind_group_, 0, nullptr);
diff --git a/src/gpu/effects/flash_cube_effect.cc b/src/gpu/effects/flash_cube_effect.cc
index 8c97d5d..f01bbd1 100644
--- a/src/gpu/effects/flash_cube_effect.cc
+++ b/src/gpu/effects/flash_cube_effect.cc
@@ -8,8 +8,7 @@
#include <cmath>
#include <iostream>
-FlashCubeEffect::FlashCubeEffect(const GpuContext& ctx)
- : Effect(ctx) {
+FlashCubeEffect::FlashCubeEffect(const GpuContext& ctx) : Effect(ctx) {
}
void FlashCubeEffect::resize(int width, int height) {
diff --git a/src/gpu/effects/flash_effect.cc b/src/gpu/effects/flash_effect.cc
index 5aebe2d..d0226e5 100644
--- a/src/gpu/effects/flash_effect.cc
+++ b/src/gpu/effects/flash_effect.cc
@@ -5,8 +5,7 @@
#include "gpu/effects/post_process_helper.h"
#include <cmath>
-FlashEffect::FlashEffect(const GpuContext& ctx)
- : PostProcessEffect(ctx) {
+FlashEffect::FlashEffect(const GpuContext& ctx) : PostProcessEffect(ctx) {
const char* shader_code = R"(
struct VertexOutput {
@builtin(position) position: vec4<f32>,
@@ -49,13 +48,15 @@ FlashEffect::FlashEffect(const GpuContext& ctx)
}
)";
- pipeline_ = create_post_process_pipeline(ctx_.device, ctx_.format, shader_code);
+ pipeline_ =
+ create_post_process_pipeline(ctx_.device, ctx_.format, shader_code);
uniforms_ = gpu_create_buffer(
ctx_.device, 16, WGPUBufferUsage_Uniform | WGPUBufferUsage_CopyDst);
}
void FlashEffect::update_bind_group(WGPUTextureView input_view) {
- pp_update_bind_group(ctx_.device, pipeline_, &bind_group_, input_view, uniforms_);
+ pp_update_bind_group(ctx_.device, pipeline_, &bind_group_, input_view,
+ uniforms_);
}
void FlashEffect::render(WGPURenderPassEncoder pass, float time, float beat,
@@ -73,7 +74,8 @@ void FlashEffect::render(WGPURenderPassEncoder pass, float time, float beat,
flash_intensity_ *= 0.98f;
float uniforms[4] = {flash_intensity_, intensity, 0.0f, 0.0f};
- wgpuQueueWriteBuffer(ctx_.queue, uniforms_.buffer, 0, uniforms, sizeof(uniforms));
+ wgpuQueueWriteBuffer(ctx_.queue, uniforms_.buffer, 0, uniforms,
+ sizeof(uniforms));
wgpuRenderPassEncoderSetPipeline(pass, pipeline_);
wgpuRenderPassEncoderSetBindGroup(pass, 0, bind_group_, 0, nullptr);
diff --git a/src/gpu/effects/gaussian_blur_effect.cc b/src/gpu/effects/gaussian_blur_effect.cc
index f3a3544..f1736bf 100644
--- a/src/gpu/effects/gaussian_blur_effect.cc
+++ b/src/gpu/effects/gaussian_blur_effect.cc
@@ -10,8 +10,8 @@ GaussianBlurEffect::GaussianBlurEffect(const GpuContext& ctx)
uniforms_ =
gpu_create_buffer(ctx_.device, sizeof(float) * 6,
WGPUBufferUsage_Uniform | WGPUBufferUsage_CopyDst);
- pipeline_ =
- create_post_process_pipeline(ctx_.device, ctx_.format, gaussian_blur_shader_wgsl);
+ pipeline_ = create_post_process_pipeline(ctx_.device, ctx_.format,
+ gaussian_blur_shader_wgsl);
}
void GaussianBlurEffect::render(WGPURenderPassEncoder pass, float t, float b,
float i, float a) {
diff --git a/src/gpu/effects/heptagon_effect.cc b/src/gpu/effects/heptagon_effect.cc
index 40ff860..7321cd7 100644
--- a/src/gpu/effects/heptagon_effect.cc
+++ b/src/gpu/effects/heptagon_effect.cc
@@ -5,14 +5,13 @@
#include "gpu/gpu.h"
// --- HeptagonEffect ---
-HeptagonEffect::HeptagonEffect(const GpuContext& ctx)
- : Effect(ctx) {
+HeptagonEffect::HeptagonEffect(const GpuContext& ctx) : Effect(ctx) {
uniforms_ =
gpu_create_buffer(ctx_.device, sizeof(float) * 4,
WGPUBufferUsage_Uniform | WGPUBufferUsage_CopyDst);
ResourceBinding bindings[] = {{uniforms_, WGPUBufferBindingType_Uniform}};
- pass_ =
- gpu_create_render_pass(ctx_.device, ctx_.format, main_shader_wgsl, bindings, 1);
+ pass_ = gpu_create_render_pass(ctx_.device, ctx_.format, main_shader_wgsl,
+ bindings, 1);
pass_.vertex_count = 21;
}
void HeptagonEffect::render(WGPURenderPassEncoder pass, float t, float b,
diff --git a/src/gpu/effects/hybrid_3d_effect.cc b/src/gpu/effects/hybrid_3d_effect.cc
index 0f31b92..17fef25 100644
--- a/src/gpu/effects/hybrid_3d_effect.cc
+++ b/src/gpu/effects/hybrid_3d_effect.cc
@@ -8,8 +8,7 @@
#include <cmath>
#include <iostream>
-Hybrid3DEffect::Hybrid3DEffect(const GpuContext& ctx)
- : Effect(ctx) {
+Hybrid3DEffect::Hybrid3DEffect(const GpuContext& ctx) : Effect(ctx) {
}
void Hybrid3DEffect::resize(int width, int height) {
@@ -21,8 +20,8 @@ void Hybrid3DEffect::resize(int width, int height) {
void Hybrid3DEffect::init(MainSequence* demo) {
(void)demo;
WGPUTextureFormat format =
- demo->gpu_ctx.format; // Get current format from MainSequence (might be different
- // than constructor if resized)
+ demo->gpu_ctx.format; // Get current format from MainSequence (might be
+ // different than constructor if resized)
renderer_.init(ctx_.device, ctx_.queue, ctx_.format);
renderer_.resize(width_, height_);
diff --git a/src/gpu/effects/moving_ellipse_effect.cc b/src/gpu/effects/moving_ellipse_effect.cc
index 94596df..096ebc2 100644
--- a/src/gpu/effects/moving_ellipse_effect.cc
+++ b/src/gpu/effects/moving_ellipse_effect.cc
@@ -5,14 +5,13 @@
#include "gpu/gpu.h"
// --- MovingEllipseEffect ---
-MovingEllipseEffect::MovingEllipseEffect(const GpuContext& ctx)
- : Effect(ctx) {
+MovingEllipseEffect::MovingEllipseEffect(const GpuContext& ctx) : Effect(ctx) {
uniforms_ =
gpu_create_buffer(ctx_.device, sizeof(float) * 6,
WGPUBufferUsage_Uniform | WGPUBufferUsage_CopyDst);
ResourceBinding bindings[] = {{uniforms_, WGPUBufferBindingType_Uniform}};
- pass_ =
- gpu_create_render_pass(ctx_.device, ctx_.format, ellipse_shader_wgsl, bindings, 1);
+ pass_ = gpu_create_render_pass(ctx_.device, ctx_.format, ellipse_shader_wgsl,
+ bindings, 1);
pass_.vertex_count = 3;
}
void MovingEllipseEffect::render(WGPURenderPassEncoder pass, float t, float b,
diff --git a/src/gpu/effects/particle_spray_effect.cc b/src/gpu/effects/particle_spray_effect.cc
index 8c20065..707d38d 100644
--- a/src/gpu/effects/particle_spray_effect.cc
+++ b/src/gpu/effects/particle_spray_effect.cc
@@ -6,8 +6,7 @@
#include <vector>
// --- ParticleSprayEffect ---
-ParticleSprayEffect::ParticleSprayEffect(const GpuContext& ctx)
- : Effect(ctx) {
+ParticleSprayEffect::ParticleSprayEffect(const GpuContext& ctx) : Effect(ctx) {
uniforms_ =
gpu_create_buffer(ctx_.device, sizeof(float) * 6,
WGPUBufferUsage_Uniform | WGPUBufferUsage_CopyDst);
@@ -25,8 +24,8 @@ ParticleSprayEffect::ParticleSprayEffect(const GpuContext& ctx)
ResourceBinding rb[] = {
{particles_buffer_, WGPUBufferBindingType_ReadOnlyStorage},
{uniforms_, WGPUBufferBindingType_Uniform}};
- render_pass_ =
- gpu_create_render_pass(ctx_.device, ctx_.format, particle_render_wgsl, rb, 2);
+ render_pass_ = gpu_create_render_pass(ctx_.device, ctx_.format,
+ particle_render_wgsl, rb, 2);
render_pass_.vertex_count = 6;
render_pass_.instance_count = NUM_PARTICLES;
}
diff --git a/src/gpu/effects/particles_effect.cc b/src/gpu/effects/particles_effect.cc
index d9f8f2a..f25009b 100644
--- a/src/gpu/effects/particles_effect.cc
+++ b/src/gpu/effects/particles_effect.cc
@@ -6,8 +6,7 @@
#include <vector>
// --- ParticlesEffect ---
-ParticlesEffect::ParticlesEffect(const GpuContext& ctx)
- : Effect(ctx) {
+ParticlesEffect::ParticlesEffect(const GpuContext& ctx) : Effect(ctx) {
uniforms_ =
gpu_create_buffer(ctx_.device, sizeof(float) * 4,
WGPUBufferUsage_Uniform | WGPUBufferUsage_CopyDst);
@@ -23,8 +22,8 @@ ParticlesEffect::ParticlesEffect(const GpuContext& ctx)
ResourceBinding rb[] = {
{particles_buffer_, WGPUBufferBindingType_ReadOnlyStorage},
{uniforms_, WGPUBufferBindingType_Uniform}};
- render_pass_ =
- gpu_create_render_pass(ctx_.device, ctx_.format, particle_render_wgsl, rb, 2);
+ render_pass_ = gpu_create_render_pass(ctx_.device, ctx_.format,
+ particle_render_wgsl, rb, 2);
render_pass_.vertex_count = 6;
render_pass_.instance_count = NUM_PARTICLES;
}
diff --git a/src/gpu/effects/passthrough_effect.cc b/src/gpu/effects/passthrough_effect.cc
index 1aebb28..d567caf 100644
--- a/src/gpu/effects/passthrough_effect.cc
+++ b/src/gpu/effects/passthrough_effect.cc
@@ -10,13 +10,14 @@ PassthroughEffect::PassthroughEffect(const GpuContext& ctx)
uniforms_ =
gpu_create_buffer(ctx_.device, sizeof(float) * 6,
WGPUBufferUsage_Uniform | WGPUBufferUsage_CopyDst);
- pipeline_ =
- create_post_process_pipeline(ctx_.device, ctx_.format, passthrough_shader_wgsl);
+ 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));
- pp_update_bind_group(ctx_.device, pipeline_, &bind_group_, input_view, uniforms_);
+ pp_update_bind_group(ctx_.device, pipeline_, &bind_group_, input_view,
+ uniforms_);
}
diff --git a/src/gpu/effects/post_process_helper.h b/src/gpu/effects/post_process_helper.h
index 45757cf..8a9331b 100644
--- a/src/gpu/effects/post_process_helper.h
+++ b/src/gpu/effects/post_process_helper.h
@@ -6,9 +6,9 @@
#include "gpu/gpu.h"
// Standard post-process bind group layout (group 0):
-#define PP_BINDING_SAMPLER 0 // Sampler for input texture
-#define PP_BINDING_TEXTURE 1 // Input texture (previous render pass)
-#define PP_BINDING_UNIFORMS 2 // Custom uniforms buffer
+#define PP_BINDING_SAMPLER 0 // Sampler for input texture
+#define PP_BINDING_TEXTURE 1 // Input texture (previous render pass)
+#define PP_BINDING_UNIFORMS 2 // Custom uniforms buffer
// Helper to create a standard post-processing pipeline
// Uniforms are accessible to both vertex and fragment shaders
diff --git a/src/gpu/effects/shader_composer.cc b/src/gpu/effects/shader_composer.cc
index 055b996..b746f8b 100644
--- a/src/gpu/effects/shader_composer.cc
+++ b/src/gpu/effects/shader_composer.cc
@@ -28,7 +28,7 @@ void ShaderComposer::ResolveRecursive(const std::string& source,
size_t end = line.find('"', start + 1);
if (start != std::string::npos && end != std::string::npos) {
std::string name = line.substr(start + 1, end - start - 1);
-
+
// Apply substitution if available
auto sub_it = substitutions.find(name);
if (sub_it != substitutions.end()) {
diff --git a/src/gpu/effects/solarize_effect.cc b/src/gpu/effects/solarize_effect.cc
index 4e9cbda..31b6c2e 100644
--- a/src/gpu/effects/solarize_effect.cc
+++ b/src/gpu/effects/solarize_effect.cc
@@ -5,13 +5,12 @@
#include "gpu/gpu.h"
// --- SolarizeEffect ---
-SolarizeEffect::SolarizeEffect(const GpuContext& ctx)
- : PostProcessEffect(ctx) {
+SolarizeEffect::SolarizeEffect(const GpuContext& ctx) : PostProcessEffect(ctx) {
uniforms_ =
gpu_create_buffer(ctx_.device, sizeof(float) * 6,
WGPUBufferUsage_Uniform | WGPUBufferUsage_CopyDst);
- pipeline_ =
- create_post_process_pipeline(ctx_.device, ctx_.format, solarize_shader_wgsl);
+ pipeline_ = create_post_process_pipeline(ctx_.device, ctx_.format,
+ solarize_shader_wgsl);
}
void SolarizeEffect::render(WGPURenderPassEncoder pass, float t, float b,
float i, float a) {
diff --git a/src/gpu/effects/theme_modulation_effect.cc b/src/gpu/effects/theme_modulation_effect.cc
index 4b5105d..6ec5bb9 100644
--- a/src/gpu/effects/theme_modulation_effect.cc
+++ b/src/gpu/effects/theme_modulation_effect.cc
@@ -47,7 +47,8 @@ ThemeModulationEffect::ThemeModulationEffect(const GpuContext& ctx)
}
)";
- pipeline_ = create_post_process_pipeline(ctx_.device, ctx_.format, shader_code);
+ pipeline_ =
+ create_post_process_pipeline(ctx_.device, ctx_.format, shader_code);
// Create uniform buffer (4 floats: brightness + padding)
uniforms_ = gpu_create_buffer(
@@ -55,7 +56,8 @@ ThemeModulationEffect::ThemeModulationEffect(const GpuContext& ctx)
}
void ThemeModulationEffect::update_bind_group(WGPUTextureView input_view) {
- pp_update_bind_group(ctx_.device, pipeline_, &bind_group_, input_view, uniforms_);
+ pp_update_bind_group(ctx_.device, pipeline_, &bind_group_, input_view,
+ uniforms_);
}
void ThemeModulationEffect::render(WGPURenderPassEncoder pass, float time,
@@ -80,7 +82,8 @@ void ThemeModulationEffect::render(WGPURenderPassEncoder pass, float time,
// Update uniform buffer
float uniforms[4] = {theme_brightness, 0.0f, 0.0f, 0.0f};
- wgpuQueueWriteBuffer(ctx_.queue, uniforms_.buffer, 0, uniforms, sizeof(uniforms));
+ wgpuQueueWriteBuffer(ctx_.queue, uniforms_.buffer, 0, uniforms,
+ sizeof(uniforms));
// Render
wgpuRenderPassEncoderSetPipeline(pass, pipeline_);