vulkan: Merge function into only caller
authorBenjamin Otte <otte@redhat.com>
Thu, 13 Jul 2023 09:17:04 +0000 (11:17 +0200)
committerBenjamin Otte <otte@redhat.com>
Sun, 16 Jul 2023 11:16:43 +0000 (13:16 +0200)
The renderpass reshuffling means we can move a bunch of functions now.

This is one of them.

gsk/vulkan/gskvulkanrender.c
gsk/vulkan/gskvulkanrenderpassop.c
gsk/vulkan/gskvulkanrenderprivate.h

index a4137ec34a70f7ab24535599582471260a48fea8..6a9a1bac5039586e04813e353631e940286f1fd3 100644 (file)
@@ -892,48 +892,6 @@ gsk_vulkan_render_collect_vertex_buffer (GskVulkanRender *self)
   gsk_vulkan_buffer_unmap (self->vertex_buffer);
 }
 
-GskVulkanOp *
-gsk_vulkan_render_draw_pass (GskVulkanRender     *self,
-                             GskVulkanRenderPass *render_pass,
-                             GskVulkanOp         *op,
-                             VkCommandBuffer      command_buffer)
-{
-  VkPipeline current_pipeline = VK_NULL_HANDLE;
-  const GskVulkanOpClass *current_pipeline_class = NULL;
-  const char *current_pipeline_clip_type = NULL;
-  VkRenderPass vk_render_pass;
-
-  vk_render_pass = gsk_vulkan_render_pass_begin_draw (render_pass, self, self->pipeline_layout, command_buffer);
-
-  while (op && op->op_class->stage != GSK_VULKAN_STAGE_END_PASS)
-    {
-      if (op->op_class->shader_name &&
-          (op->op_class != current_pipeline_class ||
-           current_pipeline_clip_type != op->clip_type))
-        {
-          current_pipeline = gsk_vulkan_render_get_pipeline (self,
-                                                             op->op_class,
-                                                             op->clip_type,
-                                                             gsk_vulkan_image_get_vk_format (self->target),
-                                                             vk_render_pass);
-          vkCmdBindPipeline (command_buffer,
-                             VK_PIPELINE_BIND_POINT_GRAPHICS,
-                             current_pipeline);
-          current_pipeline_class = op->op_class;
-          current_pipeline_clip_type = op->clip_type;
-        }
-
-      op = gsk_vulkan_op_command (op, self, self->pipeline_layout, command_buffer);
-    }
-
-  if (op && op->op_class->stage == GSK_VULKAN_STAGE_END_PASS)
-    op = gsk_vulkan_op_command (op, self, self->pipeline_layout, command_buffer);
-  else
-    gsk_vulkan_render_pass_end_draw (render_pass, self, self->pipeline_layout, command_buffer);
-
-  return op;
-}
-
 void
 gsk_vulkan_render_draw (GskVulkanRender *self)
 {
index aabbe7951ae4bc93832a06416052e8cddb4d637c..400f68cb05e16b06f38d15a2361b499a888a8f75 100644 (file)
@@ -72,8 +72,41 @@ gsk_vulkan_render_pass_op_command (GskVulkanOp      *op,
                                    VkCommandBuffer   command_buffer)
 {
   GskVulkanRenderPassOp *self = (GskVulkanRenderPassOp *) op;
-
-  return gsk_vulkan_render_draw_pass (render, self->render_pass, op->next, command_buffer);
+  VkPipeline current_pipeline = VK_NULL_HANDLE;
+  const GskVulkanOpClass *current_pipeline_class = NULL;
+  const char *current_pipeline_clip_type = NULL;
+  VkRenderPass vk_render_pass;
+
+  vk_render_pass = gsk_vulkan_render_pass_begin_draw (self->render_pass, render, pipeline_layout, command_buffer);
+
+  op = op->next;
+  while (op && op->op_class->stage != GSK_VULKAN_STAGE_END_PASS)
+    {
+      if (op->op_class->shader_name &&
+          (op->op_class != current_pipeline_class ||
+           current_pipeline_clip_type != op->clip_type))
+        {
+          current_pipeline = gsk_vulkan_render_get_pipeline (render,
+                                                             op->op_class,
+                                                             op->clip_type,
+                                                             gsk_vulkan_image_get_vk_format (self->image),
+                                                             vk_render_pass);
+          vkCmdBindPipeline (command_buffer,
+                             VK_PIPELINE_BIND_POINT_GRAPHICS,
+                             current_pipeline);
+          current_pipeline_class = op->op_class;
+          current_pipeline_clip_type = op->clip_type;
+        }
+
+      op = gsk_vulkan_op_command (op, render, pipeline_layout, command_buffer);
+    }
+
+  if (op && op->op_class->stage == GSK_VULKAN_STAGE_END_PASS)
+    op = gsk_vulkan_op_command (op, render, pipeline_layout, command_buffer);
+  else
+    gsk_vulkan_render_pass_end_draw (self->render_pass, render, pipeline_layout, command_buffer);
+
+  return op;
 }
 
 static const GskVulkanOpClass GSK_VULKAN_RENDER_PASS_OP_CLASS = {
index eb96de005a22ce77123537ab46236ae389a88a02..a040a73723c0c1e3aa7ca5eef2f90aa461d73513 100644 (file)
@@ -54,10 +54,6 @@ guchar *                gsk_vulkan_render_get_buffer_memory             (GskVulk
                                                                          gsize                  *out_offset);
 
 void                    gsk_vulkan_render_draw                          (GskVulkanRender        *self);
-GskVulkanOp *           gsk_vulkan_render_draw_pass                     (GskVulkanRender        *self,
-                                                                         GskVulkanRenderPass    *render_pass,
-                                                                         GskVulkanOp            *op,
-                                                                         VkCommandBuffer         command_buffer);
 
 GdkTexture *            gsk_vulkan_render_download_target               (GskVulkanRender        *self);
 VkFence                 gsk_vulkan_render_get_fence                     (GskVulkanRender        *self);