vulkan: Try combining draw calls

This gives a 5-7% speedup in the case where we're just drawing N colors
and nothing else. So it;s not tremendously useful, but noticeable.
This commit is contained in:
Benjamin Otte
2016-12-23 22:19:56 +01:00
parent 23d10df6c6
commit 89d38ae93f

View File

@@ -372,11 +372,12 @@ gsk_vulkan_render_pass_draw (GskVulkanRenderPass *self,
GskVulkanPipeline *current_pipeline = NULL;
gsize current_draw_index = 0;
GskVulkanOp *op;
guint i;
guint i, step;
for (i = 0; i < self->render_ops->len; i++)
for (i = 0; i < self->render_ops->len; i += step)
{
op = &g_array_index (self->render_ops, GskVulkanOp, i);
step = 1;
switch (op->type)
{
@@ -432,9 +433,14 @@ gsk_vulkan_render_pass_draw (GskVulkanRenderPass *self,
current_draw_index = 0;
}
for (step = 1; step + i < self->render_ops->len; step++)
{
if (g_array_index (self->render_ops, GskVulkanOp, i + step).type != GSK_VULKAN_OP_COLOR)
break;
}
current_draw_index += gsk_vulkan_color_pipeline_draw (GSK_VULKAN_COLOR_PIPELINE (current_pipeline),
command_buffer,
current_draw_index, 1);
current_draw_index, step);
break;
case GSK_VULKAN_OP_PUSH_VERTEX_CONSTANTS: