[gtk+] vulkan: Keep vertex buffer around until cleanup
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] vulkan: Keep vertex buffer around until cleanup
- Date: Fri, 6 Jan 2017 16:17:15 +0000 (UTC)
commit 5a6ead8760895cf0f29dd019af9738d15638dd26
Author: Benjamin Otte <otte redhat com>
Date: Fri Jan 6 17:16:38 2017 +0100
vulkan: Keep vertex buffer around until cleanup
Don't just free it while the command buffer using it is still pending.
gsk/gskvulkanrender.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/gsk/gskvulkanrender.c b/gsk/gskvulkanrender.c
index d89e4f7..f510750 100644
--- a/gsk/gskvulkanrender.c
+++ b/gsk/gskvulkanrender.c
@@ -35,6 +35,7 @@ struct _GskVulkanRender
VkRenderPass render_pass;
GskVulkanPipelineLayout *layout;
GskVulkanUploader *uploader;
+ GskVulkanBuffer *vertex_buffer;
GHashTable *descriptor_set_indexes;
VkDescriptorPool descriptor_pool;
@@ -466,7 +467,6 @@ void
gsk_vulkan_render_draw (GskVulkanRender *self,
VkSampler sampler)
{
- GskVulkanBuffer *buffer;
VkCommandBuffer command_buffer;
GSList *l;
guint i;
@@ -475,7 +475,7 @@ gsk_vulkan_render_draw (GskVulkanRender *self,
command_buffer = gsk_vulkan_command_pool_get_buffer (self->command_pool);
- buffer = gsk_vulkan_render_collect_vertex_data (self);
+ self->vertex_buffer = gsk_vulkan_render_collect_vertex_data (self);
vkCmdSetViewport (command_buffer,
0,
@@ -521,7 +521,7 @@ gsk_vulkan_render_draw (GskVulkanRender *self,
for (l = self->render_passes; l; l = l->next)
{
- gsk_vulkan_render_pass_draw (l->data, self, buffer, self->layout, command_buffer);
+ gsk_vulkan_render_pass_draw (l->data, self, self->vertex_buffer, self->layout, command_buffer);
}
vkCmdEndRenderPass (command_buffer);
@@ -529,8 +529,6 @@ gsk_vulkan_render_draw (GskVulkanRender *self,
gsk_vulkan_command_pool_submit_buffer (self->command_pool, command_buffer, self->fence);
- gsk_vulkan_buffer_free (buffer);
-
if (GSK_RENDER_MODE_CHECK (SYNC))
{
GSK_VK_CHECK (vkWaitForFences, gdk_vulkan_context_get_device (self->vulkan),
@@ -569,6 +567,8 @@ gsk_vulkan_render_cleanup (GskVulkanRender *self)
gsk_vulkan_command_pool_reset (self->command_pool);
+ g_clear_pointer (&self->vertex_buffer, gsk_vulkan_buffer_free);
+
g_hash_table_remove_all (self->descriptor_set_indexes);
GSK_VK_CHECK (vkResetDescriptorPool, device,
self->descriptor_pool,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]