diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-09 11:17:53 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-09 11:17:53 +0100 |
| commit | fd19130b3360d17b44247ec26533b20e051b7f8c (patch) | |
| tree | f3116150299e320c4a5951aa7a2fdd1dc12a9511 /src/gpu/demo_effects.h | |
| parent | 698649d30129ba26a7ad9c13a874686640f43972 (diff) | |
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.
Diffstat (limited to 'src/gpu/demo_effects.h')
| -rw-r--r-- | src/gpu/demo_effects.h | 20 |
1 files changed, 20 insertions, 0 deletions
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<CommonPostProcessUniforms> common_uniforms_; + UniformBuffer<DistortParams> params_buffer_; +}; class FlashCubeEffect : public Effect { public: FlashCubeEffect(const GpuContext& ctx); |
