use crate::kvasir::nodes::PassId;
use crate::kvasir::{ExecutionContext, KvasirNode, ResourceId};
pub struct TaaNode {
pub current_color: ResourceId,
pub history_color: ResourceId,
pub motion_vectors: ResourceId,
pub output_color: ResourceId,
pub inputs: [ResourceId; 3],
}
impl KvasirNode for TaaNode {
fn label(&self) -> &'static str {
"TaaPass"
}
fn inputs(&self) -> &[ResourceId] {
&self.inputs
}
fn outputs(&self) -> &[ResourceId] {
std::slice::from_ref(&self.output_color)
}
fn pass_id(&self) -> PassId {
PassId::Composite
}
fn execute(&self, ctx: &mut ExecutionContext) {
tracing::debug!("TaaNode::execute - Blending history with current frame for TAA");
let dest_view = match ctx.registry.get_texture_view(self.output_color) {
Some(v) => v,
None => return,
};
let mut _pass = ctx.encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
label: Some("TAA Composite Pass"),
color_attachments: &[Some(wgpu::RenderPassColorAttachment {
view: &dest_view,
resolve_target: None,
ops: wgpu::Operations {
load: wgpu::LoadOp::Clear(wgpu::Color::BLACK),
store: wgpu::StoreOp::Store,
},
depth_slice: None,
})],
depth_stencil_attachment: None,
timestamp_writes: None,
occlusion_query_set: None,
multiview_mask: None,
});
}
}