From 4b23fdc63d422b31b6ad86d34218e7b66b462514 Mon Sep 17 00:00:00 2001 From: skal Date: Sun, 8 Feb 2026 17:43:44 +0100 Subject: feat(gpu): Add parameter-driven GaussianBlurEffect Extends shader parametrization system to GaussianBlurEffect with strength parameter (Task #73 continued). Changes: - Added GaussianBlurParams struct (strength, default: 2.0f) - Added GaussianBlurUniforms with proper WGSL alignment (32 bytes) - Updated shader to use parameterized strength instead of hardcoded 2.0 - Extended seq_compiler to parse strength parameter - Updated demo.seq with 2 parameterized instances: * Line 38: strength=3.0 (stronger blur for particles) * Line 48: strength=1.5 (subtle blur) Technical details: - Backward-compatible default constructor maintained - Migrated from raw buffer to UniformBuffer - Shader replaces 'let base_size = 2.0' with 'uniforms.strength' - Generated code creates GaussianBlurParams initialization Testing: - All 32/32 tests pass - Demo runs without errors - Generated code verified correct Co-Authored-By: Claude Sonnet 4.5 --- tools/seq_compiler.cc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tools') diff --git a/tools/seq_compiler.cc b/tools/seq_compiler.cc index d89ab3d..218ef93 100644 --- a/tools/seq_compiler.cc +++ b/tools/seq_compiler.cc @@ -958,6 +958,22 @@ int main(int argc, char* argv[]) { } } + out_file << " seq->add_effect(std::make_shared<" + << eff.class_name << ">(ctx, p), " << eff.start << "f, " + << eff.end << "f, " << eff.priority << ");\n"; + out_file << " }\n"; + } else if (!eff.params.empty() && + eff.class_name == "GaussianBlurEffect") { + // Generate parameter struct initialization for GaussianBlurEffect + out_file << " {\n"; + out_file << " GaussianBlurParams p;\n"; + + for (const auto& [key, value] : eff.params) { + if (key == "strength") { + out_file << " p.strength = " << value << "f;\n"; + } + } + out_file << " seq->add_effect(std::make_shared<" << eff.class_name << ">(ctx, p), " << eff.start << "f, " << eff.end << "f, " << eff.priority << ");\n"; -- cgit v1.2.3