[gtk+] vulkan: Try combining draw calls



commit 89d38ae93f4f45776e55446524fb59cfa27442bc
Author: Benjamin Otte <otte redhat com>
Date:   Fri Dec 23 22:19:56 2016 +0100

    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.

 gsk/gskvulkanrenderpass.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/gsk/gskvulkanrenderpass.c b/gsk/gskvulkanrenderpass.c
index 5e91fe7..e5a343a 100644
--- a/gsk/gskvulkanrenderpass.c
+++ b/gsk/gskvulkanrenderpass.c
@@ -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:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]