Replace DeviceHandle by references

and keep device alive until Vulkan is freed
This commit is contained in:
Lynix
2020-03-13 18:38:26 +01:00
parent 4cf24cde7d
commit 63547fcd4e
56 changed files with 303 additions and 268 deletions

View File

@@ -8,6 +8,7 @@
#define NAZARA_VULKANRENDERER_VKDEVICEOBJECT_HPP
#include <Nazara/Prerequisites.hpp>
#include <Nazara/Core/MovablePtr.hpp>
#include <Nazara/VulkanRenderer/Wrapper/Device.hpp>
#include <vulkan/vulkan.h>
@@ -24,12 +25,12 @@ namespace Nz
DeviceObject(DeviceObject&& object);
~DeviceObject();
bool Create(DeviceHandle device, const CreateInfo& createInfo, const VkAllocationCallbacks* allocator = nullptr);
bool Create(Device& device, const CreateInfo& createInfo, const VkAllocationCallbacks* allocator = nullptr);
void Destroy();
bool IsValid() const;
const DeviceHandle& GetDevice() const;
Device* GetDevice() const;
VkResult GetLastErrorCode() const;
DeviceObject& operator=(const DeviceObject&) = delete;
@@ -38,7 +39,7 @@ namespace Nz
operator VkType() const;
protected:
DeviceHandle m_device;
MovablePtr<Device> m_device;
VkAllocationCallbacks m_allocator;
VkType m_handle;
mutable VkResult m_lastErrorCode;