blob: 9de568fe38e9da4963a77fa2f699e74c8b035592 [file] [log] [blame]
// Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
//
//
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
//
//
//
#include "common/macros.h"
#include "common/vk/assert.h"
#include "find_validation_layer.h"
//
//
//
const char *
vk_find_validation_layer()
{
uint32_t layer_count;
vk(EnumerateInstanceLayerProperties(&layer_count, NULL));
VkLayerProperties * layer_properties = malloc(layer_count * sizeof(VkLayerProperties));
vk(EnumerateInstanceLayerProperties(&layer_count, layer_properties));
bool found_khr_validation = false;
bool found_lunarg_validation = false;
for (uint32_t i = 0; i < layer_count; i++)
{
found_khr_validation = found_khr_validation || (strcmp(layer_properties[i].layerName,
"VK_LAYER_KHRONOS_validation") == 0);
found_lunarg_validation =
found_lunarg_validation ||
(strcmp(layer_properties[i].layerName, "VK_LAYER_LUNARG_standard_validation") == 0);
}
free(layer_properties);
return found_khr_validation
? "VK_LAYER_KHRONOS_validation"
: found_lunarg_validation ? "VK_LAYER_LUNARG_standard_validation" : NULL;
}
//
//
//