Add blank render pass

This commit is contained in:
Jarrod Doyle 2023-10-14 10:11:47 +01:00
parent 0dd7bbd37e
commit b5680d5328
Signed by: Jayrude
GPG Key ID: 38B57B16E7C0ADF7
1 changed files with 37 additions and 0 deletions

View File

@ -40,6 +40,43 @@ pub async fn run() {
} }
_ => {} _ => {}
}, },
Event::RedrawRequested(window_id) if window_id == render_ctx.window.id() => {
let output = match render_ctx.surface.get_current_texture() {
Ok(it) => it,
Err(err) => return log::error!("{err}"),
};
let view = output
.texture
.create_view(&wgpu::TextureViewDescriptor::default());
let mut encoder =
render_ctx
.device
.create_command_encoder(&wgpu::CommandEncoderDescriptor {
label: Some("Render encoder"),
});
let _render_pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
label: Some("Render Pass"),
color_attachments: &[Some(wgpu::RenderPassColorAttachment {
view: &view,
resolve_target: None,
ops: wgpu::Operations {
load: wgpu::LoadOp::Clear(wgpu::Color::BLACK),
store: true,
},
})],
depth_stencil_attachment: None,
});
drop(_render_pass);
render_ctx.queue.submit(std::iter::once(encoder.finish()));
output.present();
}
Event::MainEventsCleared => {
render_ctx.window.request_redraw();
}
_ => {} _ => {}
}); });
} }