From 93f58c15ec4f356957f7fa8756fd69c9dfa128b4 Mon Sep 17 00:00:00 2001 From: Jamie Madill Date: Sat, 19 Sep 2020 09:58:23 -0400 Subject: [PATCH] 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 Commit-Queue: Jamie Madill --- src/tests/test_utils/VulkanExternalHelper.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/tests/test_utils/VulkanExternalHelper.cpp b/src/tests/test_utils/VulkanExternalHelper.cpp index 1ceed493c..d6e857ee8 100644 --- a/src/tests/test_utils/VulkanExternalHelper.cpp +++ b/src/tests/test_utils/VulkanExternalHelper.cpp @@ -181,9 +181,14 @@ VulkanExternalHelper::~VulkanExternalHelper() 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::ScopedVkLoaderEnvironment scopedEnvironment(enableValidationLayers, icd); + vk::ScopedVkLoaderEnvironment scopedEnvironment(enableValidationLayersOverride, icd); ASSERT(mInstance == VK_NULL_HANDLE); VkResult result = VK_SUCCESS; @@ -223,7 +228,7 @@ void VulkanExternalHelper::initialize(bool useSwiftshader, bool enableValidation static_cast(enabledInstanceExtensions.size()); std::vector enabledLayerNames; - if (enableValidationLayers) + if (enableValidationLayersOverride) { enabledLayerNames.push_back("VK_LAYER_KHRONOS_validation"); }