diff options
| author | skal <pascal.massimino@gmail.com> | 2026-03-23 07:54:18 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-03-23 07:54:18 +0100 |
| commit | 491a3c1ccbd0f46be655e97d2e3697135df6e3a2 (patch) | |
| tree | 57e9d7d8732fe7a0625d99641e780b38ace4c765 /src/gpu/effect.h | |
| parent | 1e3813355e37f903314ec2069ff788c6f69becfd (diff) | |
feat(gbuffer): wire_dag() + find_downstream_output() for temporal feedback
- Add Effect::wire_dag() virtual (called from init_effect_nodes after full DAG built)
- Add Effect::find_downstream_output() protected helper (first downstream consumer output)
- GBufferEffect::wire_dag() auto-sets cnn_output_node_ via find_downstream_output,
guarding against sink (external view, null texture)
- GBufferEffect::post_render() null-checks src texture before CopyTextureToTexture
- Tests: find_downstream_output cases + wire_dag integration in test_effect_base
- Doc: SEQUENCE.md updated with wire_dag pattern, helper contract, and sink guard
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'src/gpu/effect.h')
| -rw-r--r-- | src/gpu/effect.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/gpu/effect.h b/src/gpu/effect.h index 566faba..6c50d84 100644 --- a/src/gpu/effect.h +++ b/src/gpu/effect.h @@ -41,6 +41,13 @@ class Effect { (void)nodes; } + // Called once after the full DAG is built (init_effect_nodes). + // Override to auto-wire inter-effect dependencies (e.g. temporal feedback). + // Default is a no-op. + virtual void wire_dag(const std::vector<struct EffectDAGNode>& dag) { + (void)dag; + } + virtual void resize(int width, int height) { width_ = width; height_ = height; @@ -67,6 +74,13 @@ class Effect { Texture dummy_texture_; TextureView dummy_texture_view_; + // DAG query helpers (callable from wire_dag overrides) + // + // Returns output_nodes[0] of the first effect in |dag| whose input_nodes + // intersect this effect's output_nodes_ (i.e. the first direct downstream + // consumer). Returns "" if no such effect exists or it has no outputs. + std::string find_downstream_output(const std::vector<EffectDAGNode>& dag) const; + // Helper: Create linear sampler (call in subclass constructor if needed) void create_linear_sampler(); |
