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

@@ -21,7 +21,7 @@ namespace Nz
return true;
}
inline bool Buffer::Create(DeviceHandle device, VkBufferCreateFlags flags, VkDeviceSize size, VkBufferUsageFlags usage, const VkAllocationCallbacks* allocator)
inline bool Buffer::Create(Device& device, VkBufferCreateFlags flags, VkDeviceSize size, VkBufferUsageFlags usage, const VkAllocationCallbacks* allocator)
{
VkBufferCreateInfo createInfo = {
VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, // VkStructureType sType;
@@ -34,7 +34,7 @@ namespace Nz
nullptr // const uint32_t* pQueueFamilyIndices;
};
return Create(std::move(device), createInfo, allocator);
return Create(device, createInfo, allocator);
}
inline VkMemoryRequirements Buffer::GetMemoryRequirements() const
@@ -47,14 +47,14 @@ namespace Nz
return memoryRequirements;
}
inline VkResult Buffer::CreateHelper(const DeviceHandle& device, const VkBufferCreateInfo* createInfo, const VkAllocationCallbacks* allocator, VkBuffer* handle)
inline VkResult Buffer::CreateHelper(Device& device, const VkBufferCreateInfo* createInfo, const VkAllocationCallbacks* allocator, VkBuffer* handle)
{
return device->vkCreateBuffer(*device, createInfo, allocator, handle);
return device.vkCreateBuffer(device, createInfo, allocator, handle);
}
inline void Buffer::DestroyHelper(const DeviceHandle& device, VkBuffer handle, const VkAllocationCallbacks* allocator)
inline void Buffer::DestroyHelper(Device& device, VkBuffer handle, const VkAllocationCallbacks* allocator)
{
return device->vkDestroyBuffer(*device, handle, allocator);
return device.vkDestroyBuffer(device, handle, allocator);
}
}
}