diff --git a/wgpu-hal/src/vulkan/adapter.rs b/wgpu-hal/src/vulkan/adapter.rs index 76cfdb710..81fc92b28 100644 --- a/wgpu-hal/src/vulkan/adapter.rs +++ b/wgpu-hal/src/vulkan/adapter.rs @@ -681,8 +681,7 @@ impl super::InstanceShared { } unsafe { - get_device_properties - .get_physical_device_properties2_khr(phd, &mut properites2); + get_device_properties.get_physical_device_properties2(phd, &mut properites2); } properites2.properties } else { @@ -749,7 +748,7 @@ impl super::InstanceShared { } unsafe { - get_device_properties.get_physical_device_features2_khr(phd, &mut features2); + get_device_properties.get_physical_device_features2(phd, &mut features2); } features2.features } else { diff --git a/wgpu-hal/src/vulkan/instance.rs b/wgpu-hal/src/vulkan/instance.rs index 611311260..d5fbe0287 100644 --- a/wgpu-hal/src/vulkan/instance.rs +++ b/wgpu-hal/src/vulkan/instance.rs @@ -1,7 +1,7 @@ use std::{ cmp, ffi::{c_void, CStr, CString}, - mem, slice, + slice, sync::Arc, thread, }; @@ -207,16 +207,15 @@ impl super::Instance { None }; - let get_physical_device_properties = extensions - .iter() - .find(|&&ext| ext == vk::KhrGetPhysicalDeviceProperties2Fn::name()) - .map(|_| { - vk::KhrGetPhysicalDeviceProperties2Fn::load(|name| { - mem::transmute( - entry.get_instance_proc_addr(raw_instance.handle(), name.as_ptr()), - ) - }) - }); + let get_physical_device_properties = + if extensions.contains(&khr::GetPhysicalDeviceProperties2::name()) { + Some(khr::GetPhysicalDeviceProperties2::new( + &entry, + &raw_instance, + )) + } else { + None + }; Ok(Self { shared: Arc::new(super::InstanceShared { diff --git a/wgpu-hal/src/vulkan/mod.rs b/wgpu-hal/src/vulkan/mod.rs index 79e9a9da3..635913e77 100644 --- a/wgpu-hal/src/vulkan/mod.rs +++ b/wgpu-hal/src/vulkan/mod.rs @@ -84,7 +84,7 @@ struct InstanceShared { drop_guard: Option, flags: crate::InstanceFlags, debug_utils: Option, - get_physical_device_properties: Option, + get_physical_device_properties: Option, entry: ash::Entry, has_nv_optimus: bool, }