From ce382f37355195f7ea6c204a22aa77e5280a236c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noah=20H=C3=BCsser?= Date: Wed, 3 Jul 2019 22:47:13 +0200 Subject: [PATCH] Adapt to changes in wgpu for a configurable PresentMode. Gl fixes. Try fix this mess .. GL fixess Revert intermediate wgpu branch Set proper wgpu-native commit ref Adapt examples to the new features. --- Cargo.toml | 2 +- examples/framework.rs | 1 + examples/hello-triangle/main.rs | 1 + src/lib.rs | 4 ++++ 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 96976d5fbc..a0e52239fa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,7 @@ gl = ["wgn/gfx-backend-gl"] [dependencies] #TODO: only depend on the published version -wgn = { package = "wgpu-native", version = "0.2.6", features = ["local", "window-winit"], git = "https://github.com/gfx-rs/wgpu", rev = "dbef9f397eda87b82ae1691b2f7e8ba0f3e2e5d2" } +wgn = { package = "wgpu-native", version = "0.2.6", features = ["local", "window-winit"], git = "https://github.com/gfx-rs/wgpu", rev = "32399cff8a0b55389f2d2493ea5c900c986c2547" } arrayvec = "0.4" [dev-dependencies] diff --git a/examples/framework.rs b/examples/framework.rs index 40ea24f663..74495acca6 100644 --- a/examples/framework.rs +++ b/examples/framework.rs @@ -113,6 +113,7 @@ pub fn run(title: &str) { format: wgpu::TextureFormat::Bgra8Unorm, width: size.width.round() as u32, height: size.height.round() as u32, + present_mode: wgpu::PresentMode::Vsync, }; let mut swap_chain = device.create_swap_chain(&surface, &sc_desc); diff --git a/examples/hello-triangle/main.rs b/examples/hello-triangle/main.rs index ceacf4e930..cf5172b0ec 100644 --- a/examples/hello-triangle/main.rs +++ b/examples/hello-triangle/main.rs @@ -110,6 +110,7 @@ fn main() { format: wgpu::TextureFormat::Bgra8Unorm, width: size.width.round() as u32, height: size.height.round() as u32, + present_mode: wgpu::PresentMode::Vsync, }, ); let mut running = true; diff --git a/src/lib.rs b/src/lib.rs index 56991fd4c1..80eb52874d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -59,6 +59,7 @@ pub use wgn::{ TextureViewDimension, VertexAttributeDescriptor, VertexFormat, + PresentMode, }; #[cfg(feature = "gl")] @@ -503,6 +504,7 @@ impl Instance { } } + #[cfg(not(feature = "gl"))] pub fn create_surface_from_xlib( &self, display: *mut *const std::ffi::c_void, @@ -513,12 +515,14 @@ impl Instance { } } + #[cfg(not(feature = "gl"))] pub fn create_surface_from_macos_layer(&self, layer: *mut std::ffi::c_void) -> Surface { Surface { id: wgn::wgpu_instance_create_surface_from_macos_layer(self.id, layer), } } + #[cfg(not(feature = "gl"))] pub fn create_surface_from_windows_hwnd( &self, hinstance: *mut std::ffi::c_void,