Use the voxel raycast shader

This commit is contained in:
Jarrod Doyle 2023-04-08 21:52:52 +01:00
parent 33f3aae349
commit e13aab1808
Signed by: Jayrude
GPG Key ID: 38B57B16E7C0ADF7
1 changed files with 8 additions and 14 deletions

View File

@ -138,7 +138,7 @@ impl Renderer {
});
log::info!("Creating compute pipeline...");
let cs_descriptor = wgpu::include_wgsl!("../assets/shaders/image_recolor.wgsl");
let cs_descriptor = wgpu::include_wgsl!("../assets/shaders/branchless_dda.wgsl");
let cs = context.device.create_shader_module(cs_descriptor);
let compute_layout =
context
@ -182,19 +182,6 @@ impl Renderer {
entry_point: "compute",
});
let mut encoder = context
.device
.create_command_encoder(&wgpu::CommandEncoderDescriptor::default());
let size = render_texture.attributes.size;
let mut compute_pass = encoder.begin_compute_pass(&wgpu::ComputePassDescriptor::default());
compute_pass.set_pipeline(&compute_pipeline);
compute_pass.set_bind_group(0, &compute_bind_group, &[]);
compute_pass.dispatch_workgroups(size.width / 8, size.height / 8, 1);
drop(compute_pass);
context.queue.submit(Some(encoder.finish()));
let clear_color = wgpu::Color {
r: 255.0 / 255.0,
g: 216.0 / 255.0,
@ -221,6 +208,13 @@ impl Renderer {
.device
.create_command_encoder(&wgpu::CommandEncoderDescriptor::default());
let size = self.render_texture.attributes.size;
let mut compute_pass = encoder.begin_compute_pass(&wgpu::ComputePassDescriptor::default());
compute_pass.set_pipeline(&self.compute_pipeline);
compute_pass.set_bind_group(0, &self.compute_bind_group, &[]);
compute_pass.dispatch_workgroups(size.width / 8, size.height / 8, 1);
drop(compute_pass);
let mut render_pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
label: Some("Render Pass"),
color_attachments: &[Some(wgpu::RenderPassColorAttachment {