summaryrefslogtreecommitdiff
path: root/gsk/gskvulkanrenderpass.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2016-12-18 02:18:01 +0100
committerBenjamin Otte <otte@redhat.com>2016-12-20 18:01:11 +0100
commitb4f04d0c1dcc4d61ebdc9e3840fc3a3c6151c382 (patch)
treea03af4d0419f27a27cee3f291be5b91c042be175 /gsk/gskvulkanrenderpass.c
parente68b18aa4e38c86b934710d3004115833c651334 (diff)
downloadgtk+-b4f04d0c1dcc4d61ebdc9e3840fc3a3c6151c382.tar.gz
vulkan: Split color and blend pipelines
Diffstat (limited to 'gsk/gskvulkanrenderpass.c')
-rw-r--r--gsk/gskvulkanrenderpass.c46
1 files changed, 42 insertions, 4 deletions
diff --git a/gsk/gskvulkanrenderpass.c b/gsk/gskvulkanrenderpass.c
index 0300cac093..337b6adbff 100644
--- a/gsk/gskvulkanrenderpass.c
+++ b/gsk/gskvulkanrenderpass.c
@@ -3,6 +3,7 @@
#include "gskvulkanrenderpassprivate.h"
#include "gskvulkanblendpipelineprivate.h"
+#include "gskvulkancolorpipelineprivate.h"
#include "gskvulkanimageprivate.h"
#include "gskrendernodeprivate.h"
#include "gskrenderer.h"
@@ -272,11 +273,15 @@ gsk_vulkan_render_pass_count_vertex_data (GskVulkanRenderPass *self)
case GSK_VULKAN_OP_FALLBACK:
case GSK_VULKAN_OP_SURFACE:
case GSK_VULKAN_OP_TEXTURE:
- case GSK_VULKAN_OP_COLOR:
op->render.vertex_count = gsk_vulkan_blend_pipeline_count_vertex_data (GSK_VULKAN_BLEND_PIPELINE (op->render.pipeline));
n_bytes += op->render.vertex_count;
break;
+ case GSK_VULKAN_OP_COLOR:
+ op->render.vertex_count = gsk_vulkan_color_pipeline_count_vertex_data (GSK_VULKAN_COLOR_PIPELINE (op->render.pipeline));
+ n_bytes += op->render.vertex_count;
+ break;
+
default:
g_assert_not_reached ();
case GSK_VULKAN_OP_PUSH_VERTEX_CONSTANTS:
@@ -308,7 +313,6 @@ gsk_vulkan_render_pass_collect_vertex_data (GskVulkanRenderPass *self,
case GSK_VULKAN_OP_FALLBACK:
case GSK_VULKAN_OP_SURFACE:
case GSK_VULKAN_OP_TEXTURE:
- case GSK_VULKAN_OP_COLOR:
{
graphene_rect_t bounds;
@@ -321,6 +325,19 @@ gsk_vulkan_render_pass_collect_vertex_data (GskVulkanRenderPass *self,
}
break;
+ case GSK_VULKAN_OP_COLOR:
+ {
+ graphene_rect_t bounds;
+
+ gsk_render_node_get_bounds (op->render.node, &bounds);
+ op->render.vertex_offset = offset + n_bytes;
+ gsk_vulkan_color_pipeline_collect_vertex_data (GSK_VULKAN_COLOR_PIPELINE (op->render.pipeline),
+ data + n_bytes + offset,
+ &bounds);
+ n_bytes += op->render.vertex_count;
+ }
+ break;
+
default:
g_assert_not_reached ();
case GSK_VULKAN_OP_PUSH_VERTEX_CONSTANTS:
@@ -384,6 +401,22 @@ gsk_vulkan_render_pass_draw (GskVulkanRenderPass *self,
case GSK_VULKAN_OP_FALLBACK:
case GSK_VULKAN_OP_SURFACE:
case GSK_VULKAN_OP_TEXTURE:
+ if (current_pipeline != op->render.pipeline)
+ {
+ current_pipeline = op->render.pipeline;
+ vkCmdBindPipeline (command_buffer,
+ VK_PIPELINE_BIND_POINT_GRAPHICS,
+ gsk_vulkan_pipeline_get_pipeline (current_pipeline));
+ vkCmdBindVertexBuffers (command_buffer,
+ 0,
+ 1,
+ (VkBuffer[1]) {
+ gsk_vulkan_buffer_get_buffer (vertex_buffer)
+ },
+ (VkDeviceSize[1]) { op->render.vertex_offset });
+ current_draw_index = 0;
+ }
+
vkCmdBindDescriptorSets (command_buffer,
VK_PIPELINE_BIND_POINT_GRAPHICS,
gsk_vulkan_pipeline_layout_get_pipeline_layout (layout),
@@ -394,7 +427,12 @@ gsk_vulkan_render_pass_draw (GskVulkanRenderPass *self,
},
0,
NULL);
- /* fall through */
+
+ current_draw_index += gsk_vulkan_blend_pipeline_draw (GSK_VULKAN_BLEND_PIPELINE (current_pipeline),
+ command_buffer,
+ current_draw_index, 1);
+ break;
+
case GSK_VULKAN_OP_COLOR:
if (current_pipeline != op->render.pipeline)
{
@@ -412,7 +450,7 @@ gsk_vulkan_render_pass_draw (GskVulkanRenderPass *self,
current_draw_index = 0;
}
- current_draw_index += gsk_vulkan_blend_pipeline_draw (GSK_VULKAN_BLEND_PIPELINE (current_pipeline),
+ current_draw_index += gsk_vulkan_color_pipeline_draw (GSK_VULKAN_COLOR_PIPELINE (current_pipeline),
command_buffer,
current_draw_index, 1);
break;