From d89d0964ec24dc1d82ea1940e5cbe13bcdd0e451 Mon Sep 17 00:00:00 2001 From: Raph Levien Date: Sat, 3 Apr 2021 08:34:26 -0700 Subject: [PATCH] Clean up device create extensions --- piet-gpu-hal/src/vulkan.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/piet-gpu-hal/src/vulkan.rs b/piet-gpu-hal/src/vulkan.rs index bddbedc..273d860 100644 --- a/piet-gpu-hal/src/vulkan.rs +++ b/piet-gpu-hal/src/vulkan.rs @@ -282,12 +282,14 @@ impl VkInstance { .descriptor_binding_variable_descriptor_count(true) .runtime_descriptor_array(true); - let mut extensions = match surface { - Some(_) => vec![khr::Swapchain::name().as_ptr()], - None => vec![], - }; - extensions.push(vk::ExtDescriptorIndexingFn::name().as_ptr()); - extensions.push(vk::KhrMaintenance3Fn::name().as_ptr()); + let mut extensions = Vec::new(); + if surface.is_some() { + extensions.push(khr::Swapchain::name().as_ptr()); + } + if has_descriptor_indexing { + extensions.push(vk::KhrMaintenance3Fn::name().as_ptr()); + extensions.push(vk::ExtDescriptorIndexingFn::name().as_ptr()); + } let mut create_info = vk::DeviceCreateInfo::builder() .queue_create_infos(&queue_create_infos) .enabled_extension_names(&extensions);