File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 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> {
6565 let surface = instance. create_surface ( Arc :: clone ( & window) ) . unwrap ( ) ;
6666 let push_const_size = std:: mem:: size_of :: < [ f32 ; 2 ] > ( ) as u32 ;
6767
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+
6884 let adapter = instance
6985 . request_adapter ( & wgpu:: RequestAdapterOptions {
7086 power_preference : wgpu:: PowerPreference :: default ( ) ,
You can’t perform that action at this time.
0 commit comments