Vulkan: Allow no validation layers in ExternalImageTest.

Similarly to common test init, these specific tests init the Vulkan
resources with validation layers when they might not be available.
Fix this by checking for the appropriate define.

Bug: b/168744561
Change-Id: I93dd3bac839297ced07cb2c4cbbcf64db2e65a1f
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2419041
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
This commit is contained in:
Jamie Madill 2020-09-19 09:58:23 -04:00 коммит произвёл Commit Bot
Родитель f6f206018c
Коммит 93f58c15ec
1 изменённых файлов: 7 добавлений и 2 удалений

Просмотреть файл

@ -181,9 +181,14 @@ VulkanExternalHelper::~VulkanExternalHelper()
void VulkanExternalHelper::initialize(bool useSwiftshader, bool enableValidationLayers) void VulkanExternalHelper::initialize(bool useSwiftshader, bool enableValidationLayers)
{ {
bool enableValidationLayersOverride = enableValidationLayers;
#if !defined(ANGLE_ENABLE_VULKAN_VALIDATION_LAYERS)
enableValidationLayersOverride = false;
#endif
vk::ICD icd = useSwiftshader ? vk::ICD::SwiftShader : vk::ICD::Default; vk::ICD icd = useSwiftshader ? vk::ICD::SwiftShader : vk::ICD::Default;
vk::ScopedVkLoaderEnvironment scopedEnvironment(enableValidationLayers, icd); vk::ScopedVkLoaderEnvironment scopedEnvironment(enableValidationLayersOverride, icd);
ASSERT(mInstance == VK_NULL_HANDLE); ASSERT(mInstance == VK_NULL_HANDLE);
VkResult result = VK_SUCCESS; VkResult result = VK_SUCCESS;
@ -223,7 +228,7 @@ void VulkanExternalHelper::initialize(bool useSwiftshader, bool enableValidation
static_cast<uint32_t>(enabledInstanceExtensions.size()); static_cast<uint32_t>(enabledInstanceExtensions.size());
std::vector<const char *> enabledLayerNames; std::vector<const char *> enabledLayerNames;
if (enableValidationLayers) if (enableValidationLayersOverride)
{ {
enabledLayerNames.push_back("VK_LAYER_KHRONOS_validation"); enabledLayerNames.push_back("VK_LAYER_KHRONOS_validation");
} }