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

@@ -9,7 +9,7 @@ namespace Nz
{
namespace Vk
{
inline bool Fence::Create(DeviceHandle device, VkFenceCreateFlags flags, const VkAllocationCallbacks* allocator)
inline bool Fence::Create(Device& device, VkFenceCreateFlags flags, const VkAllocationCallbacks* allocator)
{
VkFenceCreateInfo createInfo =
{
@@ -18,7 +18,7 @@ namespace Nz
flags
};
return Create(std::move(device), createInfo, allocator);
return Create(device, createInfo, allocator);
}
inline bool Fence::Reset()
@@ -53,14 +53,14 @@ namespace Nz
return true;
}
inline VkResult Fence::CreateHelper(const DeviceHandle& device, const VkFenceCreateInfo* createInfo, const VkAllocationCallbacks* allocator, VkFence* handle)
inline VkResult Fence::CreateHelper(Device& device, const VkFenceCreateInfo* createInfo, const VkAllocationCallbacks* allocator, VkFence* handle)
{
return device->vkCreateFence(*device, createInfo, allocator, handle);
return device.vkCreateFence(device, createInfo, allocator, handle);
}
inline void Fence::DestroyHelper(const DeviceHandle& device, VkFence handle, const VkAllocationCallbacks* allocator)
inline void Fence::DestroyHelper(Device& device, VkFence handle, const VkAllocationCallbacks* allocator)
{
return device->vkDestroyFence(*device, handle, allocator);
return device.vkDestroyFence(device, handle, allocator);
}
}
}