File tree 1 file changed +16
-0
lines changed
1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -65,6 +65,22 @@ impl<'window> Gpu<'window> {
65
65
let surface = instance. create_surface ( Arc :: clone ( & window) ) . unwrap ( ) ;
66
66
let push_const_size = std:: mem:: size_of :: < [ f32 ; 2 ] > ( ) as u32 ;
67
67
68
+ // Jitter when resizing windows on macOS
69
+ // https://github.com/gfx-rs/wgpu/issues/3756
70
+ // https://github.com/gfx-rs/wgpu/pull/6107
71
+ // https://thume.ca/2019/06/19/glitchless-metal-window-resizing/
72
+ // https://raphlinus.github.io/rust/gui/2019/06/21/smooth-resize-test.html
73
+ #[ allow( invalid_reference_casting) ]
74
+ unsafe {
75
+ surface. as_hal :: < wgpu:: hal:: metal:: Api , _ , ( ) > ( |surface| {
76
+ if let Some ( surface_ref) = surface {
77
+ let surface_mut = & mut * ( surface_ref as * const wgpu:: hal:: metal:: Surface
78
+ as * mut wgpu:: hal:: metal:: Surface ) ;
79
+ surface_mut. present_with_transaction = true ;
80
+ }
81
+ } ) ;
82
+ }
83
+
68
84
let adapter = instance
69
85
. request_adapter ( & wgpu:: RequestAdapterOptions {
70
86
power_preference : wgpu:: PowerPreference :: default ( ) ,
You can’t perform that action at this time.
0 commit comments