diff --git a/examples/src/bin/texture.rs b/examples/src/bin/texture.rs index a8ffd91..0377159 100644 --- a/examples/src/bin/texture.rs +++ b/examples/src/bin/texture.rs @@ -355,6 +355,7 @@ fn main() { record_submit_commandbuffer( &base.device, base.setup_command_buffer, + base.setup_commands_reuse_fence, base.present_queue, &[], &[], @@ -736,6 +737,7 @@ fn main() { record_submit_commandbuffer( &base.device, base.draw_command_buffer, + base.draw_commands_reuse_fence, base.present_queue, &[vk::PipelineStageFlags::BOTTOM_OF_PIPE], &[base.present_complete_semaphore], diff --git a/examples/src/bin/triangle.rs b/examples/src/bin/triangle.rs index 86ca5ed..9e5ed96 100644 --- a/examples/src/bin/triangle.rs +++ b/examples/src/bin/triangle.rs @@ -394,6 +394,7 @@ fn main() { record_submit_commandbuffer( &base.device, base.draw_command_buffer, + base.draw_commands_reuse_fence, base.present_queue, &[vk::PipelineStageFlags::COLOR_ATTACHMENT_OUTPUT], &[base.present_complete_semaphore], diff --git a/examples/src/lib.rs b/examples/src/lib.rs index 6f54b07..d350c3d 100644 --- a/examples/src/lib.rs +++ b/examples/src/lib.rs @@ -25,10 +25,14 @@ macro_rules! offset_of { } }}; } - +/// Helper function for submitting command buffers. Immediately waits for the fence before the command buffer +/// is executed. That way we can delay the waiting for the fences by 1 frame which is good for performance. +/// Make sure to create the fence in a signaled state on the first use. +#[allow(clippy::too_many_arguments)] pub fn record_submit_commandbuffer( device: &D, command_buffer: vk::CommandBuffer, + command_buffer_reuse_fence: vk::Fence, submit_queue: vk::Queue, wait_mask: &[vk::PipelineStageFlags], wait_semaphores: &[vk::Semaphore], @@ -36,6 +40,14 @@ pub fn record_submit_commandbuffer