diff options
Diffstat (limited to 'src/gpu/effect.h')
| -rw-r--r-- | src/gpu/effect.h | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/src/gpu/effect.h b/src/gpu/effect.h index d40e750..d47a8b7 100644 --- a/src/gpu/effect.h +++ b/src/gpu/effect.h @@ -6,6 +6,8 @@ #include "gpu/gpu.h" #include "gpu/sequence.h" +#include "gpu/uniform_helper.h" +#include "gpu/wgpu_resource.h" #include <string> #include <vector> @@ -14,7 +16,8 @@ class NodeRegistry; class Effect { public: Effect(const GpuContext& ctx, const std::vector<std::string>& inputs, - const std::vector<std::string>& outputs); + const std::vector<std::string>& outputs, float start_time, + float end_time); virtual ~Effect() = default; // Optional: Declare temporary nodes (e.g., multi-pass intermediate buffers) @@ -22,12 +25,15 @@ class Effect { (void)registry; } - // Render effect (multi-input/multi-output) + // Automatic passthrough outside [start, end] + void dispatch_render(WGPUCommandEncoder encoder, + const UniformsSequenceParams& params, + NodeRegistry& nodes); + virtual void render(WGPUCommandEncoder encoder, const UniformsSequenceParams& params, NodeRegistry& nodes) = 0; - // Resize notification virtual void resize(int width, int height) { width_ = width; height_ = height; @@ -46,5 +52,30 @@ class Effect { std::vector<std::string> output_nodes_; int width_ = 1280; int height_ = 720; + + // Common resources for most effects + UniformBuffer<UniformsSequenceParams> uniforms_buffer_; + Sampler sampler_; + Texture dummy_texture_; + TextureView dummy_texture_view_; + + // Helper: Initialize uniforms buffer (call in subclass constructor) + void init_uniforms_buffer(); + + // Helper: Create linear sampler (call in subclass constructor) + void create_linear_sampler(); + + // Helper: Create nearest sampler (call in subclass constructor) + void create_nearest_sampler(); + + // Helper: Create dummy texture for scene effects (call in subclass constructor) + void create_dummy_scene_texture(); + + private: + float start_time_; + float end_time_; + + // Auto-passthrough helper for 1:1 input/output effects + void blit_input_to_output(WGPUCommandEncoder encoder, NodeRegistry& nodes); }; #endif // EFFECT_H |
