forked from erickpiva/VulkanRenderer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathValidationLayer.h
44 lines (36 loc) · 850 Bytes
/
ValidationLayer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#pragma once
#include <vector>
#include <cstring>
#include <vulkan/vulkan_core.h>
const std::vector<const char*> ValidationLayers = {
"VK_LAYER_KHRONOS_validation"
};
#ifdef NDEBUG
const bool bEnableValidationLayers = false;
#else
const bool bEnableValidationLayers = true;
#endif
bool CheckValidationLayerSupport()
{
uint32_t LayerCount;
vkEnumerateInstanceLayerProperties(&LayerCount, nullptr);
std::vector<VkLayerProperties> AvailableLayers(LayerCount);
vkEnumerateInstanceLayerProperties(&LayerCount, AvailableLayers.data());
for (const char* LayerName : ValidationLayers)
{
bool bLayerFound = false;
for (const auto& LayerProperties : AvailableLayers)
{
if (strcmp(LayerName, LayerProperties.layerName) == 0)
{
bLayerFound = true;
break;
}
}
if (!bLayerFound)
{
return false;
}
}
return true;
}