File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -928,6 +928,10 @@ impl HelloTriangleApplication {
928
928
929
929
let command_buffer = self . command_buffers [ image_index] . clone ( ) ;
930
930
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
931
935
let future = self . previous_frame_end . take ( ) . unwrap ( )
932
936
. join ( acquire_future)
933
937
. then_execute ( self . graphics_queue . clone ( ) , command_buffer)
@@ -937,6 +941,11 @@ impl HelloTriangleApplication {
937
941
938
942
match future {
939
943
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
+
940
949
self . previous_frame_end = Some ( Box :: new ( future) as Box < _ > ) ;
941
950
}
942
951
Err ( vulkano:: sync:: FlushError :: OutOfDate ) => {
You can’t perform that action at this time.
0 commit comments