Compare commits
2 commits
7be7c2959c
...
49b039a4d7
Author | SHA1 | Date | |
---|---|---|---|
49b039a4d7 | |||
8d3b03da24 |
3 changed files with 47 additions and 14 deletions
|
@ -32,7 +32,7 @@ chrono = { version = "0.4.35", features = ["serde"] }
|
|||
anyhow = { version = "1.0.86", features = ["backtrace"] }
|
||||
indexmap = { version = "2.2.6", features = ["rayon"] }
|
||||
shaderc = { version = "0.8.3", features = ["build-from-source"] }
|
||||
rusqlite = { version = "0.33.0", features = ["bundled"] }
|
||||
rusqlite = { version = "0.34.0", features = ["bundled"] }
|
||||
cgmath = "0.18.0"
|
||||
http = "1.1.0"
|
||||
iterchunks = "0.5.0"
|
||||
|
|
|
@ -305,6 +305,47 @@ where
|
|||
Ok((info_buffer, descriptor_set))
|
||||
}
|
||||
|
||||
fn copy_source_image(
|
||||
&self,
|
||||
buffer_recorder: &mut CommandBufferRecorder<'_>,
|
||||
current_swapchain_image: &Arc<Image>,
|
||||
) -> Result<()> {
|
||||
// bring image into transfer destination mode
|
||||
buffer_recorder.image_barrier(
|
||||
&self.target_image,
|
||||
VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
|
||||
VK_PIPELINE_STAGE_TRANSFER_BIT,
|
||||
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
|
||||
VK_PIPELINE_STAGE_TRANSFER_BIT,
|
||||
);
|
||||
|
||||
// transition swapchain image to transfer source mod
|
||||
buffer_recorder.image_barrier(
|
||||
current_swapchain_image,
|
||||
VK_IMAGE_LAYOUT_PRESENT_SRC_KHR,
|
||||
VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
|
||||
VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
|
||||
VK_PIPELINE_STAGE_TRANSFER_BIT,
|
||||
);
|
||||
|
||||
buffer_recorder.blit_complete(
|
||||
current_swapchain_image,
|
||||
&self.target_image,
|
||||
VK_FILTER_LINEAR,
|
||||
);
|
||||
|
||||
// bring image into receive mode
|
||||
buffer_recorder.image_barrier(
|
||||
&self.target_image,
|
||||
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
|
||||
VK_PIPELINE_STAGE_TRANSFER_BIT,
|
||||
VK_IMAGE_LAYOUT_GENERAL,
|
||||
VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn present_image(
|
||||
&self,
|
||||
buffer_recorder: &mut CommandBufferRecorder<'_>,
|
||||
|
@ -322,8 +363,8 @@ where
|
|||
// transition swapchain image to transfer destination
|
||||
buffer_recorder.image_barrier(
|
||||
current_swapchain_image,
|
||||
VK_IMAGE_LAYOUT_PRESENT_SRC_KHR,
|
||||
VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
|
||||
VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
|
||||
VK_PIPELINE_STAGE_TRANSFER_BIT,
|
||||
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
|
||||
VK_PIPELINE_STAGE_TRANSFER_BIT,
|
||||
);
|
||||
|
@ -334,15 +375,6 @@ where
|
|||
VK_FILTER_LINEAR,
|
||||
);
|
||||
|
||||
// bring image into receive mode
|
||||
buffer_recorder.image_barrier(
|
||||
&self.target_image,
|
||||
VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
|
||||
VK_PIPELINE_STAGE_TRANSFER_BIT,
|
||||
VK_IMAGE_LAYOUT_GENERAL,
|
||||
VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
|
||||
);
|
||||
|
||||
// transition swapchain image to present mode
|
||||
buffer_recorder.image_barrier(
|
||||
current_swapchain_image,
|
||||
|
@ -645,6 +677,8 @@ where
|
|||
.update(&[DescriptorWrite::storage_buffers(0, &[scene_buffer])])?;
|
||||
}
|
||||
|
||||
self.copy_source_image(buffer_recorder, &images.mono()[index])?;
|
||||
|
||||
self.renderer.process(
|
||||
buffer_recorder,
|
||||
&[
|
||||
|
|
|
@ -59,9 +59,7 @@ void main()
|
|||
pay_load_index
|
||||
);
|
||||
|
||||
// TODO: store depth value
|
||||
|
||||
imageStore(output_image, ivec2(gl_LaunchIDEXT.xy), vec4(pay_load.color.xyz, 1.0));
|
||||
|
||||
vec3 position;
|
||||
|
||||
|
@ -69,6 +67,7 @@ void main()
|
|||
position = vec3(INFINITY);
|
||||
} else {
|
||||
position = origin.xyz + pay_load.distance * direction.xyz;
|
||||
imageStore(output_image, ivec2(gl_LaunchIDEXT.xy), vec4(pay_load.color.xyz, 1.0));
|
||||
}
|
||||
|
||||
imageStore(depth_buffer, ivec2(gl_LaunchIDEXT.xy), vec4(position, 0.0));
|
||||
|
|
Loading…
Reference in a new issue