1 | #include "vulkan-utils-new.hpp"
|
---|
2 |
|
---|
3 | bool VulkanUtilsNew::checkValidationLayerSupport(const vector<const char*>& validationLayers) {
|
---|
4 | uint32_t layerCount;
|
---|
5 | vkEnumerateInstanceLayerProperties(&layerCount, nullptr);
|
---|
6 |
|
---|
7 | vector<VkLayerProperties> availableLayers(layerCount);
|
---|
8 | vkEnumerateInstanceLayerProperties(&layerCount, availableLayers.data());
|
---|
9 |
|
---|
10 | for (const char* layerName : validationLayers) {
|
---|
11 | bool layerFound = false;
|
---|
12 |
|
---|
13 | for (const auto& layerProperties : availableLayers) {
|
---|
14 | if (strcmp(layerName, layerProperties.layerName) == 0) {
|
---|
15 | layerFound = true;
|
---|
16 | break;
|
---|
17 | }
|
---|
18 | }
|
---|
19 |
|
---|
20 | if (!layerFound) {
|
---|
21 | return false;
|
---|
22 | }
|
---|
23 | }
|
---|
24 |
|
---|
25 | return true;
|
---|
26 | }
|
---|
27 |
|
---|
28 | VkResult VulkanUtilsNew::createDebugUtilsMessengerEXT(VkInstance instance,
|
---|
29 | const VkDebugUtilsMessengerCreateInfoEXT* pCreateInfo,
|
---|
30 | const VkAllocationCallbacks* pAllocator,
|
---|
31 | VkDebugUtilsMessengerEXT* pDebugMessenger) {
|
---|
32 | PFN_vkCreateDebugUtilsMessengerEXT func = (PFN_vkCreateDebugUtilsMessengerEXT)vkGetInstanceProcAddr(instance,
|
---|
33 | "vkCreateDebugUtilsMessengerEXT");
|
---|
34 |
|
---|
35 | if (func != nullptr) {
|
---|
36 | return func(instance, pCreateInfo, pAllocator, pDebugMessenger);
|
---|
37 | } else {
|
---|
38 | return VK_ERROR_EXTENSION_NOT_PRESENT;
|
---|
39 | }
|
---|
40 | }
|
---|
41 |
|
---|
42 | void VulkanUtilsNew::destroyDebugUtilsMessengerEXT(VkInstance instance,
|
---|
43 | VkDebugUtilsMessengerEXT debugMessenger,
|
---|
44 | const VkAllocationCallbacks* pAllocator) {
|
---|
45 | PFN_vkDestroyDebugUtilsMessengerEXT func = (PFN_vkDestroyDebugUtilsMessengerEXT)vkGetInstanceProcAddr(instance,
|
---|
46 | "vkDestroyDebugUtilsMessengerEXT");
|
---|
47 |
|
---|
48 | if (func != nullptr) {
|
---|
49 | func(instance, debugMessenger, pAllocator);
|
---|
50 | }
|
---|
51 | }
|
---|