Skip to content

Commit d1add9d

Browse files
committed
adds macos explicity CPU/GPU sync
1 parent e775286 commit d1add9d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/bin/29_multisampling.rs

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

929929
let command_buffer = self.command_buffers[image_index].clone();
930930

931+
// we're joining on the previous future but the CPU is running faster than the GPU so
932+
// eventually it stutters, and jumps ahead to the newer frames.
933+
//
934+
// See vulkano issue 1135: https://github.com/vulkano-rs/vulkano/issues/1135
931935
let future = self.previous_frame_end.take().unwrap()
932936
.join(acquire_future)
933937
.then_execute(self.graphics_queue.clone(), command_buffer)
@@ -937,6 +941,11 @@ impl HelloTriangleApplication {
937941

938942
match future {
939943
Ok(future) => {
944+
// This makes sure the CPU stays in sync with the GPU in situations when the CPU is
945+
// running "too fast"
946+
#[cfg(target_os = "macos")]
947+
future.wait(None).unwrap();
948+
940949
self.previous_frame_end = Some(Box::new(future) as Box<_>);
941950
}
942951
Err(vulkano::sync::FlushError::OutOfDate) => {

0 commit comments

Comments
 (0)