mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-13 05:50:10 +00:00
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.
This commit is contained in:
parent
32e123fa67
commit
8d928ad340
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user