summaryrefslogtreecommitdiff
path: root/src/gpu/effect.cc
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-03-23 07:54:18 +0100
committerskal <pascal.massimino@gmail.com>2026-03-23 07:54:18 +0100
commit491a3c1ccbd0f46be655e97d2e3697135df6e3a2 (patch)
tree57e9d7d8732fe7a0625d99641e780b38ace4c765 /src/gpu/effect.cc
parent1e3813355e37f903314ec2069ff788c6f69becfd (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.cc')
-rw-r--r--src/gpu/effect.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/gpu/effect.cc b/src/gpu/effect.cc
index 4230021..1257090 100644
--- a/src/gpu/effect.cc
+++ b/src/gpu/effect.cc
@@ -58,6 +58,20 @@ void Effect::blit_input_to_output(WGPUCommandEncoder encoder,
&extent);
}
+std::string Effect::find_downstream_output(
+ const std::vector<EffectDAGNode>& dag) const {
+ for (const auto& node : dag) {
+ for (const auto& in : node.input_nodes) {
+ for (const auto& out : output_nodes_) {
+ if (in == out && !node.output_nodes.empty()) {
+ return node.output_nodes[0];
+ }
+ }
+ }
+ }
+ return "";
+}
+
void Effect::create_linear_sampler() {
sampler_.set(gpu_create_linear_sampler(ctx_.device));
}