diff options
author | Simon Ser <contact@emersion.fr> | 2022-11-07 15:11:10 +0100 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2022-11-28 23:50:41 +0000 |
commit | 2a414c896ec7a4e492d81bc758248c920b47e8d1 (patch) | |
tree | 5f8924fcac7f5bb2b4cb68548a72c051b6091cef /include/render | |
parent | 0730552e858361256a9aea42cbfda0f93217df74 (diff) |
render/vulkan: destroy textures after command buffer completes
We need to wait for any pending command buffer to complete before
we're able to fully destroy a struct wlr_vk_texture: the Vulkan
spec requires the VkDescriptorSet to be kept alive.
So far we've done this in vulkan_end(), after blocking until the
command buffer completes. We'll soon stop blocking, so move this
logic in get_command_buffer(), where we check which commands buffers
have completed in a non-blocking fashion.
Diffstat (limited to 'include/render')
-rw-r--r-- | include/render/vulkan.h | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/include/render/vulkan.h b/include/render/vulkan.h index 4655acd4..5b47e8ef 100644 --- a/include/render/vulkan.h +++ b/include/render/vulkan.h @@ -148,6 +148,8 @@ struct wlr_vk_command_buffer { VkCommandBuffer vk; bool recording; uint64_t timeline_point; + // Textures to destroy after the command buffer completes + struct wl_list destroy_textures; // wlr_vk_texture.destroy_link }; #define VULKAN_COMMAND_BUFFERS_CAP 64 @@ -174,9 +176,6 @@ struct wlr_vk_renderer { struct wlr_vk_render_buffer *current_render_buffer; struct wlr_vk_command_buffer *current_command_buffer; - // current frame id. Used in wlr_vk_texture.last_used - // Increased every time a frame is ended for the renderer - uint32_t frame; VkRect2D scissor; // needed for clearing VkPipeline bound_pipe; @@ -190,8 +189,6 @@ struct wlr_vk_renderer { struct wl_list render_format_setups; // wlr_vk_render_format_setup.link struct wl_list textures; // wlr_vk_texture.link - // Textures to destroy after frame - struct wl_list destroy_textures; // wlr_vk_texture.destroy_link // Textures to return to foreign queue struct wl_list foreign_textures; // wlr_vk_texture.foreign_link @@ -258,13 +255,13 @@ struct wlr_vk_texture { const struct wlr_vk_format *format; VkDescriptorSet ds; struct wlr_vk_descriptor_pool *ds_pool; - uint32_t last_used; // to track when it can be destroyed + struct wlr_vk_command_buffer *last_used_cb; // to track when it can be destroyed bool dmabuf_imported; bool owned; // if dmabuf_imported: whether we have ownership of the image bool transitioned; // if dma_imported: whether we transitioned it away from preinit bool has_alpha; // whether the image is has alpha channel struct wl_list foreign_link; // wlr_vk_renderer.foreign_textures - struct wl_list destroy_link; // wlr_vk_renderer.destroy_textures + struct wl_list destroy_link; // wlr_vk_command_buffer.destroy_textures struct wl_list link; // wlr_vk_renderer.textures // If imported from a wlr_buffer |