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

@@ -27,7 +27,7 @@ namespace Nz
bool BindBufferMemory(VkDeviceMemory memory, VkDeviceSize offset = 0);
using DeviceObject::Create;
inline bool Create(DeviceHandle device, VkBufferCreateFlags flags, VkDeviceSize size, VkBufferUsageFlags usage, const VkAllocationCallbacks* allocator = nullptr);
inline bool Create(Device& device, VkBufferCreateFlags flags, VkDeviceSize size, VkBufferUsageFlags usage, const VkAllocationCallbacks* allocator = nullptr);
VkMemoryRequirements GetMemoryRequirements() const;
@@ -35,8 +35,8 @@ namespace Nz
Buffer& operator=(Buffer&&) = delete;
private:
static inline VkResult CreateHelper(const DeviceHandle& device, const VkBufferCreateInfo* createInfo, const VkAllocationCallbacks* allocator, VkBuffer* handle);
static inline void DestroyHelper(const DeviceHandle& device, VkBuffer handle, const VkAllocationCallbacks* allocator);
static inline VkResult CreateHelper(Device& device, const VkBufferCreateInfo* createInfo, const VkAllocationCallbacks* allocator, VkBuffer* handle);
static inline void DestroyHelper(Device& device, VkBuffer handle, const VkAllocationCallbacks* allocator);
};
}
}