From 69764a869d99e9abd0fbe10c2773d3556d7f35e8 Mon Sep 17 00:00:00 2001 From: Nicolas James Date: Tue, 7 Apr 2026 19:17:08 +1000 Subject: Check for Vulkan 1.1 via not null GetPhysicalDeviceQueueFamilyProperties2KHR --- src/physical_device_context.cc | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/physical_device_context.cc b/src/physical_device_context.cc index 7a57759..78d3d9c 100644 --- a/src/physical_device_context.cc +++ b/src/physical_device_context.cc @@ -22,17 +22,24 @@ PhysicalDeviceContext::PhysicalDeviceContext( return std::make_unique(std::move(props)); }(); + // Check if we support Vulkan 1.1 by checking if this function exists. If we + // don't, the layer cannot work, so we set 'supports required extensions' to + // false and bail. + if (!vtable.GetPhysicalDeviceQueueFamilyProperties2KHR) { + this->supports_required_extensions = false; + return; + } + this->queue_properties = [&]() { auto count = std::uint32_t{}; - vtable.GetPhysicalDeviceQueueFamilyProperties2KHR(physical_device, &count, - nullptr); + vtable.GetPhysicalDeviceQueueFamilyProperties2KHR(physical_device, + &count, nullptr); auto result = std::vector( count, VkQueueFamilyProperties2{ .sType = VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2}); - vtable.GetPhysicalDeviceQueueFamilyProperties2KHR(physical_device, &count, - std::data(result)); - + vtable.GetPhysicalDeviceQueueFamilyProperties2KHR( + physical_device, &count, std::data(result)); return std::make_unique>( std::move(result)); }(); -- cgit v1.2.3