mirror of https://github.com/AxioDL/boo.git
Huge Vulkan refactor
This commit is contained in:
parent
eaff1ba744
commit
721d10919b
|
@ -13,6 +13,9 @@
|
|||
#include <queue>
|
||||
#include "boo/graphicsdev/VulkanDispatchTable.hpp"
|
||||
|
||||
/* Forward-declare handle type for Vulkan Memory Allocator */
|
||||
struct VmaAllocator_T;
|
||||
|
||||
namespace boo
|
||||
{
|
||||
struct BaseGraphicsData;
|
||||
|
@ -34,18 +37,20 @@ struct VulkanContext
|
|||
VkPhysicalDeviceFeatures m_features;
|
||||
VkPhysicalDeviceProperties m_gpuProps;
|
||||
VkPhysicalDeviceMemoryProperties m_memoryProperties;
|
||||
VkDevice m_dev;
|
||||
VkDevice m_dev = VK_NULL_HANDLE;
|
||||
VmaAllocator_T* m_allocator = VK_NULL_HANDLE;
|
||||
uint32_t m_queueCount;
|
||||
uint32_t m_graphicsQueueFamilyIndex = UINT32_MAX;
|
||||
std::vector<VkQueueFamilyProperties> m_queueProps;
|
||||
VkQueue m_queue = VK_NULL_HANDLE;
|
||||
std::mutex m_queueLock;
|
||||
VkDescriptorSetLayout m_descSetLayout;
|
||||
VkPipelineLayout m_pipelinelayout;
|
||||
VkRenderPass m_pass;
|
||||
VkRenderPass m_passColorOnly;
|
||||
VkCommandPool m_loadPool;
|
||||
VkCommandBuffer m_loadCmdBuf;
|
||||
VkDescriptorSetLayout m_descSetLayout = VK_NULL_HANDLE;
|
||||
VkPipelineLayout m_pipelinelayout = VK_NULL_HANDLE;
|
||||
VkDescriptorPool m_descPool = VK_NULL_HANDLE;
|
||||
VkRenderPass m_pass = VK_NULL_HANDLE;
|
||||
VkRenderPass m_passColorOnly = VK_NULL_HANDLE;
|
||||
VkCommandPool m_loadPool = VK_NULL_HANDLE;
|
||||
VkCommandBuffer m_loadCmdBuf = VK_NULL_HANDLE;
|
||||
VkFormat m_displayFormat;
|
||||
VkFormat m_internalFormat;
|
||||
|
||||
|
@ -99,9 +104,10 @@ struct VulkanContext
|
|||
|
||||
std::unordered_map<uint32_t, VkSampler> m_samplers;
|
||||
|
||||
bool initVulkan(std::string_view appName);
|
||||
bool initVulkan(std::string_view appName, PFN_vkGetInstanceProcAddr getVkProc);
|
||||
bool enumerateDevices();
|
||||
void initDevice();
|
||||
void destroyDevice();
|
||||
void initSwapChain(Window& windowCtx, VkSurfaceKHR surface, VkFormat format, VkColorSpaceKHR colorspace);
|
||||
|
||||
struct SwapChainResize
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -370,13 +370,11 @@ public:
|
|||
if (m_getVkProc)
|
||||
{
|
||||
/* Check device support for vulkan */
|
||||
vk::init_dispatch_table_top(PFN_vkGetInstanceProcAddr(m_getVkProc));
|
||||
if (g_VulkanContext.m_instance == VK_NULL_HANDLE)
|
||||
{
|
||||
auto appName = getUniqueName();
|
||||
if (g_VulkanContext.initVulkan(WCSTMBS(appName.data()).c_str()))
|
||||
if (g_VulkanContext.initVulkan(WCSTMBS(appName.data()).c_str(), m_getVkProc))
|
||||
{
|
||||
vk::init_dispatch_table_middle(g_VulkanContext.m_instance, false);
|
||||
if (g_VulkanContext.enumerateDevices())
|
||||
{
|
||||
/* Obtain DXGI Factory */
|
||||
|
|
|
@ -591,8 +591,6 @@ public:
|
|||
}
|
||||
free(supportsPresent);
|
||||
|
||||
vk::init_dispatch_table_bottom(m_ctx->m_instance, m_ctx->m_dev);
|
||||
|
||||
if (!vk::GetPhysicalDeviceWin32PresentationSupportKHR(m_ctx->m_gpus[0], m_ctx->m_graphicsQueueFamilyIndex))
|
||||
{
|
||||
Log.report(logvisor::Fatal, "Win32 doesn't support vulkan present");
|
||||
|
|
|
@ -538,7 +538,13 @@ public:
|
|||
}
|
||||
|
||||
m_callback.appQuitting(this);
|
||||
clientThread.join();
|
||||
if (clientThread.joinable())
|
||||
clientThread.join();
|
||||
|
||||
#if BOO_HAS_VULKAN
|
||||
g_VulkanContext.destroyDevice();
|
||||
#endif
|
||||
|
||||
return clientReturn;
|
||||
}
|
||||
|
||||
|
|
|
@ -726,11 +726,9 @@ public:
|
|||
Log.report(logvisor::Fatal, "unable to resolve glXWaitVideoSyncSGI");
|
||||
}
|
||||
|
||||
vk::init_dispatch_table_top(PFN_vkGetInstanceProcAddr(getVkProc));
|
||||
if (m_ctx->m_instance == VK_NULL_HANDLE)
|
||||
m_ctx->initVulkan(APP->getUniqueName());
|
||||
m_ctx->initVulkan(APP->getUniqueName(), PFN_vkGetInstanceProcAddr(getVkProc));
|
||||
|
||||
vk::init_dispatch_table_middle(m_ctx->m_instance, false);
|
||||
if (!m_ctx->enumerateDevices())
|
||||
return false;
|
||||
|
||||
|
@ -781,8 +779,6 @@ public:
|
|||
}
|
||||
free(supportsPresent);
|
||||
|
||||
vk::init_dispatch_table_bottom(m_ctx->m_instance, m_ctx->m_dev);
|
||||
|
||||
if (!vk::GetPhysicalDeviceXcbPresentationSupportKHR(m_ctx->m_gpus[0], m_ctx->m_graphicsQueueFamilyIndex, m_xcbConn, m_visualid))
|
||||
{
|
||||
Log.report(logvisor::Fatal, "XCB visual doesn't support vulkan present");
|
||||
|
|
Loading…
Reference in New Issue