Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/graphics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,22 @@ impl<'window> Gpu<'window> {
let surface = instance.create_surface(Arc::clone(&window)).unwrap();
let push_const_size = std::mem::size_of::<[f32; 2]>() as u32;

// Jitter when resizing windows on macOS
// https://github.com/gfx-rs/wgpu/issues/3756
// https://github.com/gfx-rs/wgpu/pull/6107
// https://thume.ca/2019/06/19/glitchless-metal-window-resizing/
// https://raphlinus.github.io/rust/gui/2019/06/21/smooth-resize-test.html
#[allow(invalid_reference_casting)]
unsafe {
surface.as_hal::<wgpu::hal::metal::Api, _, ()>(|surface| {
if let Some(surface_ref) = surface {
let surface_mut = &mut *(surface_ref as *const wgpu::hal::metal::Surface
as *mut wgpu::hal::metal::Surface);
surface_mut.present_with_transaction = true;
}
});
}

let adapter = instance
.request_adapter(&wgpu::RequestAdapterOptions {
power_preference: wgpu::PowerPreference::default(),
Expand Down