cvkg_render_gpu/passes/
deferred_lighting.rs1use crate::kvasir::nodes::PassId;
5use crate::kvasir::{ExecutionContext, KvasirNode, ResourceId};
6
7pub struct DeferredLightingNode {
9 pub ssao_occlusion: ResourceId,
11 pub shadow_atlas: ResourceId,
13 pub scene_output: ResourceId,
15 pub inputs: [ResourceId; 2],
17}
18
19impl KvasirNode for DeferredLightingNode {
20 fn label(&self) -> &'static str {
21 "DeferredLightingPass"
22 }
23
24 fn inputs(&self) -> &[ResourceId] {
25 &self.inputs
26 }
27
28 fn outputs(&self) -> &[ResourceId] {
29 std::slice::from_ref(&self.scene_output)
30 }
31
32 fn pass_id(&self) -> PassId {
33 PassId::Opaque3d
34 }
35
36 fn execute(&self, ctx: &mut ExecutionContext) {
37 tracing::debug!("DeferredLightingNode::execute - Resolving deferred PBR shading equations");
38
39 let dest_view = match ctx.registry.get_texture_view(self.scene_output) {
40 Some(v) => v,
41 None => return,
42 };
43
44 let mut _pass = ctx.encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
46 label: Some("Deferred Lighting Resolve Pass"),
47 color_attachments: &[Some(wgpu::RenderPassColorAttachment {
48 view: &dest_view,
49 resolve_target: None,
50 ops: wgpu::Operations {
51 load: wgpu::LoadOp::Load,
52 store: wgpu::StoreOp::Store,
53 },
54 depth_slice: None,
55 })],
56 depth_stencil_attachment: None,
57 timestamp_writes: None,
58 occlusion_query_set: None,
59 multiview_mask: None,
60 });
61
62 }
65}