mirror of
https://github.com/lisk77/comet.git
synced 2025-12-12 09:08:49 +00:00
feat(render_pass)!: renamed the universal_execute to universal_clear_execute and made a universal_load_execute
This commit is contained in:
parent
98200cf6b5
commit
025d2b3a5f
1 changed files with 52 additions and 1 deletions
|
|
@ -22,7 +22,7 @@ impl RenderPass {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn universal_execute(
|
pub fn universal_clear_execute(
|
||||||
label: String,
|
label: String,
|
||||||
ctx: &mut RenderContext,
|
ctx: &mut RenderContext,
|
||||||
encoder: &mut wgpu::CommandEncoder,
|
encoder: &mut wgpu::CommandEncoder,
|
||||||
|
|
@ -72,3 +72,54 @@ pub fn universal_execute(
|
||||||
0..1,
|
0..1,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn universal_load_execute(
|
||||||
|
label: String,
|
||||||
|
ctx: &mut RenderContext,
|
||||||
|
encoder: &mut wgpu::CommandEncoder,
|
||||||
|
view: &wgpu::TextureView,
|
||||||
|
) {
|
||||||
|
let mut render_pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
|
||||||
|
label: Some(format!("{} Render Pass", label.clone()).as_str()),
|
||||||
|
color_attachments: &[Some(wgpu::RenderPassColorAttachment {
|
||||||
|
view: &view,
|
||||||
|
resolve_target: None,
|
||||||
|
ops: wgpu::Operations {
|
||||||
|
load: wgpu::LoadOp::Load,
|
||||||
|
store: wgpu::StoreOp::Store,
|
||||||
|
},
|
||||||
|
})],
|
||||||
|
depth_stencil_attachment: None,
|
||||||
|
occlusion_query_set: None,
|
||||||
|
timestamp_writes: None,
|
||||||
|
});
|
||||||
|
|
||||||
|
render_pass.set_pipeline(&ctx.get_pipeline(label.clone()).unwrap());
|
||||||
|
|
||||||
|
let groups = ctx.resources().get_bind_groups(&label).unwrap();
|
||||||
|
for i in 0..groups.len() {
|
||||||
|
render_pass.set_bind_group(i as u32, groups.get(i).unwrap(), &[]);
|
||||||
|
}
|
||||||
|
|
||||||
|
render_pass.set_vertex_buffer(
|
||||||
|
0,
|
||||||
|
ctx.get_batch(label.clone())
|
||||||
|
.unwrap()
|
||||||
|
.vertex_buffer()
|
||||||
|
.slice(..),
|
||||||
|
);
|
||||||
|
|
||||||
|
render_pass.set_index_buffer(
|
||||||
|
ctx.get_batch(label.clone())
|
||||||
|
.unwrap()
|
||||||
|
.index_buffer()
|
||||||
|
.slice(..),
|
||||||
|
wgpu::IndexFormat::Uint16,
|
||||||
|
);
|
||||||
|
|
||||||
|
render_pass.draw_indexed(
|
||||||
|
0..ctx.get_batch(label.clone()).unwrap().num_indices(),
|
||||||
|
0,
|
||||||
|
0..1,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue