mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-02 11:55:59 +01:00
render/vulkan: always finish buffer addon on texture destroy
This commit is contained in:
parent
0702eb9219
commit
faa31d123f
1 changed files with 6 additions and 7 deletions
|
@ -190,6 +190,11 @@ out:
|
||||||
}
|
}
|
||||||
|
|
||||||
void vulkan_texture_destroy(struct wlr_vk_texture *texture) {
|
void vulkan_texture_destroy(struct wlr_vk_texture *texture) {
|
||||||
|
if (texture->buffer != NULL) {
|
||||||
|
wlr_addon_finish(&texture->buffer_addon);
|
||||||
|
texture->buffer = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
// when we recorded a command to fill this image _this_ frame,
|
// when we recorded a command to fill this image _this_ frame,
|
||||||
// it has to be executed before the texture can be destroyed.
|
// it has to be executed before the texture can be destroyed.
|
||||||
// Add it to the renderer->destroy_textures list, destroying
|
// Add it to the renderer->destroy_textures list, destroying
|
||||||
|
@ -203,10 +208,6 @@ void vulkan_texture_destroy(struct wlr_vk_texture *texture) {
|
||||||
|
|
||||||
wl_list_remove(&texture->link);
|
wl_list_remove(&texture->link);
|
||||||
|
|
||||||
if (texture->buffer != NULL) {
|
|
||||||
wlr_addon_finish(&texture->buffer_addon);
|
|
||||||
}
|
|
||||||
|
|
||||||
VkDevice dev = texture->renderer->dev->dev;
|
VkDevice dev = texture->renderer->dev->dev;
|
||||||
if (texture->ds && texture->ds_pool) {
|
if (texture->ds && texture->ds_pool) {
|
||||||
vulkan_free_ds(texture->renderer, texture->ds_pool, texture->ds);
|
vulkan_free_ds(texture->renderer, texture->ds_pool, texture->ds);
|
||||||
|
@ -736,9 +737,7 @@ static void texture_handle_buffer_destroy(struct wlr_addon *addon) {
|
||||||
struct wlr_vk_texture *texture =
|
struct wlr_vk_texture *texture =
|
||||||
wl_container_of(addon, texture, buffer_addon);
|
wl_container_of(addon, texture, buffer_addon);
|
||||||
// We might keep the texture around, waiting for pending command buffers to
|
// We might keep the texture around, waiting for pending command buffers to
|
||||||
// complete before free'ing descriptor sets. Make sure we don't
|
// complete before free'ing descriptor sets.
|
||||||
// use-after-free the destroyed wlr_buffer.
|
|
||||||
texture->buffer = NULL;
|
|
||||||
vulkan_texture_destroy(texture);
|
vulkan_texture_destroy(texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue