From fd19130b3360d17b44247ec26533b20e051b7f8c Mon Sep 17 00:00:00 2001 From: skal Date: Mon, 9 Feb 2026 11:17:53 +0100 Subject: feat: WGSL Uniform Buffer Validation & Consolidation (Task #75) - Added to validate WGSL/C++ struct alignment. - Integrated validation into . - Standardized uniform usage in , , , . - Renamed generic to specific names in WGSL and C++ to avoid collisions. - Added and updated . - handoff(Gemini): Completed Task #75. --- src/gpu/demo_effects.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/gpu/demo_effects.h') diff --git a/src/gpu/demo_effects.h b/src/gpu/demo_effects.h index ed6ee87..1bd6020 100644 --- a/src/gpu/demo_effects.h +++ b/src/gpu/demo_effects.h @@ -180,6 +180,26 @@ class Hybrid3DEffect : public Effect { int height_ = 720; }; +// Parameters for DistortEffect +struct DistortParams { + float strength = 0.01f; // Default distortion strength + float speed = 1.0f; // Default distortion speed +}; +static_assert(sizeof(DistortParams) == 8, "DistortParams must be 8 bytes for WGSL alignment"); + +class DistortEffect : public PostProcessEffect { + public: + DistortEffect(const GpuContext& ctx); + DistortEffect(const GpuContext& ctx, const DistortParams& params); + void render(WGPURenderPassEncoder pass, float time, float beat, + float intensity, float aspect_ratio) override; + void update_bind_group(WGPUTextureView input_view) override; + + private: + DistortParams params_; + UniformBuffer common_uniforms_; + UniformBuffer params_buffer_; +}; class FlashCubeEffect : public Effect { public: FlashCubeEffect(const GpuContext& ctx); -- cgit v1.2.3