cvkg_render_gpu/passes/
taa.rs1use crate::kvasir::nodes::PassId;
5use crate::kvasir::{ExecutionContext, KvasirNode, ResourceId};
6
7pub struct TaaNode {
9 pub current_color: ResourceId,
11 pub history_color: ResourceId,
13 pub motion_vectors: ResourceId,
15 pub output_color: ResourceId,
17 pub inputs: [ResourceId; 3],
19}
20
21impl KvasirNode for TaaNode {
22 fn label(&self) -> &'static str {
23 "TaaPass"
24 }
25
26 fn inputs(&self) -> &[ResourceId] {
27 &self.inputs
28 }
29
30 fn outputs(&self) -> &[ResourceId] {
31 std::slice::from_ref(&self.output_color)
32 }
33
34 fn pass_id(&self) -> PassId {
35 PassId::Composite
36 }
37
38 fn execute(&self, ctx: &mut ExecutionContext) {
39 tracing::debug!("TaaNode::execute - Blending history with current frame for TAA");
40
41 let dest_view = match ctx.registry.get_texture_view(self.output_color) {
42 Some(v) => v,
43 None => return,
44 };
45
46 let mut _pass = ctx.encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
48 label: Some("TAA Composite Pass"),
49 color_attachments: &[Some(wgpu::RenderPassColorAttachment {
50 view: &dest_view,
51 resolve_target: None,
52 ops: wgpu::Operations {
53 load: wgpu::LoadOp::Clear(wgpu::Color::BLACK),
54 store: wgpu::StoreOp::Store,
55 },
56 depth_slice: None,
57 })],
58 depth_stencil_attachment: None,
59 timestamp_writes: None,
60 occlusion_query_set: None,
61 multiview_mask: None,
62 });
63
64 }
67}