diff options
author | Chuyan Zhang <me@zcy.moe> | 2024-09-14 22:38:51 -0700 |
---|---|---|
committer | Chuyan Zhang <me@zcy.moe> | 2024-09-14 22:38:51 -0700 |
commit | e5eed5bdfa01cf549436c6001eaf334d266acc40 (patch) | |
tree | 0cef8c1c20aca8380d058c2676e0718040e3beda /src/vulkan_helper.h | |
parent | 7f14138e1baa2c40fb30d90ebcd45ad17b12e0a3 (diff) | |
download | iris-e5eed5bdfa01cf549436c6001eaf334d266acc40.tar.gz iris-e5eed5bdfa01cf549436c6001eaf334d266acc40.zip |
fix lifetime problem
Diffstat (limited to 'src/vulkan_helper.h')
-rw-r--r-- | src/vulkan_helper.h | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/vulkan_helper.h b/src/vulkan_helper.h index ebdd691..c2b1c8c 100644 --- a/src/vulkan_helper.h +++ b/src/vulkan_helper.h @@ -23,14 +23,13 @@ struct Buffer_t { VkBuffer buffer; VmaAllocator allocator; VmaAllocation allocation; - VkBufferUsageFlags flags; VkDeviceSize size; void *mapped_data = nullptr; - ~Buffer_t(); void* map(); void unmap(); + void release(); }; typedef std::shared_ptr<Buffer_t> Buffer; @@ -45,7 +44,7 @@ struct Texture2D_t { VkImageUsageFlags flags; VkExtent2D extent; - ~Texture2D_t(); + void release(); }; typedef std::shared_ptr<Texture2D_t> Texture2D; @@ -60,12 +59,21 @@ struct CommandBuffer { VkQueue queue; CommandBuffer(VkDevice device, uint32_t queue_family_index, VkQueue queue); - ~CommandBuffer(); - + void destroy(); void begin(VkCommandBufferUsageFlags flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT); void submit_sync(); }; +struct AsyncCommandBuffer { + VkDevice device; + VkCommandPool pool; + VkCommandBuffer buffer; + VkQueue queue; + + AsyncCommandBuffer(VkDevice device, uint32_t queue_family_index, VkQueue queue); + void destroy(); +}; + struct Device { VkInstance instance; VkPhysicalDevice physical_device; @@ -75,6 +83,7 @@ struct Device { VmaAllocator allocator; #ifdef USE_VULKAN_VALIDATION_LAYERS VkDebugReportCallbackEXT debugReportCallback; + VkDebugUtilsMessengerEXT debugUtilsMessenger; #endif Device() = delete; @@ -122,6 +131,7 @@ struct Device { }); CommandBuffer create_command_buffer(); + AsyncCommandBuffer create_async_command_buffer(); }; } // namespace iris
\ No newline at end of file |