From 8693194f15ed72b17ed90cecf31bf8a86ba7ef41 Mon Sep 17 00:00:00 2001 From: spencer-lunarg Date: Mon, 28 Oct 2024 13:53:27 -0400 Subject: [PATCH] layers: Add Extension Checks for Layer Extensions --- layers/stateless/sl_instance_device.cpp | 33 ++++++++++++++++++---- tests/framework/layer_validation_tests.cpp | 8 +++--- tests/framework/render.cpp | 1 + tests/unit/best_practices.cpp | 13 +++++---- tests/unit/instanceless.cpp | 15 ---------- tests/unit/layer_settings.cpp | 24 ++++++++++++++-- tests/unit/layer_settings_positive.cpp | 3 ++ tests/unit/portability_subset.cpp | 13 +++++---- 8 files changed, 71 insertions(+), 39 deletions(-) diff --git a/layers/stateless/sl_instance_device.cpp b/layers/stateless/sl_instance_device.cpp index 497afb5687a..f785cf7c722 100644 --- a/layers/stateless/sl_instance_device.cpp +++ b/layers/stateless/sl_instance_device.cpp @@ -185,18 +185,18 @@ bool StatelessValidation::manual_PreCallValidateCreateInstance(const VkInstanceC } } - const auto *debug_report_callback = vku::FindStructInPNextChain(pCreateInfo->pNext); - if (debug_report_callback && !local_instance_extensions.vk_ext_debug_report) { + if (!local_instance_extensions.vk_ext_debug_report && + vku::FindStructInPNextChain(pCreateInfo->pNext)) { skip |= LogError("VUID-VkInstanceCreateInfo-pNext-04925", instance, create_info_loc.dot(Field::ppEnabledExtensionNames), "does not include VK_EXT_debug_report, but the pNext chain includes VkDebugReportCallbackCreateInfoEXT."); } - const auto *debug_utils_messenger = vku::FindStructInPNextChain(pCreateInfo->pNext); - if (debug_utils_messenger && !local_instance_extensions.vk_ext_debug_utils) { + if (!local_instance_extensions.vk_ext_debug_utils && + vku::FindStructInPNextChain(pCreateInfo->pNext)) { skip |= LogError("VUID-VkInstanceCreateInfo-pNext-04926", instance, create_info_loc.dot(Field::ppEnabledExtensionNames), "does not include VK_EXT_debug_utils, but the pNext chain includes VkDebugUtilsMessengerCreateInfoEXT."); } - const auto *direct_driver_loading_list = vku::FindStructInPNextChain(pCreateInfo->pNext); - if (direct_driver_loading_list && !local_instance_extensions.vk_lunarg_direct_driver_loading) { + if (!local_instance_extensions.vk_lunarg_direct_driver_loading && + vku::FindStructInPNextChain(pCreateInfo->pNext)) { skip |= LogError( "VUID-VkInstanceCreateInfo-pNext-09400", instance, create_info_loc.dot(Field::ppEnabledExtensionNames), "does not include VK_LUNARG_direct_driver_loading, but the pNext chain includes VkDirectDriverLoadingListLUNARG."); @@ -218,6 +218,27 @@ bool StatelessValidation::manual_PreCallValidateCreateInstance(const VkInstanceC } #endif // VK_USE_PLATFORM_METAL_EXT + // These are extensions/structs implemented in the Validation Layers itself, in theory, the extension string is not needed, but + // good to have for completeness. + if (!local_instance_extensions.vk_ext_layer_settings && + vku::FindStructInPNextChain(pCreateInfo->pNext)) { + skip |= LogWarning("VUID-VkInstanceCreateInfo-pNext-10242", instance, create_info_loc.dot(Field::ppEnabledExtensionNames), + "does not include VK_EXT_layer_settings, but the pNext chain includes VkLayerSettingsCreateInfoEXT. " + "(Most layers, including Validation, will still work regardless of the extension included)"); + } + if (!local_instance_extensions.vk_ext_validation_features && + vku::FindStructInPNextChain(pCreateInfo->pNext)) { + skip |= LogWarning("VUID-VkInstanceCreateInfo-pNext-10243", instance, create_info_loc.dot(Field::ppEnabledExtensionNames), + "does not include VK_EXT_validation_features, but the pNext chain includes VkValidationFeaturesEXT. " + "(Most layers, including Validation, will still work regardless of the extension included)"); + } + if (!local_instance_extensions.vk_ext_validation_flags && + vku::FindStructInPNextChain(pCreateInfo->pNext)) { + skip |= LogWarning("VUID-VkInstanceCreateInfo-pNext-10244", instance, create_info_loc.dot(Field::ppEnabledExtensionNames), + "does not include VK_EXT_validation_flags, but the pNext chain includes VkValidationFlagsEXT. (Most " + "layers, including Validation, will still work regardless of the extension included)"); + } + return skip; } diff --git a/tests/framework/layer_validation_tests.cpp b/tests/framework/layer_validation_tests.cpp index 2be1f1b88eb..d85125c8d95 100644 --- a/tests/framework/layer_validation_tests.cpp +++ b/tests/framework/layer_validation_tests.cpp @@ -1,8 +1,8 @@ /* - * Copyright (c) 2015-2024 The Khronos Group Inc. - * Copyright (c) 2015-2024 Valve Corporation - * Copyright (c) 2015-2024 LunarG, Inc. - * Copyright (c) 2015-2023 Google, Inc. + * Copyright (c) 2015-2025 The Khronos Group Inc. + * Copyright (c) 2015-2025 Valve Corporation + * Copyright (c) 2015-2025 LunarG, Inc. + * Copyright (c) 2015-2025 Google, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/tests/framework/render.cpp b/tests/framework/render.cpp index a8ff3872bc5..c0ea1cc5dd6 100644 --- a/tests/framework/render.cpp +++ b/tests/framework/render.cpp @@ -95,6 +95,7 @@ bool VkRenderFramework::InstanceExtensionSupported(const char *const extension_n if (0 == strncmp(extension_name, VK_EXT_DEBUG_UTILS_EXTENSION_NAME, VK_MAX_EXTENSION_NAME_SIZE)) return true; if (0 == strncmp(extension_name, VK_EXT_DEBUG_REPORT_EXTENSION_NAME, VK_MAX_EXTENSION_NAME_SIZE)) return true; if (0 == strncmp(extension_name, VK_EXT_VALIDATION_FEATURES_EXTENSION_NAME, VK_MAX_EXTENSION_NAME_SIZE)) return true; + if (0 == strncmp(extension_name, VK_EXT_LAYER_SETTINGS_EXTENSION_NAME, VK_MAX_EXTENSION_NAME_SIZE)) return true; if (available_extensions_.empty()) { available_extensions_ = vkt::GetGlobalExtensions(); diff --git a/tests/unit/best_practices.cpp b/tests/unit/best_practices.cpp index c8b6b3f0cc4..15532a02302 100644 --- a/tests/unit/best_practices.cpp +++ b/tests/unit/best_practices.cpp @@ -1,8 +1,8 @@ /* - * Copyright (c) 2015-2024 The Khronos Group Inc. - * Copyright (c) 2015-2024 Valve Corporation - * Copyright (c) 2015-2024 LunarG, Inc. - * Copyright (c) 2015-2024 Google, Inc. + * Copyright (c) 2015-2025 The Khronos Group Inc. + * Copyright (c) 2015-2025 Valve Corporation + * Copyright (c) 2015-2025 LunarG, Inc. + * Copyright (c) 2015-2025 Google, Inc. * Modifications Copyright (C) 2020 Advanced Micro Devices, Inc. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -103,8 +103,9 @@ TEST_F(VkBestPracticesLayerTest, UseDeprecatedInstanceExtensions) { // Extra error if VK_EXT_debug_report is used on Android still m_errorMonitor->SetDesiredWarning("BestPractices-deprecated-extension"); } - m_errorMonitor->SetDesiredWarning("BestPractices-deprecated-extension"); - m_errorMonitor->SetDesiredWarning("BestPractices-specialuse-extension"); + m_errorMonitor->SetAllowedFailureMsg("VUID-VkInstanceCreateInfo-pNext-10243"); // VK_EXT_validation_features + m_errorMonitor->SetDesiredWarning("BestPractices-deprecated-extension"); // VK_KHR_get_physical_device_properties2, + m_errorMonitor->SetDesiredWarning("BestPractices-specialuse-extension"); // VK_EXT_debug_utils VkInstance dummy; auto features = features_; auto ici = GetInstanceCreateInfo(); diff --git a/tests/unit/instanceless.cpp b/tests/unit/instanceless.cpp index 7fb7cc9ff14..14eb35ed5ef 100644 --- a/tests/unit/instanceless.cpp +++ b/tests/unit/instanceless.cpp @@ -338,21 +338,6 @@ TEST_F(NegativeInstanceless, ExtensionStructsWithoutExtensions) { m_errorMonitor->SetDesiredError("VUID-VkInstanceCreateInfo-pNext-09400"); vk::CreateInstance(&ici, nullptr, &instance); m_errorMonitor->VerifyFound(); - - VkDebugUtilsMessengerCreateInfoEXT debug_utils_messenger = vku::InitStructHelper(); - debug_utils_messenger.pNext = m_errorMonitor->GetDebugCreateInfo(); - debug_utils_messenger.messageSeverity = VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT; - debug_utils_messenger.messageType = VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT; - debug_utils_messenger.pfnUserCallback = utils_callback; - ici.pNext = &debug_utils_messenger; - // Ignore the first extension which is VK_EXT_debug_utils - ici.enabledExtensionCount = size32(m_instance_extension_names) - 1; - if (ici.enabledExtensionCount > 0) { - ici.ppEnabledExtensionNames = &m_instance_extension_names[1]; - } - m_errorMonitor->SetDesiredError("VUID-VkInstanceCreateInfo-pNext-04926"); - vk::CreateInstance(&ici, nullptr, &instance); - m_errorMonitor->VerifyFound(); } #endif diff --git a/tests/unit/layer_settings.cpp b/tests/unit/layer_settings.cpp index 4d27dd28b9c..55bc3e3b4f9 100644 --- a/tests/unit/layer_settings.cpp +++ b/tests/unit/layer_settings.cpp @@ -18,6 +18,7 @@ class NegativeLayerSettings : public VkLayerTest {}; TEST_F(NegativeLayerSettings, CustomStypeStructString) { TEST_DESCRIPTION("Positive Test for ability to specify custom pNext structs using a list (string)"); + AddRequiredExtensions(VK_EXT_LAYER_SETTINGS_EXTENSION_NAME); // Create a custom structure typedef struct CustomStruct { @@ -67,6 +68,7 @@ static std::string format(const char *message, ...) { TEST_F(NegativeLayerSettings, CustomStypeStructStringArray) { TEST_DESCRIPTION("Positive Test for ability to specify custom pNext structs using a vector of strings"); + AddRequiredExtensions(VK_EXT_LAYER_SETTINGS_EXTENSION_NAME); // Create a custom structure typedef struct CustomStruct { @@ -115,6 +117,7 @@ TEST_F(NegativeLayerSettings, CustomStypeStructStringArray) { TEST_F(NegativeLayerSettings, CustomStypeStructIntegerArray) { TEST_DESCRIPTION("Positive Test for ability to specify custom pNext structs using a vector of integers"); + AddRequiredExtensions(VK_EXT_LAYER_SETTINGS_EXTENSION_NAME); // Create a custom structure typedef struct CustomStruct { @@ -161,6 +164,7 @@ TEST_F(NegativeLayerSettings, CustomStypeStructIntegerArray) { TEST_F(NegativeLayerSettings, DuplicateMessageLimit) { TEST_DESCRIPTION("Use the duplicate_message_limit setting and verify correct operation"); AddRequiredExtensions(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME); + AddRequiredExtensions(VK_EXT_LAYER_SETTINGS_EXTENSION_NAME); uint32_t value = 3; const VkLayerSettingEXT setting = {OBJECT_LAYER_NAME, "duplicate_message_limit", VK_LAYER_SETTING_TYPE_UINT32_EXT, 1, &value}; @@ -192,6 +196,7 @@ TEST_F(NegativeLayerSettings, DuplicateMessageLimit) { TEST_F(NegativeLayerSettings, DuplicateMessageLimitZero) { TEST_DESCRIPTION("Use the duplicate_message_limit setting with zero explicitly"); AddRequiredExtensions(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME); + AddRequiredExtensions(VK_EXT_LAYER_SETTINGS_EXTENSION_NAME); uint32_t value = 0; const VkLayerSettingEXT setting = {OBJECT_LAYER_NAME, "duplicate_message_limit", VK_LAYER_SETTING_TYPE_UINT32_EXT, 1, &value}; @@ -216,6 +221,7 @@ TEST_F(NegativeLayerSettings, DuplicateMessageLimitZero) { TEST_F(NegativeLayerSettings, DuplicateMessageLimitNone) { TEST_DESCRIPTION("Don't use duplicate_message_limit setting it with zero implicitly"); AddRequiredExtensions(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME); + AddRequiredExtensions(VK_EXT_LAYER_SETTINGS_EXTENSION_NAME); RETURN_IF_SKIP(Init()); // Create an invalid pNext structure to trigger the stateless validation warning @@ -237,6 +243,7 @@ TEST_F(NegativeLayerSettings, DuplicateMessageLimitNone) { TEST_F(NegativeLayerSettings, DuplicateMessageLimitDisable) { TEST_DESCRIPTION("use enable_message_limit explicitly"); AddRequiredExtensions(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME); + AddRequiredExtensions(VK_EXT_LAYER_SETTINGS_EXTENSION_NAME); VkBool32 enable_message_limit = VK_FALSE; uint32_t value = 3; @@ -264,7 +271,7 @@ TEST_F(NegativeLayerSettings, DuplicateMessageLimitDisable) { TEST_F(NegativeLayerSettings, VuidIdFilterString) { TEST_DESCRIPTION("Validate that message id string filtering is working"); - + AddRequiredExtensions(VK_EXT_LAYER_SETTINGS_EXTENSION_NAME); AddRequiredExtensions(VK_KHR_MAINTENANCE_2_EXTENSION_NAME); // This test would normally produce an unexpected error or two. Use the message filter instead of // the error_monitor's SetUnexpectedError to test the filtering. @@ -297,7 +304,7 @@ TEST_F(NegativeLayerSettings, VuidIdFilterString) { TEST_F(NegativeLayerSettings, VuidFilterHexInt) { TEST_DESCRIPTION("Validate that message id hex int filtering is working"); - + AddRequiredExtensions(VK_EXT_LAYER_SETTINGS_EXTENSION_NAME); AddRequiredExtensions(VK_KHR_MAINTENANCE_2_EXTENSION_NAME); // This test would normally produce an unexpected error or two. Use the message filter instead of // the error_monitor's SetUnexpectedError to test the filtering. @@ -330,7 +337,7 @@ TEST_F(NegativeLayerSettings, VuidFilterHexInt) { TEST_F(NegativeLayerSettings, VuidFilterInt) { TEST_DESCRIPTION("Validate that message id decimal int filtering is working"); - + AddRequiredExtensions(VK_EXT_LAYER_SETTINGS_EXTENSION_NAME); AddRequiredExtensions(VK_KHR_MAINTENANCE_2_EXTENSION_NAME); // This test would normally produce an unexpected error or two. Use the message filter instead of // the error_monitor's SetUnexpectedError to test the filtering. @@ -361,6 +368,7 @@ TEST_F(NegativeLayerSettings, VuidFilterInt) { } TEST_F(NegativeLayerSettings, DebugAction) { + AddRequiredExtensions(VK_EXT_LAYER_SETTINGS_EXTENSION_NAME); const char *action = "VK_DBG_LAYER_ACTION_NOT_A_REAL_THING"; const VkLayerSettingEXT setting = {OBJECT_LAYER_NAME, "debug_action", VK_LAYER_SETTING_TYPE_STRING_EXT, 1, &action}; VkLayerSettingsCreateInfoEXT create_info = {VK_STRUCTURE_TYPE_LAYER_SETTINGS_CREATE_INFO_EXT, nullptr, 1, &setting}; @@ -371,6 +379,7 @@ TEST_F(NegativeLayerSettings, DebugAction) { } TEST_F(NegativeLayerSettings, DebugAction2) { + AddRequiredExtensions(VK_EXT_LAYER_SETTINGS_EXTENSION_NAME); const char *actions[2] = {"VK_DBG_LAYER_ACTION_IGNORE,VK_DBG_LAYER_ACTION_CALLBACK"}; const VkLayerSettingEXT setting = {OBJECT_LAYER_NAME, "debug_action", VK_LAYER_SETTING_TYPE_STRING_EXT, 1, actions}; VkLayerSettingsCreateInfoEXT create_info = {VK_STRUCTURE_TYPE_LAYER_SETTINGS_CREATE_INFO_EXT, nullptr, 1, &setting}; @@ -381,6 +390,7 @@ TEST_F(NegativeLayerSettings, DebugAction2) { } TEST_F(NegativeLayerSettings, DebugAction3) { + AddRequiredExtensions(VK_EXT_LAYER_SETTINGS_EXTENSION_NAME); const char *actions[2] = {"VK_DBG_LAYER_ACTION_DEFAULT", "VK_DBG_LAYER_ACTION_NOT_A_REAL_THING"}; const VkLayerSettingEXT setting = {OBJECT_LAYER_NAME, "debug_action", VK_LAYER_SETTING_TYPE_STRING_EXT, 2, actions}; VkLayerSettingsCreateInfoEXT create_info = {VK_STRUCTURE_TYPE_LAYER_SETTINGS_CREATE_INFO_EXT, nullptr, 1, &setting}; @@ -391,6 +401,7 @@ TEST_F(NegativeLayerSettings, DebugAction3) { } TEST_F(NegativeLayerSettings, ReportFlags) { + AddRequiredExtensions(VK_EXT_LAYER_SETTINGS_EXTENSION_NAME); const char *report_flag = "fake"; const VkLayerSettingEXT setting = {OBJECT_LAYER_NAME, "report_flags", VK_LAYER_SETTING_TYPE_STRING_EXT, 1, &report_flag}; VkLayerSettingsCreateInfoEXT create_info = {VK_STRUCTURE_TYPE_LAYER_SETTINGS_CREATE_INFO_EXT, nullptr, 1, &setting}; @@ -401,6 +412,7 @@ TEST_F(NegativeLayerSettings, ReportFlags) { } TEST_F(NegativeLayerSettings, ReportFlags2) { + AddRequiredExtensions(VK_EXT_LAYER_SETTINGS_EXTENSION_NAME); const char *report_flag = "warn,fake,info"; const VkLayerSettingEXT setting = {OBJECT_LAYER_NAME, "report_flags", VK_LAYER_SETTING_TYPE_STRING_EXT, 1, &report_flag}; VkLayerSettingsCreateInfoEXT create_info = {VK_STRUCTURE_TYPE_LAYER_SETTINGS_CREATE_INFO_EXT, nullptr, 1, &setting}; @@ -411,6 +423,7 @@ TEST_F(NegativeLayerSettings, ReportFlags2) { } TEST_F(NegativeLayerSettings, ReportFlags3) { + AddRequiredExtensions(VK_EXT_LAYER_SETTINGS_EXTENSION_NAME); const char *report_flag = "error,warn,info,verbose"; const VkLayerSettingEXT setting = {OBJECT_LAYER_NAME, "report_flags", VK_LAYER_SETTING_TYPE_STRING_EXT, 1, &report_flag}; VkLayerSettingsCreateInfoEXT create_info = {VK_STRUCTURE_TYPE_LAYER_SETTINGS_CREATE_INFO_EXT, nullptr, 1, &setting}; @@ -422,6 +435,7 @@ TEST_F(NegativeLayerSettings, ReportFlags3) { #ifndef WIN32 TEST_F(NegativeLayerSettings, LogFilename) { + AddRequiredExtensions(VK_EXT_LAYER_SETTINGS_EXTENSION_NAME); const char *path[] = {"/fake/path"}; const VkLayerSettingEXT setting = {OBJECT_LAYER_NAME, "log_filename", VK_LAYER_SETTING_TYPE_STRING_EXT, 1, path}; VkLayerSettingsCreateInfoEXT create_info = {VK_STRUCTURE_TYPE_LAYER_SETTINGS_CREATE_INFO_EXT, nullptr, 1, &setting}; @@ -433,6 +447,7 @@ TEST_F(NegativeLayerSettings, LogFilename) { #endif TEST_F(NegativeLayerSettings, NotRealSetting) { + AddRequiredExtensions(VK_EXT_LAYER_SETTINGS_EXTENSION_NAME); int32_t enable = 1; const VkLayerSettingEXT setting = {OBJECT_LAYER_NAME, "not_a_real_setting", VK_LAYER_SETTING_TYPE_INT32_EXT, 1, &enable}; VkLayerSettingsCreateInfoEXT create_info = {VK_STRUCTURE_TYPE_LAYER_SETTINGS_CREATE_INFO_EXT, nullptr, 1, &setting}; @@ -445,6 +460,7 @@ TEST_F(NegativeLayerSettings, NotRealSetting) { } TEST_F(NegativeLayerSettings, WrongSettingType) { + AddRequiredExtensions(VK_EXT_LAYER_SETTINGS_EXTENSION_NAME); // Actually needs a VK_LAYER_SETTING_TYPE_BOOL32_EXT int32_t enable = 1; const VkLayerSettingEXT setting = {OBJECT_LAYER_NAME, "enable_message_limit", VK_LAYER_SETTING_TYPE_UINT32_EXT, 1, &enable}; @@ -459,6 +475,7 @@ TEST_F(NegativeLayerSettings, WrongSettingType) { } TEST_F(NegativeLayerSettings, WrongSettingType2) { + AddRequiredExtensions(VK_EXT_LAYER_SETTINGS_EXTENSION_NAME); // Actually needs a VK_LAYER_SETTING_TYPE_BOOL32_EXT int32_t enable = 1; const VkLayerSettingEXT setting = {OBJECT_LAYER_NAME, "thread_safety", VK_LAYER_SETTING_TYPE_UINT32_EXT, 1, &enable}; @@ -473,6 +490,7 @@ TEST_F(NegativeLayerSettings, WrongSettingType2) { } TEST_F(NegativeLayerSettings, DuplicateSettings) { + AddRequiredExtensions(VK_EXT_LAYER_SETTINGS_EXTENSION_NAME); VkBool32 enable = VK_TRUE; VkBool32 disable = VK_FALSE; const VkLayerSettingEXT settings[2] = { diff --git a/tests/unit/layer_settings_positive.cpp b/tests/unit/layer_settings_positive.cpp index 88091130204..d39c30ea590 100644 --- a/tests/unit/layer_settings_positive.cpp +++ b/tests/unit/layer_settings_positive.cpp @@ -19,6 +19,7 @@ class PositiveLayerSettings : public VkLayerTest {}; // When adding a new setting, add here to make sure it is tested // (internal debug settings and deprecated are excluded from here) TEST_F(PositiveLayerSettings, AllSettings) { + AddRequiredExtensions(VK_EXT_LAYER_SETTINGS_EXTENSION_NAME); const char* some_string = "placeholder"; const char* action_ignore = "VK_DBG_LAYER_ACTION_IGNORE"; const char* warning = "warn"; @@ -89,6 +90,7 @@ TEST_F(PositiveLayerSettings, AllSettings) { } TEST_F(PositiveLayerSettings, ReportFlags) { + AddRequiredExtensions(VK_EXT_LAYER_SETTINGS_EXTENSION_NAME); const char* report_flags[3] = {"error", "warn", "info"}; const VkLayerSettingEXT setting = {OBJECT_LAYER_NAME, "report_flags", VK_LAYER_SETTING_TYPE_STRING_EXT, 3, report_flags}; VkLayerSettingsCreateInfoEXT create_info = {VK_STRUCTURE_TYPE_LAYER_SETTINGS_CREATE_INFO_EXT, nullptr, 1, &setting}; @@ -99,6 +101,7 @@ TEST_F(PositiveLayerSettings, ReportFlags) { } TEST_F(PositiveLayerSettings, DebugAction) { + AddRequiredExtensions(VK_EXT_LAYER_SETTINGS_EXTENSION_NAME); const char* actions[2] = {"VK_DBG_LAYER_ACTION_CALLBACK", "VK_DBG_LAYER_ACTION_DEFAULT"}; const VkLayerSettingEXT setting = {OBJECT_LAYER_NAME, "debug_action", VK_LAYER_SETTING_TYPE_STRING_EXT, 2, actions}; VkLayerSettingsCreateInfoEXT create_info = {VK_STRUCTURE_TYPE_LAYER_SETTINGS_CREATE_INFO_EXT, nullptr, 1, &setting}; diff --git a/tests/unit/portability_subset.cpp b/tests/unit/portability_subset.cpp index bd0755b590f..2432c795ad3 100644 --- a/tests/unit/portability_subset.cpp +++ b/tests/unit/portability_subset.cpp @@ -608,10 +608,17 @@ TEST_F(VkPortabilitySubsetTest, PortabilitySubsetColorBlendFactor) { TEST_F(VkPortabilitySubsetTest, InstanceCreateEnumerate) { TEST_DESCRIPTION("Validate creating instances with VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR."); + std::vector enabled_extensions = {VK_EXT_DEBUG_UTILS_EXTENSION_NAME, + VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME}; + +#ifdef VK_USE_PLATFORM_ANDROID_KHR + GTEST_SKIP() << "Android doesn't support Debug Utils"; +#endif auto ici = GetInstanceCreateInfo(); ici.flags = VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR; ici.enabledExtensionCount = 1; + ici.ppEnabledExtensionNames = enabled_extensions.data(); VkInstance local_instance; @@ -620,11 +627,7 @@ TEST_F(VkPortabilitySubsetTest, InstanceCreateEnumerate) { m_errorMonitor->VerifyFound(); if (InstanceExtensionSupported(VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME)) { - std::vector enabled_extensions = {VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME, - VK_EXT_DEBUG_UTILS_EXTENSION_NAME}; - ici.enabledExtensionCount = static_cast(enabled_extensions.size()); - ici.ppEnabledExtensionNames = enabled_extensions.data(); - + ici.enabledExtensionCount = 2; ASSERT_EQ(VK_SUCCESS, vk::CreateInstance(&ici, nullptr, &local_instance)); vk::DestroyInstance(local_instance, nullptr); }