From 2e2e01048da5c466102bb57d64148aff72f4a558 Mon Sep 17 00:00:00 2001 From: skal Date: Tue, 17 Feb 2026 12:51:29 +0100 Subject: refactor(gpu): Add RAII wrapper for WGPU resources to eliminate manual cleanup Introduces WGPUResource template with automatic release on destruction. Reduces boilerplate in effect destructors and prevents resource leaks. - set() for one-time initialization - replace() for per-frame recreation - Field ordering documented for dependency management Converted 3 effects (Heptagon, Flash, Passthrough) and Effect base class. All tests pass (34/34). Co-Authored-By: Claude Sonnet 4.5 --- src/effects/passthrough_effect.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/effects/passthrough_effect.h') diff --git a/src/effects/passthrough_effect.h b/src/effects/passthrough_effect.h index 3813fa8..1c60e02 100644 --- a/src/effects/passthrough_effect.h +++ b/src/effects/passthrough_effect.h @@ -4,6 +4,7 @@ #include "gpu/effect.h" #include "gpu/uniform_helper.h" +#include "gpu/wgpu_resource.h" class Passthrough : public Effect { public: @@ -15,6 +16,6 @@ class Passthrough : public Effect { NodeRegistry& nodes) override; private: - WGPURenderPipeline pipeline_; - WGPUBindGroup bind_group_; + RenderPipeline pipeline_; + BindGroup bind_group_; }; -- cgit v1.2.3