use crate::render::wgpu::rendergraph::{PassExecutionContext, PassNode};
pub struct ScenePass;
impl ScenePass {
pub fn new(
_device: &wgpu::Device,
_color_format: wgpu::TextureFormat,
_depth_format: wgpu::TextureFormat,
) -> Self {
Self
}
}
impl PassNode<crate::ecs::world::World> for ScenePass {
fn name(&self) -> &str {
"scene_pass"
}
fn reads(&self) -> Vec<&str> {
vec![]
}
fn writes(&self) -> Vec<&str> {
vec![]
}
fn reads_writes(&self) -> Vec<&str> {
vec!["color", "depth"]
}
fn prepare(
&mut self,
_device: &wgpu::Device,
_queue: &wgpu::Queue,
_world: &crate::ecs::world::World,
) {
}
fn execute<'r, 'e>(
&mut self,
context: PassExecutionContext<'r, 'e, crate::ecs::world::World>,
) -> crate::render::wgpu::rendergraph::Result<
Vec<crate::render::wgpu::rendergraph::SubGraphRunCommand<'r>>,
> {
let (color_view, color_load, color_store) = context.get_color_attachment("color")?;
let (depth_view, depth_load, depth_store) = context.get_depth_attachment("depth")?;
let render_pass = context
.encoder
.begin_render_pass(&wgpu::RenderPassDescriptor {
label: Some("Scene Pass"),
color_attachments: &[Some(wgpu::RenderPassColorAttachment {
view: color_view,
resolve_target: None,
ops: wgpu::Operations {
load: color_load,
store: color_store,
},
depth_slice: None,
})],
depth_stencil_attachment: Some(wgpu::RenderPassDepthStencilAttachment {
view: depth_view,
depth_ops: Some(wgpu::Operations {
load: depth_load,
store: depth_store,
}),
stencil_ops: None,
}),
timestamp_writes: None,
occlusion_query_set: None,
});
drop(render_pass);
Ok(context.into_sub_graph_commands())
}
}