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 ShaderModule::Create(DeviceHandle device, const UInt32* code, std::size_t size, VkShaderModuleCreateFlags flags, const VkAllocationCallbacks* allocator)
inline bool ShaderModule::Create(Device& device, const UInt32* code, std::size_t size, VkShaderModuleCreateFlags flags, const VkAllocationCallbacks* allocator)
{
VkShaderModuleCreateInfo createInfo =
{
@@ -20,17 +20,17 @@ namespace Nz
code
};
return Create(std::move(device), createInfo, allocator);
return Create(device, createInfo, allocator);
}
inline VkResult ShaderModule::CreateHelper(const DeviceHandle& device, const VkShaderModuleCreateInfo* createInfo, const VkAllocationCallbacks* allocator, VkShaderModule* handle)
inline VkResult ShaderModule::CreateHelper(Device& device, const VkShaderModuleCreateInfo* createInfo, const VkAllocationCallbacks* allocator, VkShaderModule* handle)
{
return device->vkCreateShaderModule(*device, createInfo, allocator, handle);
return device.vkCreateShaderModule(device, createInfo, allocator, handle);
}
inline void ShaderModule::DestroyHelper(const DeviceHandle& device, VkShaderModule handle, const VkAllocationCallbacks* allocator)
inline void ShaderModule::DestroyHelper(Device& device, VkShaderModule handle, const VkAllocationCallbacks* allocator)
{
return device->vkDestroyShaderModule(*device, handle, allocator);
return device.vkDestroyShaderModule(device, handle, allocator);
}
}
}