diff options
author | Benjamin Otte <otte@redhat.com> | 2016-12-31 14:14:26 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2016-12-31 14:37:20 +0100 |
commit | e18d5ca83539d1bce28ded1b79422da37c575209 (patch) | |
tree | b6e16b700fabb51cf433df3e708dff1b1ad127c3 | |
parent | e542d411acc1565fab4a82bc80a13893310e4b84 (diff) | |
download | gtk+-e18d5ca83539d1bce28ded1b79422da37c575209.tar.gz |
vulkan: Add support for color matrix nodes
@keyframes weee {
100% { filter: hue-rotate(1turn); }
}
.background {
animation: linear infinite 3s weee;
}
-rw-r--r-- | gsk/gskvulkanrenderpass.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/gsk/gskvulkanrenderpass.c b/gsk/gskvulkanrenderpass.c index b005607423..b9136bce4e 100644 --- a/gsk/gskvulkanrenderpass.c +++ b/gsk/gskvulkanrenderpass.c @@ -29,6 +29,7 @@ typedef enum { GSK_VULKAN_OP_COLOR, GSK_VULKAN_OP_LINEAR_GRADIENT, GSK_VULKAN_OP_OPACITY, + GSK_VULKAN_OP_COLOR_MATRIX, /* GskVulkanOpPushConstants */ GSK_VULKAN_OP_PUSH_VERTEX_CONSTANTS } GskVulkanOpType; @@ -183,6 +184,20 @@ gsk_vulkan_render_pass_add_node (GskVulkanRenderPass *self, g_array_append_val (self->render_ops, op); return; + case GSK_COLOR_MATRIX_NODE: + if (gsk_vulkan_clip_contains_rect (&constants->clip, &node->bounds)) + pipeline_type = GSK_VULKAN_PIPELINE_COLOR_MATRIX; + else if (constants->clip.type == GSK_VULKAN_CLIP_RECT) + pipeline_type = GSK_VULKAN_PIPELINE_COLOR_MATRIX_CLIP; + else if (constants->clip.type == GSK_VULKAN_CLIP_ROUNDED_CIRCULAR) + pipeline_type = GSK_VULKAN_PIPELINE_COLOR_MATRIX_CLIP_ROUNDED; + else + FALLBACK ("Color matrix nodes can't deal with clip type %u\n", constants->clip.type); + op.type = GSK_VULKAN_OP_COLOR_MATRIX; + op.render.pipeline = gsk_vulkan_render_get_pipeline (render, pipeline_type); + g_array_append_val (self->render_ops, op); + return; + case GSK_CONTAINER_NODE: { guint i; @@ -437,6 +452,18 @@ gsk_vulkan_render_pass_upload (GskVulkanRenderPass *self, } break; + case GSK_VULKAN_OP_COLOR_MATRIX: + { + GskRenderNode *child = gsk_color_matrix_node_get_child (op->render.node); + + op->render.source = gsk_vulkan_render_pass_get_node_as_texture (self, + render, + uploader, + child, + &child->bounds); + } + break; + default: g_assert_not_reached (); case GSK_VULKAN_OP_COLOR: @@ -481,6 +508,7 @@ gsk_vulkan_render_pass_count_vertex_data (GskVulkanRenderPass *self) break; case GSK_VULKAN_OP_OPACITY: + case GSK_VULKAN_OP_COLOR_MATRIX: op->render.vertex_count = gsk_vulkan_effect_pipeline_count_vertex_data (GSK_VULKAN_EFFECT_PIPELINE (op->render.pipeline)); n_bytes += op->render.vertex_count; break; @@ -574,6 +602,17 @@ gsk_vulkan_render_pass_collect_vertex_data (GskVulkanRenderPass *self, } break; + case GSK_VULKAN_OP_COLOR_MATRIX: + { + op->render.vertex_offset = offset + n_bytes; + gsk_vulkan_effect_pipeline_collect_vertex_data (GSK_VULKAN_EFFECT_PIPELINE (op->render.pipeline), + data + n_bytes + offset, + &op->render.node->bounds, + gsk_color_matrix_node_peek_color_matrix (op->render.node), + gsk_color_matrix_node_peek_color_offset (op->render.node)); + n_bytes += op->render.vertex_count; + } + break; default: g_assert_not_reached (); @@ -606,6 +645,7 @@ gsk_vulkan_render_pass_reserve_descriptor_sets (GskVulkanRenderPass *self, case GSK_VULKAN_OP_SURFACE: case GSK_VULKAN_OP_TEXTURE: case GSK_VULKAN_OP_OPACITY: + case GSK_VULKAN_OP_COLOR_MATRIX: op->render.descriptor_set_index = gsk_vulkan_render_reserve_descriptor_set (render, op->render.source); break; @@ -676,6 +716,7 @@ gsk_vulkan_render_pass_draw (GskVulkanRenderPass *self, break; case GSK_VULKAN_OP_OPACITY: + case GSK_VULKAN_OP_COLOR_MATRIX: if (current_pipeline != op->render.pipeline) { current_pipeline = op->render.pipeline; |