aboutsummaryrefslogtreecommitdiff
path: root/cube/cube.cpp
diff options
context:
space:
mode:
authorCharles Giessen <charles@lunarg.com>2022-04-11 14:39:06 -0600
committerCharles Giessen <46324611+charles-lunarg@users.noreply.github.com>2022-04-11 16:33:45 -0600
commit5f3ce24e7a530d089842c8192c2565a672555250 (patch)
tree102273e2a41f9fab0a7c09f38505ca44fbc2b3b7 /cube/cube.cpp
parent3903162ac4b01ed376bfa55a72ef7217a72c0b74 (diff)
downloadusermoji-5f3ce24e7a530d089842c8192c2565a672555250.tar.xz
cube,vulkaninfo: Add portability_enumeration if present
Make vulkaninfo and vkcube/vkcubepp enable the portability enumeration bit if it is available.
Diffstat (limited to 'cube/cube.cpp')
-rw-r--r--cube/cube.cpp8
1 files changed, 8 insertions, 0 deletions
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<vk::InstanceCreateFlagBits>(0))
.setPNext((use_debug_messenger && validate) ? &debug_utils_create_info : nullptr)
.setPApplicationInfo(&app)
.setPEnabledLayerNames(enabled_layers)