// Check the VkInstanceCreateInfoFlags wether to allow the portability enumeration flag
if ((pCreateInfo->flags & VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR) == 1) {
- // Make sure the extension has been enabled
+ ptr_instance->portability_enumeration_flag_bit_set = true;
+ }
+ // Make sure the extension has been enabled
+ if (pCreateInfo->ppEnabledExtensionNames) {
for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) {
if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME) == 0) {
- ptr_instance->portability_enumeration_enabled = true;
- loader_log(ptr_instance, VULKAN_LOADER_INFO_BIT, 0,
- "Portability enumeration bit was set, enumerating portability drivers.");
+ ptr_instance->portability_enumeration_extension_enabled = true;
+ if (ptr_instance->portability_enumeration_flag_bit_set) {
+ ptr_instance->portability_enumeration_enabled = true;
+ loader_log(ptr_instance, VULKAN_LOADER_INFO_BIT, 0,
+ "Portability enumeration bit was set, enumerating portability drivers.");
+ }
}
}
}
if (ptr_instance->icd_tramp_list.count == 0) {
// No drivers found
if (skipped_portability_drivers) {
- loader_log(
- ptr_instance, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_DRIVER_BIT, 0,
- "vkCreateInstance: Found drivers that contain devices which support the portability subset, but the "
- "portability enumeration bit was not set! Applications that wish to enumerate portability drivers must set the "
- "VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR bit in the VkInstanceCreateInfo flags and "
- "enable the VK_KHR_portability_enumeration instance extension.");
+ if (ptr_instance->portability_enumeration_extension_enabled && !ptr_instance->portability_enumeration_flag_bit_set) {
+ loader_log(ptr_instance, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_DRIVER_BIT, 0,
+ "vkCreateInstance: Found drivers that contain devices which support the portability subset, but "
+ "the instance does not enumerate portability drivers! Applications that wish to enumerate portability "
+ "drivers must set the VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR bit in the VkInstanceCreateInfo "
+ "flags.");
+ } else if (ptr_instance->portability_enumeration_flag_bit_set &&
+ !ptr_instance->portability_enumeration_extension_enabled) {
+ loader_log(ptr_instance, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_DRIVER_BIT, 0,
+ "VkInstanceCreateInfo: If flags has the VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR bit set, the "
+ "list of enabled extensions in ppEnabledExtensionNames must contain VK_KHR_portability_enumeration "
+ "[VUID-VkInstanceCreateInfo-flags-06559 ]"
+ "Applications that wish to enumerate portability drivers must enable the VK_KHR_portability_enumeration "
+ "instance extension.");
+ } else {
+ loader_log(ptr_instance, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_DRIVER_BIT, 0,
+ "vkCreateInstance: Found drivers that contain devices which support the portability subset, but "
+ "the instance does not enumerate portability drivers! Applications that wish to enumerate portability "
+ "drivers must set the VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR bit in the VkInstanceCreateInfo "
+ "flags and enable the VK_KHR_portability_enumeration instance extension.");
+ }
}
loader_log(ptr_instance, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_DRIVER_BIT, 0, "vkCreateInstance: Found no drivers!");
res = VK_ERROR_INCOMPATIBLE_DRIVER;
#endif // __linux__ || __FreeBSD__ || __OpenBSD__ || __GNU__
const char* portability_driver_warning =
- "vkCreateInstance: Found drivers that contain devices which support the portability subset, but the "
- "portability enumeration bit was not set! Applications that wish to enumerate portability drivers must set the "
- "VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR bit in the VkInstanceCreateInfo flags and "
- "enable the VK_KHR_portability_enumeration instance extension.";
+ "vkCreateInstance: Found drivers that contain devices which support the portability subset, but "
+ "the instance does not enumerate portability drivers! Applications that wish to enumerate portability "
+ "drivers must set the VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR bit in the VkInstanceCreateInfo "
+ "flags and enable the VK_KHR_portability_enumeration instance extension.";
+
+const char* portability_flag_missing =
+ "vkCreateInstance: Found drivers that contain devices which support the portability subset, but "
+ "the instance does not enumerate portability drivers! Applications that wish to enumerate portability "
+ "drivers must set the VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR bit in the VkInstanceCreateInfo "
+ "flags.";
+
+const char* portability_extension_missing =
+ "VkInstanceCreateInfo: If flags has the VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR bit set, the "
+ "list of enabled extensions in ppEnabledExtensionNames must contain VK_KHR_portability_enumeration "
+ "[VUID-VkInstanceCreateInfo-flags-06559 ]"
+ "Applications that wish to enumerate portability drivers must enable the VK_KHR_portability_enumeration "
+ "instance extension.";
TEST(PortabilityICDConfiguration, PortabilityICDOnly) {
FrameworkEnvironment env{};
DeviceWrapper dev_info{inst};
dev_info.CheckCreate(phys_dev);
ASSERT_FALSE(log.find(portability_driver_warning));
+ ASSERT_FALSE(log.find(portability_flag_missing));
+ ASSERT_FALSE(log.find(portability_extension_missing));
}
{ // enable portability flag but not extension - shouldn't be able to create an instance when filtering is enabled
InstWrapper inst{env.vulkan_functions};
inst.create_info.add_extension(VK_EXT_DEBUG_UTILS_EXTENSION_NAME);
FillDebugUtilsCreateDetails(inst.create_info, env.debug_log);
inst.CheckCreate(VK_ERROR_INCOMPATIBLE_DRIVER);
- ASSERT_TRUE(env.debug_log.find(portability_driver_warning));
+ ASSERT_TRUE(env.debug_log.find(portability_extension_missing));
}
{ // enable portability extension but not flag - shouldn't be able to create an instance when filtering is enabled
InstWrapper inst{env.vulkan_functions};
inst.create_info.add_extension(VK_EXT_DEBUG_UTILS_EXTENSION_NAME);
FillDebugUtilsCreateDetails(inst.create_info, env.debug_log);
inst.CheckCreate(VK_ERROR_INCOMPATIBLE_DRIVER);
- ASSERT_TRUE(env.debug_log.find(portability_driver_warning));
+ ASSERT_TRUE(env.debug_log.find(portability_flag_missing));
}
{ // enable neither the portability extension or the flag - shouldn't be able to create an instance when filtering is enabled
InstWrapper inst{env.vulkan_functions};