Triangle posting
https://vulkan-tutorial.com/Vertex_buffers/Staging_buffer Reached the above part of the tutorial. Adding IMGUI now before continuing.
This commit is contained in:
86
src/public/VulkanDeviceManager.h
Executable file
86
src/public/VulkanDeviceManager.h
Executable file
@@ -0,0 +1,86 @@
|
||||
#pragma once
|
||||
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
#include <vulkan/vulkan_core.h>
|
||||
|
||||
#define GLFW_INCLUDE_VULKAN
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
struct FDeviceConfig
|
||||
{
|
||||
VkInstance Instance;
|
||||
bool bEnableValidationLayers;
|
||||
VkSurfaceKHR Surface;
|
||||
GLFWwindow* Window;
|
||||
};
|
||||
|
||||
struct QueueFamilyIndices
|
||||
{
|
||||
std::optional<uint32_t> GraphicsFamily;
|
||||
std::optional<uint32_t> PresentFamily;
|
||||
|
||||
bool IsComplete()
|
||||
{
|
||||
return GraphicsFamily.has_value() && PresentFamily.has_value();
|
||||
}
|
||||
};
|
||||
|
||||
struct SwapChainSupportDetails
|
||||
{
|
||||
VkSurfaceCapabilitiesKHR Capabilities;
|
||||
std::vector<VkSurfaceFormatKHR> Formats;
|
||||
std::vector<VkPresentModeKHR> PresentModes;
|
||||
};
|
||||
|
||||
class VulkanDeviceManager
|
||||
{
|
||||
public:
|
||||
VulkanDeviceManager();
|
||||
~VulkanDeviceManager();
|
||||
|
||||
void Initialize(FDeviceConfig InConfig);
|
||||
// VkInstance Instance,
|
||||
// bool EnableValidationLayers,
|
||||
// VkSurfaceKHR Surface,
|
||||
// GLFWwindow* Window);
|
||||
|
||||
void Cleanup();
|
||||
|
||||
void PickPhysicalDevice();
|
||||
void CreateLogicalDevice();
|
||||
|
||||
VkDevice GetDevice() { return Device; }
|
||||
VkPhysicalDevice GetPhysicalDevice() { return PhysicalDevice; }
|
||||
QueueFamilyIndices GetPhysicalQueueFamilies() { return PhysicalQueueFamilies; }
|
||||
VkQueue GetGraphicsQueue() { return GraphicsQueue; }
|
||||
VkQueue GetPresentQueue() { return PresentQueue; }
|
||||
SwapChainSupportDetails GetSwapChainSupport() { return SwapChainSupport; }
|
||||
|
||||
private:
|
||||
FDeviceConfig DeviceConfig;
|
||||
|
||||
// VkInstance Instance = VK_NULL_HANDLE;
|
||||
VkDevice Device = VK_NULL_HANDLE;
|
||||
VkPhysicalDevice PhysicalDevice = VK_NULL_HANDLE;
|
||||
VkQueue GraphicsQueue = VK_NULL_HANDLE;
|
||||
VkQueue PresentQueue = VK_NULL_HANDLE;
|
||||
QueueFamilyIndices PhysicalQueueFamilies;
|
||||
// VkSurfaceKHR Surface;
|
||||
|
||||
// GLFWwindow* Window = nullptr;
|
||||
|
||||
SwapChainSupportDetails SwapChainSupport;
|
||||
|
||||
// bool bEnableValidationLayers = false;
|
||||
|
||||
bool IsDeviceSuitable(VkPhysicalDevice Device);
|
||||
|
||||
int RateDeviceSuitability(VkPhysicalDevice Device);
|
||||
|
||||
bool CheckDeviceExtensionSupport(VkPhysicalDevice Device);
|
||||
|
||||
QueueFamilyIndices FindQueueFamilies(VkPhysicalDevice Device);
|
||||
|
||||
SwapChainSupportDetails QuerySwapChainSupport(VkPhysicalDevice Device);
|
||||
};
|
||||
Reference in New Issue
Block a user