use crate::kvasir::nodes::PassId;
use crate::kvasir::{ExecutionContext, KvasirNode, ResourceId};
pub struct DeferredLightingNode {
pub ssao_occlusion: ResourceId,
pub shadow_atlas: ResourceId,
pub scene_output: ResourceId,
pub inputs: [ResourceId; 2],
}
impl KvasirNode for DeferredLightingNode {
fn label(&self) -> &'static str {
"DeferredLightingPass"
}
fn inputs(&self) -> &[ResourceId] {
&self.inputs
}
fn outputs(&self) -> &[ResourceId] {
std::slice::from_ref(&self.scene_output)
}
fn pass_id(&self) -> PassId {
PassId::Opaque3d
}
fn execute(&self, ctx: &mut ExecutionContext) {
tracing::debug!("DeferredLightingNode::execute - Resolving deferred PBR shading equations");
let dest_view = match ctx.registry.get_texture_view(self.scene_output) {
Some(v) => v,
None => return,
};
let mut _pass = ctx.encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
label: Some("Deferred Lighting Resolve Pass"),
color_attachments: &[Some(wgpu::RenderPassColorAttachment {
view: &dest_view,
resolve_target: None,
ops: wgpu::Operations {
load: wgpu::LoadOp::Load,
store: wgpu::StoreOp::Store,
},
depth_slice: None,
})],
depth_stencil_attachment: None,
timestamp_writes: None,
occlusion_query_set: None,
multiview_mask: None,
});
}
}