Skip to content

Commit

Permalink
layers: Add Extension Checks for Layer Extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
spencer-lunarg committed Jan 14, 2025
1 parent 9037216 commit 8693194
Show file tree
Hide file tree
Showing 8 changed files with 71 additions and 39 deletions.
33 changes: 27 additions & 6 deletions layers/stateless/sl_instance_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,18 +185,18 @@ bool StatelessValidation::manual_PreCallValidateCreateInstance(const VkInstanceC
}
}

const auto *debug_report_callback = vku::FindStructInPNextChain<VkDebugReportCallbackCreateInfoEXT>(pCreateInfo->pNext);
if (debug_report_callback && !local_instance_extensions.vk_ext_debug_report) {
if (!local_instance_extensions.vk_ext_debug_report &&
vku::FindStructInPNextChain<VkDebugReportCallbackCreateInfoEXT>(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<VkDebugUtilsMessengerCreateInfoEXT>(pCreateInfo->pNext);
if (debug_utils_messenger && !local_instance_extensions.vk_ext_debug_utils) {
if (!local_instance_extensions.vk_ext_debug_utils &&
vku::FindStructInPNextChain<VkDebugUtilsMessengerCreateInfoEXT>(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<VkDirectDriverLoadingListLUNARG>(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<VkDirectDriverLoadingListLUNARG>(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.");
Expand All @@ -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<VkLayerSettingsCreateInfoEXT>(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<VkValidationFeaturesEXT>(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<VkValidationFlagsEXT>(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;
}

Expand Down
8 changes: 4 additions & 4 deletions tests/framework/layer_validation_tests.cpp
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
1 change: 1 addition & 0 deletions tests/framework/render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
13 changes: 7 additions & 6 deletions tests/unit/best_practices.cpp
Original file line number Diff line number Diff line change
@@ -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");
Expand Down Expand Up @@ -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();
Expand Down
15 changes: 0 additions & 15 deletions tests/unit/instanceless.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
24 changes: 21 additions & 3 deletions tests/unit/layer_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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};
Expand Down Expand Up @@ -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};
Expand All @@ -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
Expand All @@ -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;
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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};
Expand All @@ -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};
Expand All @@ -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};
Expand All @@ -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};
Expand All @@ -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};
Expand All @@ -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};
Expand All @@ -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};
Expand All @@ -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};
Expand All @@ -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};
Expand All @@ -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};
Expand All @@ -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] = {
Expand Down
3 changes: 3 additions & 0 deletions tests/unit/layer_settings_positive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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};
Expand All @@ -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};
Expand Down
13 changes: 8 additions & 5 deletions tests/unit/portability_subset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<const char *> 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;

Expand All @@ -620,11 +627,7 @@ TEST_F(VkPortabilitySubsetTest, InstanceCreateEnumerate) {
m_errorMonitor->VerifyFound();

if (InstanceExtensionSupported(VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME)) {
std::vector<const char *> enabled_extensions = {VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME,
VK_EXT_DEBUG_UTILS_EXTENSION_NAME};
ici.enabledExtensionCount = static_cast<uint32_t>(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);
}
Expand Down

0 comments on commit 8693194

Please sign in to comment.