38 lines
1.4 KiB
C++
38 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#include <Orange/Core/Types.h>
|
|
#include <Orange/Core/Span.h>
|
|
#include <Orange/Core/Result.h>
|
|
|
|
#include <vulkan/vulkan_core.h>
|
|
|
|
namespace orange
|
|
{
|
|
template <typename T>
|
|
using VulkanResult = Result<T, VkResult, VK_SUCCESS, VK_ERROR_UNKNOWN, VK_ERROR_UNKNOWN>;
|
|
|
|
class RenderContext
|
|
{
|
|
public:
|
|
~RenderContext();
|
|
|
|
static VulkanResult<RenderContext> Create(const char *appName);
|
|
|
|
VkInstance Instance() const { return m_instance; }
|
|
VkPhysicalDevice PhysicalDevice() const { return m_physicalDevice; }
|
|
VkDevice Device() const { return m_device; }
|
|
VkQueue Queue() const { return m_queue; }
|
|
protected:
|
|
friend VulkanResult<RenderContext>;
|
|
RenderContext(VkInstance instance, VkPhysicalDevice physicalDevice, VkDevice device,
|
|
VkQueue queue, VkCommandPool commandPool)
|
|
: m_instance{ instance }, m_physicalDevice{ physicalDevice }, m_device{ device }
|
|
, m_queue{ queue }, m_commandPool{ commandPool } {}
|
|
private:
|
|
VkInstance m_instance = VK_NULL_HANDLE;
|
|
VkPhysicalDevice m_physicalDevice = VK_NULL_HANDLE;
|
|
VkDevice m_device = VK_NULL_HANDLE;
|
|
VkQueue m_queue = VK_NULL_HANDLE;
|
|
VkCommandPool m_commandPool = VK_NULL_HANDLE;
|
|
};
|
|
} |