From 5f3ce24e7a530d089842c8192c2565a672555250 Mon Sep 17 00:00:00 2001 From: Charles Giessen Date: Mon, 11 Apr 2022 14:39:06 -0600 Subject: cube,vulkaninfo: Add portability_enumeration if present Make vulkaninfo and vkcube/vkcubepp enable the portability enumeration bit if it is available. --- cube/cube.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'cube/cube.cpp') diff --git a/cube/cube.cpp b/cube/cube.cpp index fdba5578..03fd65b4 100644 --- a/cube/cube.cpp +++ b/cube/cube.cpp @@ -1116,6 +1116,7 @@ void Demo::init_vk() { /* Look for instance extensions */ vk::Bool32 surfaceExtFound = VK_FALSE; vk::Bool32 platformSurfaceExtFound = VK_FALSE; + bool portabilityEnumerationActive = false; auto instance_extensions_return = vk::enumerateInstanceExtensionProperties(); VERIFY(instance_extensions_return.result == vk::Result::eSuccess); @@ -1126,6 +1127,11 @@ void Demo::init_vk() { } else if (!strcmp(VK_EXT_DEBUG_UTILS_EXTENSION_NAME, extension.extensionName)) { use_debug_messenger = true; enabled_instance_extensions.push_back(VK_EXT_DEBUG_UTILS_EXTENSION_NAME); + } else if (!strcmp(VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME, extension.extensionName)) { + // We want cube to be able to enumerate drivers that support the portability_subset extension, so we have to enable the + // portability enumeration extension. + portabilityEnumerationActive = true; + enabled_instance_extensions.push_back(VK_EXT_DEBUG_UTILS_EXTENSION_NAME); } else if (!strcmp(VK_KHR_SURFACE_EXTENSION_NAME, extension.extensionName)) { surfaceExtFound = 1; enabled_instance_extensions.push_back(VK_KHR_SURFACE_EXTENSION_NAME); @@ -1237,6 +1243,8 @@ void Demo::init_vk() { .setPEngineName(APP_SHORT_NAME) .setEngineVersion(0); auto const inst_info = vk::InstanceCreateInfo() + .setFlags(portabilityEnumerationActive ? vk::InstanceCreateFlagBits::eEnumeratePortabilityKHR + : static_cast(0)) .setPNext((use_debug_messenger && validate) ? &debug_utils_create_info : nullptr) .setPApplicationInfo(&app) .setPEnabledLayerNames(enabled_layers) -- cgit v1.2.3