diff --git a/examples/Cargo.toml b/examples/Cargo.toml index c326da6e..92d8c7ad 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -9,7 +9,7 @@ vulkano = { path = "../vulkano" } vulkano-win = { path = "../vulkano-win" } cgmath = "0.7.0" image = "0.6.1" -winit = "0.5.1" +winit = "0.5.2" [build-dependencies] vk-sys = { path = "../vk-sys" } diff --git a/vulkano-win/Cargo.toml b/vulkano-win/Cargo.toml index 537b861c..4fff4cd5 100644 --- a/vulkano-win/Cargo.toml +++ b/vulkano-win/Cargo.toml @@ -8,4 +8,4 @@ license = "MIT/Apache-2.0" [dependencies] vulkano = { version = "0.2.0", path = "../vulkano" } -winit = "0.5.1" +winit = "0.5.2" diff --git a/vulkano-win/src/lib.rs b/vulkano-win/src/lib.rs index 5e6aac5d..8a6d9fe0 100644 --- a/vulkano-win/src/lib.rs +++ b/vulkano-win/src/lib.rs @@ -126,10 +126,17 @@ unsafe fn winit_to_surface(instance: &Arc, match (win.get_wayland_display(), win.get_wayland_surface()) { (Some(display), Some(surface)) => Surface::from_wayland(instance, display, surface), _ => { - // No wayland display found, assume xlib will work. - Surface::from_xlib(instance, - win.get_xlib_display().unwrap(), - win.get_xlib_window().unwrap()) + // No wayland display found, check if we can use xlib. + // If not, we use xcb. + if instance.loaded_extensions().khr_xlib_surface { + Surface::from_xlib(instance, + win.get_xlib_display().unwrap(), + win.get_xlib_window().unwrap()) + } else { + Surface::from_xcb(instance, + win.get_xcb_connection().unwrap(), + win.get_xlib_window().unwrap()) + } } } } diff --git a/vulkano/src/swapchain/surface.rs b/vulkano/src/swapchain/surface.rs index 45c8e620..e38a8777 100644 --- a/vulkano/src/swapchain/surface.rs +++ b/vulkano/src/swapchain/surface.rs @@ -395,7 +395,7 @@ impl Surface { modes.as_mut_ptr()) )); modes.set_len(num as usize); - debug_assert!(modes.iter().find(|&&m| m == vk::PRESENT_MODE_FIFO_KHR).is_some()); + debug_assert!(modes.iter().count() > 0); SupportedPresentModes::from_list(modes.into_iter()) };