68 lines
1.6 KiB
C++
68 lines
1.6 KiB
C++
#pragma once
|
|
|
|
#include <vector>
|
|
#include <memory>
|
|
|
|
#include "Logger.h"
|
|
#include "VulkanDebugManager.h"
|
|
#include "VulkanDeviceManager.h"
|
|
#include "GlfwWindowManager.h"
|
|
|
|
#define GLFW_INCLUDE_VULKAN
|
|
#include <GLFW/glfw3.h>
|
|
|
|
const std::vector<const char*> ValidationLayers = {
|
|
"VK_LAYER_KHRONOS_validation"
|
|
};
|
|
|
|
struct FVulkanConfig
|
|
{
|
|
bool bValidationEnabled = true;
|
|
bool bVerboseLogging = false;
|
|
};
|
|
|
|
class VulkanInstanceManager
|
|
{
|
|
public:
|
|
VulkanInstanceManager();
|
|
~VulkanInstanceManager();
|
|
|
|
VulkanInstanceManager(const VulkanInstanceManager&) = delete;
|
|
VulkanInstanceManager& operator=(const VulkanInstanceManager&) = delete;
|
|
|
|
VulkanInstanceManager(VulkanInstanceManager&& Other) noexcept;
|
|
VulkanInstanceManager& operator=(VulkanInstanceManager&& Other) noexcept;
|
|
|
|
// void Initialize(const FVulkanConfig& Config);
|
|
void Initialize(bool bEnableValidationLayers);
|
|
void SetupDebug();
|
|
void SetupDevice();
|
|
|
|
// void Initialize(VulkanDebugManager& inDebugManager, bool inValidationEnabled);
|
|
void Cleanup();
|
|
|
|
bool IsInitialized() const { return Instance != VK_NULL_HANDLE; }
|
|
|
|
const std::vector<const char*>& GetValidationLayers() const
|
|
{
|
|
return ValidationLayers;
|
|
}
|
|
|
|
const VkInstance GetInstance() const { return Instance; }
|
|
|
|
private:
|
|
std::unique_ptr<VulkanDebugManager> VkDebugManager = nullptr;
|
|
std::unique_ptr<VulkanDeviceManager> VkDeviceManager = nullptr;
|
|
|
|
bool bValidationEnabled = false;
|
|
bool bVerboseLogging = false;
|
|
|
|
VkInstance Instance = VK_NULL_HANDLE;
|
|
|
|
std::vector<const char*> GetRequiredExtensions();
|
|
|
|
bool CheckValidationLayerSupport();
|
|
|
|
void CreateInstance();
|
|
};
|