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,12 +9,12 @@ namespace Nz
{
namespace Vk
{
inline bool PipelineLayout::Create(DeviceHandle device, VkDescriptorSetLayout layout, VkPipelineLayoutCreateFlags flags)
inline bool PipelineLayout::Create(Device& device, VkDescriptorSetLayout layout, VkPipelineLayoutCreateFlags flags)
{
return Create(std::move(device), 1U, &layout, flags);
return Create(device, 1U, &layout, flags);
}
inline bool PipelineLayout::Create(DeviceHandle device, UInt32 layoutCount, const VkDescriptorSetLayout* layouts, VkPipelineLayoutCreateFlags flags)
inline bool PipelineLayout::Create(Device& device, UInt32 layoutCount, const VkDescriptorSetLayout* layouts, VkPipelineLayoutCreateFlags flags)
{
VkPipelineLayoutCreateInfo createInfo = {
VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO,
@@ -26,17 +26,17 @@ namespace Nz
nullptr
};
return Create(std::move(device), createInfo);
return Create(device, createInfo);
}
inline VkResult PipelineLayout::CreateHelper(const DeviceHandle& device, const VkPipelineLayoutCreateInfo* createInfo, const VkAllocationCallbacks* allocator, VkPipelineLayout* handle)
inline VkResult PipelineLayout::CreateHelper(Device& device, const VkPipelineLayoutCreateInfo* createInfo, const VkAllocationCallbacks* allocator, VkPipelineLayout* handle)
{
return device->vkCreatePipelineLayout(*device, createInfo, allocator, handle);
return device.vkCreatePipelineLayout(device, createInfo, allocator, handle);
}
inline void PipelineLayout::DestroyHelper(const DeviceHandle& device, VkPipelineLayout handle, const VkAllocationCallbacks* allocator)
inline void PipelineLayout::DestroyHelper(Device& device, VkPipelineLayout handle, const VkAllocationCallbacks* allocator)
{
return device->vkDestroyPipelineLayout(*device, handle, allocator);
return device.vkDestroyPipelineLayout(device, handle, allocator);
}
}
}