Skip to content

Commit 09d2681

Browse files
author
Matthew Russo
committed
adds macos explicity CPU/GPU sync
1 parent 152b966 commit 09d2681

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/bin/28_generating_mipmaps.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -919,6 +919,10 @@ impl HelloTriangleApplication {
919919

920920
let command_buffer = self.command_buffers[image_index].clone();
921921

922+
// we're joining on the previous future but the CPU is running faster than the GPU so
923+
// eventually it stutters, and jumps ahead to the newer frames.
924+
//
925+
// See vulkano issue 1135: https://github.com/vulkano-rs/vulkano/issues/1135
922926
let future = self.previous_frame_end.take().unwrap()
923927
.join(acquire_future)
924928
.then_execute(self.graphics_queue.clone(), command_buffer)
@@ -928,6 +932,11 @@ impl HelloTriangleApplication {
928932

929933
match future {
930934
Ok(future) => {
935+
// This makes sure the CPU stays in sync with the GPU in situations when the CPU is
936+
// running "too fast"
937+
#[cfg(target_os = "macos")]
938+
future.wait(None).unwrap();
939+
931940
self.previous_frame_end = Some(Box::new(future) as Box<_>);
932941
}
933942
Err(vulkano::sync::FlushError::OutOfDate) => {

0 commit comments

Comments
 (0)