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 @@ -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 ) => {
You can’t perform that action at this time.
0 commit comments