diff options
Diffstat (limited to 'src/gpu/effects/post_process_helper.h')
| -rw-r--r-- | src/gpu/effects/post_process_helper.h | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/gpu/effects/post_process_helper.h b/src/gpu/effects/post_process_helper.h index 8a9331b..77b184f 100644 --- a/src/gpu/effects/post_process_helper.h +++ b/src/gpu/effects/post_process_helper.h @@ -4,11 +4,25 @@ #pragma once #include "gpu/gpu.h" +#include "util/mini_math.h" + +// Uniform data common to all post-processing effects +struct CommonPostProcessUniforms { + vec2 resolution; + float _pad[2]; // Padding for 16-byte alignment + float aspect_ratio; + float time; + float beat; + float audio_intensity; +}; +static_assert(sizeof(CommonPostProcessUniforms) == 32, + "CommonPostProcessUniforms must be 32 bytes for WGSL alignment"); // 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 +#define PP_BINDING_EFFECT_PARAMS 3 // Effect-specific parameters // Helper to create a standard post-processing pipeline // Uniforms are accessible to both vertex and fragment shaders @@ -19,4 +33,4 @@ WGPURenderPipeline create_post_process_pipeline(WGPUDevice device, // Helper to update bind group for post-processing effects void pp_update_bind_group(WGPUDevice device, WGPURenderPipeline pipeline, WGPUBindGroup* bind_group, WGPUTextureView input_view, - GpuBuffer uniforms); + GpuBuffer uniforms, GpuBuffer effect_params); |
