From: Benjamin Otte Date: Sat, 24 Jun 2023 02:09:56 +0000 (+0200) Subject: vulkan: Allocate render ops differently X-Git-Tag: archive/raspbian/4.12.3+ds-1+rpi1~1^2^2^2~22^2~1^2~60^2~89 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=8d928ad3402d0498d011f8e8a605c1b952207a5c;p=gtk4.git vulkan: Allocate render ops differently Allocate the memory up front instead of passing the Op into it. This way, we can split ops into their own source file and use init/finish style to use them. --- diff --git a/gsk/vulkan/gskvulkanrenderpass.c b/gsk/vulkan/gskvulkanrenderpass.c index f0ffc0dea0..12322fd893 100644 --- a/gsk/vulkan/gskvulkanrenderpass.c +++ b/gsk/vulkan/gskvulkanrenderpass.c @@ -293,6 +293,23 @@ gsk_vulkan_render_pass_free (GskVulkanRenderPass *self) g_free (self); } +static gpointer +gsk_vulkan_render_pass_alloc_op (GskVulkanRenderPass *self, + gsize size) +{ + gsize pos; + + pos = gsk_vulkan_render_ops_get_size (&self->render_ops); + + gsk_vulkan_render_ops_splice (&self->render_ops, + pos, + 0, FALSE, + NULL, + size); + + return gsk_vulkan_render_ops_index (&self->render_ops, pos); +} + static void gsk_vulkan_render_pass_add_op (GskVulkanRenderPass *self, GskVulkanOp *op); @@ -2536,12 +2553,11 @@ static void gsk_vulkan_render_pass_add_op (GskVulkanRenderPass *self, GskVulkanOp *op) { - op->op_class = &GSK_VULKAN_OP_ALL_CLASS; + GskVulkanOpAll *alloc; - gsk_vulkan_render_ops_splice (&self->render_ops, - gsk_vulkan_render_ops_get_size (&self->render_ops), - 0, FALSE, - (guchar *) op, - sizeof (GskVulkanOpAll)); + alloc = gsk_vulkan_render_pass_alloc_op (self, GSK_VULKAN_OP_ALL_CLASS.size); + + op->op_class = &GSK_VULKAN_OP_ALL_CLASS; + *alloc = *(GskVulkanOpAll *) op; }