From c0d4cef8177e1aef1f9b899a426bc684c6ad4683 Mon Sep 17 00:00:00 2001 From: marc0246 <40955683+marc0246@users.noreply.github.com> Date: Mon, 30 Oct 2023 00:41:43 +0100 Subject: [PATCH] Backport #2382 to 0.34.1 --- vulkano-util/Cargo.toml | 1 - vulkano-util/src/context.rs | 18 +++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/vulkano-util/Cargo.toml b/vulkano-util/Cargo.toml index 5d94ba7a..58035c6c 100644 --- a/vulkano-util/Cargo.toml +++ b/vulkano-util/Cargo.toml @@ -14,5 +14,4 @@ categories = ["rendering::graphics-api"] [dependencies] ahash = "0.8" vulkano = { version = "0.34.0", path = "../vulkano", default-features = false } -vulkano-win = { version = "0.34.0", path = "../vulkano-win" } winit = { version = "0.28" } diff --git a/vulkano-util/src/context.rs b/vulkano-util/src/context.rs index 80bbb739..a865ef23 100644 --- a/vulkano-util/src/context.rs +++ b/vulkano-util/src/context.rs @@ -125,8 +125,6 @@ impl VulkanoContext { /// # Panics /// /// - Panics where the underlying Vulkano struct creations fail - // FIXME: - #[allow(deprecated)] pub fn new(mut config: VulkanoConfig) -> Self { let library = match VulkanLibrary::new() { Ok(x) => x, @@ -139,7 +137,21 @@ impl VulkanoContext { }; // Append required extensions - config.instance_create_info.enabled_extensions = vulkano_win::required_extensions(&library) + // HACK: This should be replaced with `Surface::required_extensions`, but will need to + // happen in the next minor version bump. It should have been done before releasing 0.34. + config.instance_create_info.enabled_extensions = library + .supported_extensions() + .intersection(&InstanceExtensions { + khr_surface: true, + khr_xlib_surface: true, + khr_xcb_surface: true, + khr_wayland_surface: true, + khr_android_surface: true, + khr_win32_surface: true, + mvk_ios_surface: true, + mvk_macos_surface: true, + ..InstanceExtensions::empty() + }) .union(&config.instance_create_info.enabled_extensions); // Create instance