umbra/projs/shadow/shadow-engine/shadow-renderer/inc/vlkx/vulkan/ValidationAndExtension.h
Curle a3e89b4e8f
Replace the renderer with a modern, module version. (#7)
* New Vulkan Renderer Module & Associated Fixups
2022-11-26 16:44:16 +00:00

55 lines
1.4 KiB
C++

#pragma once
#include <vulkan/vulkan.h>
#include <vector>
#include <iostream>
#include <SDL.h>
class ValidationAndExtension {
public:
ValidationAndExtension();
~ValidationAndExtension();
const std::vector<const char*> requiredValidations = {
"VK_LAYER_KHRONOS_validation",
//"VK_LAYER_LUNARG_api_dump"
};
VkDebugReportCallbackEXT callback;
bool checkValidationSupport();
std::vector<const char*> getRequiredExtensions(SDL_Window* window, bool validationsRequired);
void setupDebugCallback(bool validationsRequired, VkInstance vulkan);
void destroy(bool validationsRequired, VkInstance vulkan);
VkResult createDebugReportCallbackEXT(
VkInstance vulkan,
const VkDebugReportCallbackCreateInfoEXT* info,
const VkAllocationCallbacks* allocator,
VkDebugReportCallbackEXT* callback) {
auto func = (PFN_vkCreateDebugReportCallbackEXT)vkGetInstanceProcAddr(vulkan, "vkCreateDebugReportCallbackEXT");
if (func != nullptr) {
return func(vulkan, info, allocator, callback);
} else {
return VK_ERROR_EXTENSION_NOT_PRESENT;
}
}
void destroyDebugReportCallbackEXT(
VkInstance vulkan,
const VkDebugReportCallbackEXT callback,
const VkAllocationCallbacks* allocator) {
auto func = (PFN_vkDestroyDebugReportCallbackEXT)vkGetInstanceProcAddr(vulkan, "vkDestroyDebugReportCallbackEXT");
if (func != nullptr) {
func(vulkan, callback, allocator);
}
}
};