2026-01-20 14:24:50 -05:00
parent fa7ae9ac1c
commit 586ae1d18e
3 changed files with 64 additions and 14 deletions

1
VulkanContext.cpp Normal file
View File

@@ -0,0 +1 @@
#include "VulkanContext.h"

49
VulkanContext.h Normal file
View File

@@ -0,0 +1,49 @@
#pragma once
#include <vector>
#include <memory>
#include "Logger.h"
#include "VulkanInstanceManager.h"
#include "VulkanDeviceManager.h"
#include "VulkanDebugManager.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 VulkanContext
{
public:
VulkanContext();
~VulkanContext();
void Initialize(FVulkanConfig& inConfig);
void Cleanup();
private:
FVulkanConfig Config = {};
VkInstance Instance = VK_NULL_HANDLE;
VkPhysicalDevice PhysicalDevice = VK_NULL_HANDLE;
VkDevice Device = VK_NULL_HANDLE;
VkQueue GraphicsQueue = VK_NULL_HANDLE;
VkSurfaceKHR Surface = VK_NULL_HANDLE;
VkDebugUtilsMessengerEXT debugMessenger = VK_NULL_HANDLE;
public:
VkInstance GetInstance() const { return Instance; }
VkPhysicalDevice GetPhysicalDevice() const { return PhysicalDevice; }
VkDevice GetDevice() const { return Device; }
VkQueue GetGraphicsQueue() const { return GraphicsQueue; }
VkSurfaceKHR GetSurface() const { return Surface; }
};

View File

@@ -3,20 +3,20 @@
#define GLFW_INCLUDE_VULKAN
#include <GLFW/glfw3.h>
struct FCreateDebugUtilsMessengerExtParams
{
VkInstance Instance;
const VkDebugUtilsMessengerCreateInfoEXT* pCreateInfo;
const VkAllocationCallbacks* pAllocator;
VkDebugUtilsMessengerEXT* pDebugMessenger;
};
struct FDestroyDebugUtilsMessengerExtParams
{
VkInstance Instance;
VkDebugUtilsMessengerEXT DebugMessenger;
const VkAllocationCallbacks* pAllocator;
};
// struct FCreateDebugUtilsMessengerExtParams
//{
// VkInstance Instance;
// const VkDebugUtilsMessengerCreateInfoEXT* pCreateInfo;
// const VkAllocationCallbacks* pAllocator;
// VkDebugUtilsMessengerEXT* pDebugMessenger;
// };
//
// struct FDestroyDebugUtilsMessengerExtParams
//{
// VkInstance Instance;
// VkDebugUtilsMessengerEXT DebugMessenger;
// const VkAllocationCallbacks* pAllocator;
// };
class VulkanDeviceManager
{