mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-19 22:11:01 +01:00
hal/vk: use more ergonomic GetPhysicalDeviceProperties2
This commit is contained in:
1 parent
c16f794aa4
commit
c0895f6fac
3 files changed
+13
-15
No files matched your search
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -84,7 +84,7 @@ struct InstanceShared {
|
||||
drop_guard: Option<DropGuard>,
|
||||
flags: crate::InstanceFlags,
|
||||
debug_utils: Option<DebugUtils>,
|
||||
get_physical_device_properties: Option<vk::KhrGetPhysicalDeviceProperties2Fn>,
|
||||
get_physical_device_properties: Option<khr::GetPhysicalDeviceProperties2>,
|
||||
entry: ash::Entry,
|
||||
has_nv_optimus: bool,
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user