Move init_physical_devices to dedicated function
@@ -219,7 +219,24 @@ impl Instance {
};
// Getting the properties of all physical devices.
- let physical_devices = {
+ // If possible, we use VK_KHR_get_physical_device_properties2.
+ let physical_devices = if extensions.khr_get_physical_device_properties2 {
+ unimplemented!()
+ } else {
+ Instance::init_physical_devices(&vk, physical_devices)
+ };
+
+ Ok(Arc::new(Instance {
+ instance: instance,
+ //alloc: None,
+ physical_devices: physical_devices,
+ vk: vk,
+ extensions: extensions.clone(),
+ layers: layers,
+ }))
+ }
+
+ fn init_physical_devices(vk: &vk::InstancePointers, physical_devices: Vec<vk::PhysicalDevice>) -> Vec<PhysicalDeviceInfos> {
let mut output = Vec::with_capacity(physical_devices.len());
for device in physical_devices.into_iter() {
@@ -261,16 +278,6 @@ impl Instance {
});
}
output
- };
-
- Ok(Arc::new(Instance {
- instance: instance,
- //alloc: None,
- physical_devices: physical_devices,
- vk: vk,
- extensions: extensions.clone(),
- layers: layers,
- }))
}
/*/// Same as `new`, but provides an allocator that will be used by the Vulkan library whenever
