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 @@ -748,6 +748,10 @@ impl HelloTriangleApplication {
748
748
749
749
let command_buffer = self . command_buffers [ image_index] . clone ( ) ;
750
750
751
+ // we're joining on the previous future but the CPU is running faster than the GPU so
752
+ // eventually it stutters, and jumps ahead to the newer frames.
753
+ //
754
+ // See vulkano issue 1135: https://github.com/vulkano-rs/vulkano/issues/1135
751
755
let future = self . previous_frame_end . take ( ) . unwrap ( )
752
756
. join ( acquire_future)
753
757
. then_execute ( self . graphics_queue . clone ( ) , command_buffer)
@@ -757,6 +761,11 @@ impl HelloTriangleApplication {
757
761
758
762
match future {
759
763
Ok ( future) => {
764
+ // This makes sure the CPU stays in sync with the GPU in situations when the CPU is
765
+ // running "too fast"
766
+ #[ cfg( target_os = "macos" ) ]
767
+ future. wait ( None ) . unwrap ( ) ;
768
+
760
769
self . previous_frame_end = Some ( Box :: new ( future) as Box < _ > ) ;
761
770
}
762
771
Err ( vulkano:: sync:: FlushError :: OutOfDate ) => {
You can’t perform that action at this time.
0 commit comments