mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-13 05:50:10 +00:00
vulkan: Batch together multiple draw calls
If multiple instances of the same op appear in order, we can emit one vkCmdDraw() for all of them together. So do that.
This commit is contained in:
parent
21d2372396
commit
63ad234391
@ -98,11 +98,25 @@ gsk_vulkan_op_draw_command_n (GskVulkanOp *op,
|
||||
VkCommandBuffer command_buffer,
|
||||
gsize instance_scale)
|
||||
{
|
||||
vkCmdDraw (command_buffer,
|
||||
6 * instance_scale, 1,
|
||||
0, op->vertex_offset / op->op_class->vertex_input_state->pVertexBindingDescriptions[0].stride);
|
||||
GskVulkanOp *next;
|
||||
gsize stride = op->op_class->vertex_input_state->pVertexBindingDescriptions[0].stride;
|
||||
gsize i;
|
||||
|
||||
return op->next;
|
||||
i = 1;
|
||||
for (next = op->next; next; next = next->next)
|
||||
{
|
||||
if (next->op_class != op->op_class ||
|
||||
next->vertex_offset != op->vertex_offset + i * stride)
|
||||
break;
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
vkCmdDraw (command_buffer,
|
||||
6 * instance_scale, i,
|
||||
0, op->vertex_offset / stride);
|
||||
|
||||
return next;
|
||||
}
|
||||
|
||||
GskVulkanOp *
|
||||
|
Loading…
Reference in New Issue
Block a user