summaryrefslogtreecommitdiff
path: root/src/gpu/post_process_helper.cc
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-14 15:14:25 +0100
committerskal <pascal.massimino@gmail.com>2026-02-14 15:14:25 +0100
commit8ce27b7e15f0fc65c8ee78950c7501660b936178 (patch)
tree391f32111b9a30a0156709b6c1ed2fae7b435d57 /src/gpu/post_process_helper.cc
parente38be0dbf5816338ff97e2ee2f9adfff2902dc2b (diff)
style: Apply clang-format to codebase
Diffstat (limited to 'src/gpu/post_process_helper.cc')
-rw-r--r--src/gpu/post_process_helper.cc50
1 files changed, 28 insertions, 22 deletions
diff --git a/src/gpu/post_process_helper.cc b/src/gpu/post_process_helper.cc
index c5bef27..2e8f6ad 100644
--- a/src/gpu/post_process_helper.cc
+++ b/src/gpu/post_process_helper.cc
@@ -3,31 +3,34 @@
#include "post_process_helper.h"
#include "demo_effects.h"
-#include "gpu/gpu.h"
-#include "gpu/shader_composer.h"
#include "gpu/bind_group_builder.h"
-#include "gpu/sampler_cache.h"
+#include "gpu/gpu.h"
#include "gpu/pipeline_builder.h"
+#include "gpu/sampler_cache.h"
+#include "gpu/shader_composer.h"
#include <cstring>
// Helper to create a standard post-processing pipeline
WGPURenderPipeline create_post_process_pipeline(WGPUDevice device,
WGPUTextureFormat format,
const char* shader_code) {
- WGPUBindGroupLayout bgl = BindGroupLayoutBuilder()
- .sampler(PP_BINDING_SAMPLER, WGPUShaderStage_Fragment)
- .texture(PP_BINDING_TEXTURE, WGPUShaderStage_Fragment)
- .uniform(PP_BINDING_UNIFORMS, WGPUShaderStage_Vertex | WGPUShaderStage_Fragment)
- .uniform(PP_BINDING_EFFECT_PARAMS, WGPUShaderStage_Fragment)
- .build(device);
+ WGPUBindGroupLayout bgl =
+ BindGroupLayoutBuilder()
+ .sampler(PP_BINDING_SAMPLER, WGPUShaderStage_Fragment)
+ .texture(PP_BINDING_TEXTURE, WGPUShaderStage_Fragment)
+ .uniform(PP_BINDING_UNIFORMS,
+ WGPUShaderStage_Vertex | WGPUShaderStage_Fragment)
+ .uniform(PP_BINDING_EFFECT_PARAMS, WGPUShaderStage_Fragment)
+ .build(device);
- const std::string composed_shader = ShaderComposer::Get().Compose({}, shader_code);
+ const std::string composed_shader =
+ ShaderComposer::Get().Compose({}, shader_code);
WGPURenderPipeline pipeline = RenderPipelineBuilder(device)
- .shader(composed_shader.c_str())
- .bind_group_layout(bgl)
- .format(format)
- .build();
+ .shader(composed_shader.c_str())
+ .bind_group_layout(bgl)
+ .format(format)
+ .build();
wgpuBindGroupLayoutRelease(bgl);
return pipeline;
@@ -47,14 +50,17 @@ void pp_update_bind_group(WGPUDevice device, WGPURenderPipeline pipeline,
wgpuBindGroupRelease(*bind_group);
WGPUBindGroupLayout bgl = wgpuRenderPipelineGetBindGroupLayout(pipeline, 0);
- WGPUSampler sampler = SamplerCache::Get().get_or_create(device, SamplerCache::linear());
+ WGPUSampler sampler =
+ SamplerCache::Get().get_or_create(device, SamplerCache::linear());
*bind_group = BindGroupBuilder()
- .sampler(PP_BINDING_SAMPLER, sampler)
- .texture(PP_BINDING_TEXTURE, input_view)
- .buffer(PP_BINDING_UNIFORMS, uniforms.buffer, uniforms.size)
- .buffer(PP_BINDING_EFFECT_PARAMS,
- effect_params.buffer ? effect_params.buffer : g_dummy_buffer.buffer,
- effect_params.buffer ? effect_params.size : g_dummy_buffer.size)
- .build(device, bgl);
+ .sampler(PP_BINDING_SAMPLER, sampler)
+ .texture(PP_BINDING_TEXTURE, input_view)
+ .buffer(PP_BINDING_UNIFORMS, uniforms.buffer, uniforms.size)
+ .buffer(PP_BINDING_EFFECT_PARAMS,
+ effect_params.buffer ? effect_params.buffer
+ : g_dummy_buffer.buffer,
+ effect_params.buffer ? effect_params.size
+ : g_dummy_buffer.size)
+ .build(device, bgl);
}