Commit c597a8af by Nicolas Capens Committed by Nicolas Capens

Fix pedantic Clang warning/error

Move the addLayerIfAvailable() anonymous function to the condition where it's actually used. Otherwise we get "error: unused variable 'addLayerIfAvailable' [-Werror,-Wunused-variable]" Bug: b/185779640 Change-Id: I2aaa0656bfcb0c1c0aa14c44837cf1b46ea02f54 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/53988 Presubmit-Ready: Nicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Kokoro-Result: kokoro <noreply+kokoro@google.com> Tested-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent 8f8c9b55
...@@ -274,6 +274,8 @@ void VulkanTester::initialize() ...@@ -274,6 +274,8 @@ void VulkanTester::initialize()
extensionNames.push_back(VK_EXT_DEBUG_UTILS_EXTENSION_NAME); extensionNames.push_back(VK_EXT_DEBUG_UTILS_EXTENSION_NAME);
#endif #endif
std::vector<const char *> layerNames;
#if ENABLE_VALIDATION_LAYERS
auto addLayerIfAvailable = [](std::vector<const char *> &layers, const char *layer) { auto addLayerIfAvailable = [](std::vector<const char *> &layers, const char *layer) {
static auto layerProperties = vk::enumerateInstanceLayerProperties(); static auto layerProperties = vk::enumerateInstanceLayerProperties();
if(std::find_if(layerProperties.begin(), layerProperties.end(), [layer](auto &lp) { if(std::find_if(layerProperties.begin(), layerProperties.end(), [layer](auto &lp) {
...@@ -285,8 +287,6 @@ void VulkanTester::initialize() ...@@ -285,8 +287,6 @@ void VulkanTester::initialize()
} }
}; };
std::vector<const char *> layerNames;
#if ENABLE_VALIDATION_LAYERS
addLayerIfAvailable(layerNames, "VK_LAYER_KHRONOS_validation"); addLayerIfAvailable(layerNames, "VK_LAYER_KHRONOS_validation");
addLayerIfAvailable(layerNames, "VK_LAYER_LUNARG_standard_validation"); addLayerIfAvailable(layerNames, "VK_LAYER_LUNARG_standard_validation");
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment