Vulkan: Make device objects take a DeviceHandle at creation

Former-commit-id: 0c9724fac593d562dd0ef6fbdf10b2cad9494ac7 [formerly 05c1e582989afde033ac6cee4def19859246167b]
Former-commit-id: 4730597d196d8841c395a1cfe101bca70caa4a5e
This commit is contained in:
Lynix 2016-06-13 19:53:46 +02:00
parent 8e9deee43e
commit 405e873294
12 changed files with 61 additions and 83 deletions

View File

@ -2,7 +2,7 @@
// This file is part of the "Nazara Engine - Vulkan" // This file is part of the "Nazara Engine - Vulkan"
// For conditions of distribution and use, see copyright notice in Config.hpp // For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Vulkan/VkSurface.hpp> #include <Nazara/Vulkan/VkCommandBuffer.hpp>
#include <Nazara/Core/Error.hpp> #include <Nazara/Core/Error.hpp>
#include <Nazara/Vulkan/VkInstance.hpp> #include <Nazara/Vulkan/VkInstance.hpp>
#include <Nazara/Vulkan/Debug.hpp> #include <Nazara/Vulkan/Debug.hpp>
@ -33,7 +33,7 @@ namespace Nz
inline bool CommandBuffer::Begin(const VkCommandBufferBeginInfo& info) inline bool CommandBuffer::Begin(const VkCommandBufferBeginInfo& info)
{ {
m_lastErrorCode = m_pool->GetDevice().vkBeginCommandBuffer(m_handle, &info); m_lastErrorCode = m_pool->GetDevice()->vkBeginCommandBuffer(m_handle, &info);
if (m_lastErrorCode != VkResult::VK_SUCCESS) if (m_lastErrorCode != VkResult::VK_SUCCESS)
{ {
NazaraError("Failed to begin command buffer"); NazaraError("Failed to begin command buffer");
@ -119,7 +119,7 @@ namespace Nz
inline bool CommandBuffer::End() inline bool CommandBuffer::End()
{ {
m_lastErrorCode = m_pool->GetDevice().vkEndCommandBuffer(m_handle); m_lastErrorCode = m_pool->GetDevice()->vkEndCommandBuffer(m_handle);
if (m_lastErrorCode != VkResult::VK_SUCCESS) if (m_lastErrorCode != VkResult::VK_SUCCESS)
{ {
NazaraError("Failed to end command buffer"); NazaraError("Failed to end command buffer");
@ -132,7 +132,7 @@ namespace Nz
inline void CommandBuffer::Free() inline void CommandBuffer::Free()
{ {
if (m_handle) if (m_handle)
m_pool->GetDevice().vkFreeCommandBuffers(m_pool->GetDevice(), *m_pool, 1, &m_handle); m_pool->GetDevice()->vkFreeCommandBuffers(*m_pool->GetDevice(), *m_pool, 1, &m_handle);
} }
inline VkResult CommandBuffer::GetLastErrorCode() const inline VkResult CommandBuffer::GetLastErrorCode() const

View File

@ -25,7 +25,7 @@ namespace Nz
friend DeviceObject; friend DeviceObject;
public: public:
inline CommandPool(Device& instance); CommandPool() = default;
CommandPool(const CommandPool&) = delete; CommandPool(const CommandPool&) = delete;
CommandPool(CommandPool&&) = default; CommandPool(CommandPool&&) = default;
~CommandPool() = default; ~CommandPool() = default;
@ -34,7 +34,7 @@ namespace Nz
std::vector<CommandBuffer> AllocateCommandBuffers(UInt32 commandBufferCount, VkCommandBufferLevel level); std::vector<CommandBuffer> AllocateCommandBuffers(UInt32 commandBufferCount, VkCommandBufferLevel level);
using DeviceObject::Create; using DeviceObject::Create;
inline bool Create(UInt32 queueFamilyIndex, VkCommandPoolCreateFlags flags = 0, const VkAllocationCallbacks* allocator = nullptr); inline bool Create(const DeviceHandle& device, UInt32 queueFamilyIndex, VkCommandPoolCreateFlags flags = 0, const VkAllocationCallbacks* allocator = nullptr);
inline bool Reset(VkCommandPoolResetFlags flags); inline bool Reset(VkCommandPoolResetFlags flags);
@ -42,8 +42,8 @@ namespace Nz
CommandPool& operator=(CommandPool&&) = delete; CommandPool& operator=(CommandPool&&) = delete;
private: private:
static inline VkResult CreateHelper(Device& device, const VkCommandPoolCreateInfo* createInfo, const VkAllocationCallbacks* allocator, VkCommandPool* handle); static inline VkResult CreateHelper(const DeviceHandle& device, const VkCommandPoolCreateInfo* createInfo, const VkAllocationCallbacks* allocator, VkCommandPool* handle);
static inline void DestroyHelper(Device& device, VkCommandPool handle, const VkAllocationCallbacks* allocator); static inline void DestroyHelper(const DeviceHandle& device, VkCommandPool handle, const VkAllocationCallbacks* allocator);
}; };
} }
} }

View File

@ -11,12 +11,7 @@ namespace Nz
{ {
namespace Vk namespace Vk
{ {
inline CommandPool::CommandPool(Device& device) : inline bool CommandPool::Create(const DeviceHandle& device, UInt32 queueFamilyIndex, VkCommandPoolCreateFlags flags, const VkAllocationCallbacks* allocator)
DeviceObject(device)
{
}
inline bool CommandPool::Create(UInt32 queueFamilyIndex, VkCommandPoolCreateFlags flags, const VkAllocationCallbacks* allocator)
{ {
VkCommandPoolCreateInfo createInfo = VkCommandPoolCreateInfo createInfo =
{ {
@ -26,26 +21,26 @@ namespace Nz
queueFamilyIndex queueFamilyIndex
}; };
return Create(createInfo, allocator); return Create(device, createInfo, allocator);
} }
inline bool CommandPool::Reset(VkCommandPoolResetFlags flags) inline bool CommandPool::Reset(VkCommandPoolResetFlags flags)
{ {
m_lastErrorCode = m_device.vkResetCommandPool(m_device, m_handle, flags); m_lastErrorCode = m_device->vkResetCommandPool(*m_device, m_handle, flags);
if (m_lastErrorCode != VkResult::VK_SUCCESS) if (m_lastErrorCode != VkResult::VK_SUCCESS)
return false; return false;
return true; return true;
} }
inline VkResult CommandPool::CreateHelper(Device& device, const VkCommandPoolCreateInfo* createInfo, const VkAllocationCallbacks* allocator, VkCommandPool* handle) inline VkResult CommandPool::CreateHelper(const DeviceHandle& device, const VkCommandPoolCreateInfo* createInfo, const VkAllocationCallbacks* allocator, VkCommandPool* handle)
{ {
return device.vkCreateCommandPool(device, createInfo, allocator, handle); return device->vkCreateCommandPool(*device, createInfo, allocator, handle);
} }
inline void CommandPool::DestroyHelper(Device& device, VkCommandPool handle, const VkAllocationCallbacks* allocator) inline void CommandPool::DestroyHelper(const DeviceHandle& device, VkCommandPool handle, const VkAllocationCallbacks* allocator)
{ {
return device.vkDestroyCommandPool(device, handle, allocator); return device->vkDestroyCommandPool(*device, handle, allocator);
} }
} }
} }

View File

@ -14,7 +14,7 @@ namespace Nz
{ {
inline Device::Device(Instance& instance) : inline Device::Device(Instance& instance) :
m_instance(instance), m_instance(instance),
m_device(nullptr) m_device(VK_NULL_HANDLE),
{ {
} }
@ -25,12 +25,12 @@ namespace Nz
inline void Device::Destroy() inline void Device::Destroy()
{ {
if (m_device) if (m_device != VK_NULL_HANDLE)
{ {
vkDeviceWaitIdle(m_device); vkDeviceWaitIdle(m_device);
vkDestroyDevice(m_device, (m_allocator.pfnAllocation) ? &m_allocator : nullptr); vkDestroyDevice(m_device, (m_allocator.pfnAllocation) ? &m_allocator : nullptr);
m_device = nullptr; m_device = VK_NULL_HANDLE;
} }
} }
@ -39,7 +39,7 @@ namespace Nz
VkQueue queue; VkQueue queue;
vkGetDeviceQueue(m_device, queueFamilyIndex, queueIndex, &queue); vkGetDeviceQueue(m_device, queueFamilyIndex, queueIndex, &queue);
return Queue(*this, queue); return Queue(CreateHandle(), queue);
} }
inline Instance& Device::GetInstance() inline Instance& Device::GetInstance()

View File

@ -19,16 +19,15 @@ namespace Nz
class DeviceObject class DeviceObject
{ {
public: public:
inline DeviceObject(Device& instance); inline DeviceObject();
DeviceObject(const DeviceObject&) = delete; DeviceObject(const DeviceObject&) = delete;
DeviceObject(DeviceObject&&); DeviceObject(DeviceObject&&);
inline ~DeviceObject(); inline ~DeviceObject();
inline bool Create(const CreateInfo& createInfo, const VkAllocationCallbacks* allocator = nullptr); inline bool Create(const DeviceHandle& device, const CreateInfo& createInfo, const VkAllocationCallbacks* allocator = nullptr);
inline void Destroy(); inline void Destroy();
inline Device& GetDevice(); inline const DeviceHandle& GetDevice() const;
inline const Device& GetDevice() const;
inline VkResult GetLastErrorCode() const; inline VkResult GetLastErrorCode() const;
DeviceObject& operator=(const DeviceObject&) = delete; DeviceObject& operator=(const DeviceObject&) = delete;
@ -37,7 +36,7 @@ namespace Nz
inline operator VkType(); inline operator VkType();
protected: protected:
Device& m_device; DeviceHandle m_device;
VkAllocationCallbacks m_allocator; VkAllocationCallbacks m_allocator;
VkType m_handle; VkType m_handle;
VkResult m_lastErrorCode; VkResult m_lastErrorCode;

View File

@ -12,15 +12,14 @@ namespace Nz
namespace Vk namespace Vk
{ {
template<typename C, typename VkType, typename CreateInfo> template<typename C, typename VkType, typename CreateInfo>
inline DeviceObject<C, VkType, CreateInfo>::DeviceObject(Device& device) : inline DeviceObject<C, VkType, CreateInfo>::DeviceObject() :
m_device(device),
m_handle(VK_NULL_HANDLE) m_handle(VK_NULL_HANDLE)
{ {
} }
template<typename C, typename VkType, typename CreateInfo> template<typename C, typename VkType, typename CreateInfo>
inline DeviceObject<C, VkType, CreateInfo>::DeviceObject(DeviceObject&& object) : inline DeviceObject<C, VkType, CreateInfo>::DeviceObject(DeviceObject&& object) :
m_device(object.m_device), m_device(std::move(object.m_device)),
m_allocator(object.m_allocator), m_allocator(object.m_allocator),
m_handle(object.m_handle), m_handle(object.m_handle),
m_lastErrorCode(object.m_lastErrorCode) m_lastErrorCode(object.m_lastErrorCode)
@ -35,8 +34,9 @@ namespace Nz
} }
template<typename C, typename VkType, typename CreateInfo> template<typename C, typename VkType, typename CreateInfo>
inline bool DeviceObject<C, VkType, CreateInfo>::Create(const CreateInfo& createInfo, const VkAllocationCallbacks* allocator) inline bool DeviceObject<C, VkType, CreateInfo>::Create(const DeviceHandle& device, const CreateInfo& createInfo, const VkAllocationCallbacks* allocator)
{ {
m_device = device;
m_lastErrorCode = C::CreateHelper(m_device, &createInfo, allocator, &m_handle); m_lastErrorCode = C::CreateHelper(m_device, &createInfo, allocator, &m_handle);
if (m_lastErrorCode != VkResult::VK_SUCCESS) if (m_lastErrorCode != VkResult::VK_SUCCESS)
{ {
@ -64,13 +64,7 @@ namespace Nz
} }
template<typename C, typename VkType, typename CreateInfo> template<typename C, typename VkType, typename CreateInfo>
inline Device& DeviceObject<C, VkType, CreateInfo>::GetDevice() inline const DeviceHandle& DeviceObject<C, VkType, CreateInfo>::GetDevice() const
{
return m_device;
}
template<typename C, typename VkType, typename CreateInfo>
inline const Device& DeviceObject<C, VkType, CreateInfo>::GetDevice() const
{ {
return m_device; return m_device;
} }

View File

@ -18,12 +18,12 @@ namespace Nz
class Queue class Queue
{ {
public: public:
inline Queue(Device& device, VkQueue queue); inline Queue(const DeviceHandle& device, VkQueue queue);
inline Queue(const Queue& queue); inline Queue(const Queue& queue);
inline Queue(Queue&& queue); inline Queue(Queue&& queue);
inline ~Queue() = default; inline ~Queue() = default;
inline Device& GetDevice(); inline const DeviceHandle& GetDevice() const;
inline VkResult GetLastErrorCode() const; inline VkResult GetLastErrorCode() const;
inline bool Present(const VkPresentInfoKHR& presentInfo); inline bool Present(const VkPresentInfoKHR& presentInfo);
@ -40,7 +40,7 @@ namespace Nz
inline operator VkQueue(); inline operator VkQueue();
protected: protected:
Device& m_device; DeviceHandle m_device;
VkQueue m_handle; VkQueue m_handle;
VkResult m_lastErrorCode; VkResult m_lastErrorCode;
}; };

View File

@ -2,7 +2,7 @@
// This file is part of the "Nazara Engine - Vulkan" // This file is part of the "Nazara Engine - Vulkan"
// For conditions of distribution and use, see copyright notice in Config.hpp // For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Vulkan/VkCommandPool.hpp> #include <Nazara/Vulkan/VkQueue.hpp>
#include <Nazara/Core/Error.hpp> #include <Nazara/Core/Error.hpp>
#include <Nazara/Vulkan/VkDevice.hpp> #include <Nazara/Vulkan/VkDevice.hpp>
#include <Nazara/Vulkan/Debug.hpp> #include <Nazara/Vulkan/Debug.hpp>
@ -11,7 +11,7 @@ namespace Nz
{ {
namespace Vk namespace Vk
{ {
inline Queue::Queue(Device& device, VkQueue queue) : inline Queue::Queue(const DeviceHandle& device, VkQueue queue) :
m_device(device), m_device(device),
m_handle(queue), m_handle(queue),
m_lastErrorCode(VkResult::VK_SUCCESS) m_lastErrorCode(VkResult::VK_SUCCESS)
@ -32,7 +32,7 @@ namespace Nz
{ {
} }
inline Device& Queue::GetDevice() inline const DeviceHandle& Queue::GetDevice() const
{ {
return m_device; return m_device;
} }
@ -44,7 +44,7 @@ namespace Nz
inline bool Queue::Present(const VkPresentInfoKHR& presentInfo) inline bool Queue::Present(const VkPresentInfoKHR& presentInfo)
{ {
m_lastErrorCode = m_device.vkQueuePresentKHR(m_handle, &presentInfo); m_lastErrorCode = m_device->vkQueuePresentKHR(m_handle, &presentInfo);
if (m_lastErrorCode != VkResult::VK_SUCCESS) if (m_lastErrorCode != VkResult::VK_SUCCESS)
return false; return false;
@ -75,7 +75,7 @@ namespace Nz
inline bool Queue::Submit(UInt32 submitCount, const VkSubmitInfo* submits, VkFence fence) inline bool Queue::Submit(UInt32 submitCount, const VkSubmitInfo* submits, VkFence fence)
{ {
m_lastErrorCode = m_device.vkQueueSubmit(m_handle, submitCount, submits, fence); m_lastErrorCode = m_device->vkQueueSubmit(m_handle, submitCount, submits, fence);
if (m_lastErrorCode != VkResult::VK_SUCCESS) if (m_lastErrorCode != VkResult::VK_SUCCESS)
return false; return false;
@ -84,7 +84,7 @@ namespace Nz
inline bool Queue::WaitIdle() inline bool Queue::WaitIdle()
{ {
m_lastErrorCode = m_device.vkQueueWaitIdle(m_handle); m_lastErrorCode = m_device->vkQueueWaitIdle(m_handle);
if (m_lastErrorCode != VkResult::VK_SUCCESS) if (m_lastErrorCode != VkResult::VK_SUCCESS)
return false; return false;

View File

@ -19,20 +19,20 @@ namespace Nz
friend DeviceObject; friend DeviceObject;
public: public:
inline Semaphore(Device& instance); Semaphore() = default;
Semaphore(const Semaphore&) = delete; Semaphore(const Semaphore&) = delete;
Semaphore(Semaphore&&) = default; Semaphore(Semaphore&&) = default;
~Semaphore() = default; ~Semaphore() = default;
using DeviceObject::Create; using DeviceObject::Create;
inline bool Create(VkSemaphoreCreateFlags flags = 0, const VkAllocationCallbacks* allocator = nullptr); inline bool Create(const DeviceHandle& device, VkSemaphoreCreateFlags flags = 0, const VkAllocationCallbacks* allocator = nullptr);
Semaphore& operator=(const Semaphore&) = delete; Semaphore& operator=(const Semaphore&) = delete;
Semaphore& operator=(Semaphore&&) = delete; Semaphore& operator=(Semaphore&&) = delete;
private: private:
static VkResult CreateHelper(Device& device, const VkSemaphoreCreateInfo* createInfo, const VkAllocationCallbacks* allocator, VkSemaphore* handle); static VkResult CreateHelper(const DeviceHandle& device, const VkSemaphoreCreateInfo* createInfo, const VkAllocationCallbacks* allocator, VkSemaphore* handle);
static void DestroyHelper(Device& device, VkSemaphore handle, const VkAllocationCallbacks* allocator); static void DestroyHelper(const DeviceHandle& device, VkSemaphore handle, const VkAllocationCallbacks* allocator);
}; };
} }
} }

View File

@ -9,12 +9,7 @@ namespace Nz
{ {
namespace Vk namespace Vk
{ {
inline Semaphore::Semaphore(Device& device) : inline bool Semaphore::Create(const DeviceHandle& device, VkSemaphoreCreateFlags flags, const VkAllocationCallbacks* allocator)
DeviceObject(device)
{
}
inline bool Semaphore::Create(VkSemaphoreCreateFlags flags, const VkAllocationCallbacks* allocator)
{ {
VkSemaphoreCreateInfo createInfo = VkSemaphoreCreateInfo createInfo =
{ {
@ -23,17 +18,17 @@ namespace Nz
flags flags
}; };
return Create(createInfo, allocator); return Create(device, createInfo, allocator);
} }
VkResult Semaphore::CreateHelper(Device& device, const VkSemaphoreCreateInfo* createInfo, const VkAllocationCallbacks* allocator, VkSemaphore* handle) VkResult Semaphore::CreateHelper(const DeviceHandle& device, const VkSemaphoreCreateInfo* createInfo, const VkAllocationCallbacks* allocator, VkSemaphore* handle)
{ {
return device.vkCreateSemaphore(device, createInfo, allocator, handle); return device->vkCreateSemaphore(*device, createInfo, allocator, handle);
} }
void Semaphore::DestroyHelper(Device& device, VkSemaphore handle, const VkAllocationCallbacks* allocator) void Semaphore::DestroyHelper(const DeviceHandle& device, VkSemaphore handle, const VkAllocationCallbacks* allocator)
{ {
return device.vkDestroySemaphore(device, handle, allocator); return device->vkDestroySemaphore(*device, handle, allocator);
} }
} }
} }

View File

@ -19,14 +19,14 @@ namespace Nz
friend DeviceObject; friend DeviceObject;
public: public:
inline Swapchain(Device& instance); Swapchain() = default;
Swapchain(const Swapchain&) = delete; Swapchain(const Swapchain&) = delete;
Swapchain(Swapchain&&) = default; Swapchain(Swapchain&&) = default;
~Swapchain() = default; ~Swapchain() = default;
inline bool AcquireNextImage(Nz::UInt64 timeout, VkSemaphore semaphore, VkFence fence, UInt32* imageIndex); inline bool AcquireNextImage(Nz::UInt64 timeout, VkSemaphore semaphore, VkFence fence, UInt32* imageIndex);
inline bool Create(const VkSwapchainCreateInfoKHR& createInfo, const VkAllocationCallbacks* allocator = nullptr); inline bool Create(const DeviceHandle& device, const VkSwapchainCreateInfoKHR& createInfo, const VkAllocationCallbacks* allocator = nullptr);
inline VkImage GetImage(UInt32 index) const; inline VkImage GetImage(UInt32 index) const;
inline const std::vector<VkImage>& GetImages() const; inline const std::vector<VkImage>& GetImages() const;
@ -38,8 +38,8 @@ namespace Nz
Swapchain& operator=(Swapchain&&) = delete; Swapchain& operator=(Swapchain&&) = delete;
private: private:
static VkResult CreateHelper(Device& device, const VkSwapchainCreateInfoKHR* createInfo, const VkAllocationCallbacks* allocator, VkSwapchainKHR* handle); static VkResult CreateHelper(const DeviceHandle& device, const VkSwapchainCreateInfoKHR* createInfo, const VkAllocationCallbacks* allocator, VkSwapchainKHR* handle);
static void DestroyHelper(Device& device, VkSwapchainKHR handle, const VkAllocationCallbacks* allocator); static void DestroyHelper(const DeviceHandle& device, VkSwapchainKHR handle, const VkAllocationCallbacks* allocator);
std::vector<VkImage> m_images; std::vector<VkImage> m_images;
}; };

View File

@ -11,14 +11,9 @@ namespace Nz
{ {
namespace Vk namespace Vk
{ {
inline Swapchain::Swapchain(Device& device) :
DeviceObject(device)
{
}
inline bool Swapchain::AcquireNextImage(Nz::UInt64 timeout, VkSemaphore semaphore, VkFence fence, UInt32* imageIndex) inline bool Swapchain::AcquireNextImage(Nz::UInt64 timeout, VkSemaphore semaphore, VkFence fence, UInt32* imageIndex)
{ {
m_lastErrorCode = m_device.vkAcquireNextImageKHR(m_device, m_handle, timeout, semaphore, fence, imageIndex); m_lastErrorCode = m_device->vkAcquireNextImageKHR(*m_device, m_handle, timeout, semaphore, fence, imageIndex);
switch (m_lastErrorCode) switch (m_lastErrorCode)
{ {
case VkResult::VK_SUBOPTIMAL_KHR: case VkResult::VK_SUBOPTIMAL_KHR:
@ -30,13 +25,13 @@ namespace Nz
} }
} }
inline bool Swapchain::Create(const VkSwapchainCreateInfoKHR& createInfo, const VkAllocationCallbacks* allocator) inline bool Swapchain::Create(const DeviceHandle& device, const VkSwapchainCreateInfoKHR& createInfo, const VkAllocationCallbacks* allocator)
{ {
if (!DeviceObject::Create(createInfo, allocator)) if (!DeviceObject::Create(device, createInfo, allocator))
return false; return false;
UInt32 imageCount = 0; UInt32 imageCount = 0;
m_lastErrorCode = m_device.vkGetSwapchainImagesKHR(m_device, m_handle, &imageCount, nullptr); m_lastErrorCode = m_device->vkGetSwapchainImagesKHR(*m_device, m_handle, &imageCount, nullptr);
if (m_lastErrorCode != VkResult::VK_SUCCESS || imageCount == 0) if (m_lastErrorCode != VkResult::VK_SUCCESS || imageCount == 0)
{ {
NazaraError("Failed to query swapchain image count"); NazaraError("Failed to query swapchain image count");
@ -44,7 +39,7 @@ namespace Nz
} }
m_images.resize(imageCount); m_images.resize(imageCount);
m_lastErrorCode = m_device.vkGetSwapchainImagesKHR(m_device, m_handle, &imageCount, m_images.data()); m_lastErrorCode = m_device->vkGetSwapchainImagesKHR(*m_device, m_handle, &imageCount, m_images.data());
if (m_lastErrorCode != VkResult::VK_SUCCESS) if (m_lastErrorCode != VkResult::VK_SUCCESS)
{ {
NazaraError("Failed to query swapchain images"); NazaraError("Failed to query swapchain images");
@ -71,18 +66,18 @@ namespace Nz
inline bool Swapchain::IsSupported() const inline bool Swapchain::IsSupported() const
{ {
if (!m_device.IsExtensionLoaded("VK_KHR_swapchain")) if (!m_device->IsExtensionLoaded("VK_KHR_swapchain"))
return false; return false;
} }
VkResult Swapchain::CreateHelper(Device& device, const VkSwapchainCreateInfoKHR* createInfo, const VkAllocationCallbacks* allocator, VkSwapchainKHR* handle) VkResult Swapchain::CreateHelper(const DeviceHandle& device, const VkSwapchainCreateInfoKHR* createInfo, const VkAllocationCallbacks* allocator, VkSwapchainKHR* handle)
{ {
return device.vkCreateSwapchainKHR(device, createInfo, allocator, handle); return device->vkCreateSwapchainKHR(*device, createInfo, allocator, handle);
} }
void Swapchain::DestroyHelper(Device& device, VkSwapchainKHR handle, const VkAllocationCallbacks* allocator) void Swapchain::DestroyHelper(const DeviceHandle& device, VkSwapchainKHR handle, const VkAllocationCallbacks* allocator)
{ {
return device.vkDestroySwapchainKHR(device, handle, allocator); return device->vkDestroySwapchainKHR(*device, handle, allocator);
} }
} }
} }