mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-04-14 08:22:25 -04:00
render/vulkan: Maintain buffer order when releasing spans
We expect the render buffers to be ordered largest to smallest, with the allocator using a reverse iteration to fill smallest buffers first. Buffers that had been borrowed by a command buffer would just be inserted at the end of the list, and would not maintain ordering with any buffers already in that list. Use a sorted insert to ensure that buffers remain ordered.
This commit is contained in:
parent
50edd3a42d
commit
6dcab66c73
1 changed files with 11 additions and 2 deletions
|
|
@ -465,13 +465,22 @@ static void release_command_buffer_resources(struct wlr_vk_command_buffer *cb,
|
|||
wlr_texture_destroy(&texture->wlr_texture);
|
||||
}
|
||||
|
||||
VkDeviceSize cur_size = min_stage_size;
|
||||
struct wl_list *insertion_target = &renderer->stage.buffers;
|
||||
struct wlr_vk_shared_buffer *buf, *buf_tmp;
|
||||
wl_list_for_each_safe(buf, buf_tmp, &cb->stage_buffers, link) {
|
||||
wl_list_for_each_reverse_safe(buf, buf_tmp, &cb->stage_buffers, link) {
|
||||
buf->allocs.size = 0;
|
||||
buf->last_used_ms = now;
|
||||
|
||||
wl_list_remove(&buf->link);
|
||||
wl_list_insert(&renderer->stage.buffers, &buf->link);
|
||||
|
||||
// Sorted insert
|
||||
while (insertion_target->prev != &renderer->stage.buffers && buf->buf_size > cur_size) {
|
||||
insertion_target = insertion_target->prev;
|
||||
struct wlr_vk_shared_buffer *tbuf = wl_container_of(insertion_target, tbuf, link);
|
||||
cur_size = tbuf->buf_size;
|
||||
}
|
||||
wl_list_insert(insertion_target, &buf->link);
|
||||
}
|
||||
|
||||
if (cb->color_transform) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue