diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/test_demo.cc | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/src/test_demo.cc b/src/test_demo.cc index 595ca6a..b564b9b 100644 --- a/src/test_demo.cc +++ b/src/test_demo.cc @@ -21,33 +21,25 @@ extern void LoadTimeline(MainSequence& main_seq, const GpuContext& ctx); // Inline peak meter effect for debugging audio-visual sync #include "gpu/effects/post_process_helper.h" +#include "gpu/effects/shader_composer.h" + class PeakMeterEffect : public PostProcessEffect { public: PeakMeterEffect(const GpuContext& ctx) : PostProcessEffect(ctx) { - // Use standard post-process binding macros - const char* shader_code = R"( + // Use ShaderComposer to include CommonUniforms from common_uniforms.wgsl + const char* shader_main = R"( struct VertexOutput { @builtin(position) position: vec4<f32>, @location(0) uv: vec2<f32>, }; - struct Uniforms { - resolution: vec2<f32>, - aspect_ratio: f32, - time: f32, - beat_time: f32, - beat_phase: f32, - audio_intensity: f32, - _pad: f32, - }; - struct EffectParams { unused: f32, }; @group(0) @binding(0) var inputSampler: sampler; @group(0) @binding(1) var inputTexture: texture_2d<f32>; - @group(0) @binding(2) var<uniform> uniforms: Uniforms; + @group(0) @binding(2) var<uniform> uniforms: CommonUniforms; @group(0) @binding(3) var<uniform> params: EffectParams; @vertex @@ -86,8 +78,12 @@ class PeakMeterEffect : public PostProcessEffect { } )"; + // Compose shader with common_uniforms to get CommonUniforms definition + std::string shader_code = ShaderComposer::Get().Compose( + {"common_uniforms"}, shader_main); + pipeline_ = - create_post_process_pipeline(ctx_.device, ctx_.format, shader_code); + create_post_process_pipeline(ctx_.device, ctx_.format, shader_code.c_str()); } void update_bind_group(WGPUTextureView input_view) { |
