summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2017-09-03 09:54:47 -0400
committerMatthias Clasen <mclasen@redhat.com>2017-09-04 22:33:27 -0400
commitbaf90f0c04e7a4a6f3cae994bc758d6b0ed2f4ef (patch)
tree478ece165ad8db280df370a470c33f9092415913
parent86c60592fbfdadaab183e55d17c20572e8b9d674 (diff)
downloadgtk+-wip/matthiasc/blur.tar.gz
A somewhat working blur shaderwip/matthiasc/blur
This is a very direct implementation of a Gaussian blur, without any optimizations.
-rw-r--r--gsk/gskvulkanblurpipeline.c129
-rw-r--r--gsk/gskvulkanblurpipelineprivate.h32
-rw-r--r--gsk/gskvulkanrender.c4
-rw-r--r--gsk/gskvulkanrenderpass.c78
-rw-r--r--gsk/gskvulkanrenderprivate.h3
-rw-r--r--gsk/meson.build1
-rw-r--r--gsk/resources/vulkan/blur-clip-rounded.frag.spvbin0 -> 10812 bytes
-rw-r--r--gsk/resources/vulkan/blur-clip-rounded.vert.spvbin0 -> 5172 bytes
-rw-r--r--gsk/resources/vulkan/blur-clip.frag.spvbin0 -> 4068 bytes
-rw-r--r--gsk/resources/vulkan/blur-clip.vert.spvbin0 -> 5172 bytes
-rw-r--r--gsk/resources/vulkan/blur.frag50
-rw-r--r--gsk/resources/vulkan/blur.frag.glsl13
-rw-r--r--gsk/resources/vulkan/blur.frag.spvbin0 -> 4068 bytes
-rw-r--r--gsk/resources/vulkan/blur.vert41
-rw-r--r--gsk/resources/vulkan/blur.vert.glsl30
-rw-r--r--gsk/resources/vulkan/blur.vert.spvbin0 -> 3440 bytes
-rw-r--r--gsk/resources/vulkan/meson.build2
17 files changed, 383 insertions, 0 deletions
diff --git a/gsk/gskvulkanblurpipeline.c b/gsk/gskvulkanblurpipeline.c
new file mode 100644
index 0000000000..779bf81ec0
--- /dev/null
+++ b/gsk/gskvulkanblurpipeline.c
@@ -0,0 +1,129 @@
+#include "config.h"
+
+#include "gskvulkanblurpipelineprivate.h"
+
+struct _GskVulkanBlurPipeline
+{
+ GObject parent_instance;
+};
+
+typedef struct _GskVulkanBlurInstance GskVulkanBlurInstance;
+
+struct _GskVulkanBlurInstance
+{
+ float rect[4];
+ float tex_rect[4];
+ float blur_radius;
+};
+
+G_DEFINE_TYPE (GskVulkanBlurPipeline, gsk_vulkan_blur_pipeline, GSK_TYPE_VULKAN_PIPELINE)
+
+static const VkPipelineVertexInputStateCreateInfo *
+gsk_vulkan_blur_pipeline_get_input_state_create_info (GskVulkanPipeline *self)
+{
+ static const VkVertexInputBindingDescription vertexBindingDescriptions[] = {
+ {
+ .binding = 0,
+ .stride = sizeof (GskVulkanBlurInstance),
+ .inputRate = VK_VERTEX_INPUT_RATE_INSTANCE
+ }
+ };
+ static const VkVertexInputAttributeDescription vertexInputAttributeDescription[] = {
+ {
+ .location = 0,
+ .binding = 0,
+ .format = VK_FORMAT_R32G32B32A32_SFLOAT,
+ .offset = 0,
+ },
+ {
+ .location = 1,
+ .binding = 0,
+ .format = VK_FORMAT_R32G32B32A32_SFLOAT,
+ .offset = G_STRUCT_OFFSET (GskVulkanBlurInstance, tex_rect),
+ },
+ {
+ .location = 2,
+ .binding = 0,
+ .format = VK_FORMAT_R32_SFLOAT,
+ .offset = G_STRUCT_OFFSET (GskVulkanBlurInstance, blur_radius),
+ }
+ };
+ static const VkPipelineVertexInputStateCreateInfo info = {
+ .sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO,
+ .vertexBindingDescriptionCount = G_N_ELEMENTS (vertexBindingDescriptions),
+ .pVertexBindingDescriptions = vertexBindingDescriptions,
+ .vertexAttributeDescriptionCount = G_N_ELEMENTS (vertexInputAttributeDescription),
+ .pVertexAttributeDescriptions = vertexInputAttributeDescription
+ };
+
+ return &info;
+}
+
+static void
+gsk_vulkan_blur_pipeline_finalize (GObject *gobject)
+{
+ //GskVulkanBlurPipeline *self = GSK_VULKAN_BLUR_PIPELINE (gobject);
+
+ G_OBJECT_CLASS (gsk_vulkan_blur_pipeline_parent_class)->finalize (gobject);
+}
+
+static void
+gsk_vulkan_blur_pipeline_class_init (GskVulkanBlurPipelineClass *klass)
+{
+ GskVulkanPipelineClass *pipeline_class = GSK_VULKAN_PIPELINE_CLASS (klass);
+
+ G_OBJECT_CLASS (klass)->finalize = gsk_vulkan_blur_pipeline_finalize;
+
+ pipeline_class->get_input_state_create_info = gsk_vulkan_blur_pipeline_get_input_state_create_info;
+}
+
+static void
+gsk_vulkan_blur_pipeline_init (GskVulkanBlurPipeline *self)
+{
+}
+
+GskVulkanPipeline *
+gsk_vulkan_blur_pipeline_new (GskVulkanPipelineLayout *layout,
+ const char *shader_name,
+ VkRenderPass render_pass)
+{
+ return gsk_vulkan_pipeline_new (GSK_TYPE_VULKAN_BLUR_PIPELINE, layout, shader_name, render_pass);
+}
+
+gsize
+gsk_vulkan_blur_pipeline_count_vertex_data (GskVulkanBlurPipeline *pipeline)
+{
+ return sizeof (GskVulkanBlurInstance);
+}
+
+void
+gsk_vulkan_blur_pipeline_collect_vertex_data (GskVulkanBlurPipeline *pipeline,
+ guchar *data,
+ const graphene_rect_t *rect,
+ double blur_radius)
+{
+ GskVulkanBlurInstance *instance = (GskVulkanBlurInstance *) data;
+
+ instance->rect[0] = rect->origin.x;
+ instance->rect[1] = rect->origin.y;
+ instance->rect[2] = rect->size.width;
+ instance->rect[3] = rect->size.height;
+ instance->tex_rect[0] = 0.0;
+ instance->tex_rect[1] = 0.0;
+ instance->tex_rect[2] = 1.0;
+ instance->tex_rect[3] = 1.0;
+ instance->blur_radius = blur_radius;
+}
+
+gsize
+gsk_vulkan_blur_pipeline_draw (GskVulkanBlurPipeline *pipeline,
+ VkCommandBuffer command_buffer,
+ gsize offset,
+ gsize n_commands)
+{
+ vkCmdDraw (command_buffer,
+ 6, n_commands,
+ 0, offset);
+
+ return n_commands;
+}
diff --git a/gsk/gskvulkanblurpipelineprivate.h b/gsk/gskvulkanblurpipelineprivate.h
new file mode 100644
index 0000000000..44b139d4bf
--- /dev/null
+++ b/gsk/gskvulkanblurpipelineprivate.h
@@ -0,0 +1,32 @@
+#ifndef __GSK_VULKAN_BLUR_PIPELINE_PRIVATE_H__
+#define __GSK_VULKAN_BLUR_PIPELINE_PRIVATE_H__
+
+#include <graphene.h>
+
+#include "gskvulkanpipelineprivate.h"
+
+G_BEGIN_DECLS
+
+typedef struct _GskVulkanBlurPipelineLayout GskVulkanBlurPipelineLayout;
+
+#define GSK_TYPE_VULKAN_BLUR_PIPELINE (gsk_vulkan_blur_pipeline_get_type ())
+
+G_DECLARE_FINAL_TYPE (GskVulkanBlurPipeline, gsk_vulkan_blur_pipeline, GSK, VULKAN_BLUR_PIPELINE, GskVulkanPipeline)
+
+GskVulkanPipeline * gsk_vulkan_blur_pipeline_new (GskVulkanPipelineLayout *layout,
+ const char *shader_name,
+ VkRenderPass render_pass);
+
+gsize gsk_vulkan_blur_pipeline_count_vertex_data (GskVulkanBlurPipeline *pipeline);
+void gsk_vulkan_blur_pipeline_collect_vertex_data (GskVulkanBlurPipeline *pipeline,
+ guchar *data,
+ const graphene_rect_t *rect,
+ double radius);
+gsize gsk_vulkan_blur_pipeline_draw (GskVulkanBlurPipeline *pipeline,
+ VkCommandBuffer command_buffer,
+ gsize offset,
+ gsize n_commands);
+
+G_END_DECLS
+
+#endif /* __GSK_VULKAN_BLUR_PIPELINE_PRIVATE_H__ */
diff --git a/gsk/gskvulkanrender.c b/gsk/gskvulkanrender.c
index cf98e184e0..4da8e48566 100644
--- a/gsk/gskvulkanrender.c
+++ b/gsk/gskvulkanrender.c
@@ -11,6 +11,7 @@
#include "gskvulkanrenderpassprivate.h"
#include "gskvulkanblendpipelineprivate.h"
+#include "gskvulkanblurpipelineprivate.h"
#include "gskvulkanborderpipelineprivate.h"
#include "gskvulkanboxshadowpipelineprivate.h"
#include "gskvulkancolorpipelineprivate.h"
@@ -340,6 +341,9 @@ gsk_vulkan_render_get_pipeline (GskVulkanRender *self,
{ "outset-shadow", gsk_vulkan_box_shadow_pipeline_new },
{ "outset-shadow-clip", gsk_vulkan_box_shadow_pipeline_new },
{ "outset-shadow-clip-rounded", gsk_vulkan_box_shadow_pipeline_new },
+ { "blur", gsk_vulkan_blur_pipeline_new },
+ { "blur-clip", gsk_vulkan_blur_pipeline_new },
+ { "blur-clip-rounded", gsk_vulkan_blur_pipeline_new },
};
g_return_val_if_fail (type < GSK_VULKAN_N_PIPELINES, NULL);
diff --git a/gsk/gskvulkanrenderpass.c b/gsk/gskvulkanrenderpass.c
index b5bab5f39e..f3b2b0cb92 100644
--- a/gsk/gskvulkanrenderpass.c
+++ b/gsk/gskvulkanrenderpass.c
@@ -7,6 +7,7 @@
#include "gskrenderer.h"
#include "gskroundedrectprivate.h"
#include "gskvulkanblendpipelineprivate.h"
+#include "gskvulkanblurpipelineprivate.h"
#include "gskvulkanborderpipelineprivate.h"
#include "gskvulkanboxshadowpipelineprivate.h"
#include "gskvulkanclipprivate.h"
@@ -31,6 +32,7 @@ typedef enum {
GSK_VULKAN_OP_COLOR,
GSK_VULKAN_OP_LINEAR_GRADIENT,
GSK_VULKAN_OP_OPACITY,
+ GSK_VULKAN_OP_BLUR,
GSK_VULKAN_OP_COLOR_MATRIX,
GSK_VULKAN_OP_BORDER,
GSK_VULKAN_OP_INSET_SHADOW,
@@ -231,6 +233,20 @@ gsk_vulkan_render_pass_add_node (GskVulkanRenderPass *self,
g_array_append_val (self->render_ops, op);
return;
+ case GSK_BLUR_NODE:
+ if (gsk_vulkan_clip_contains_rect (&constants->clip, &node->bounds))
+ pipeline_type = GSK_VULKAN_PIPELINE_BLUR;
+ else if (constants->clip.type == GSK_VULKAN_CLIP_RECT)
+ pipeline_type = GSK_VULKAN_PIPELINE_BLUR_CLIP;
+ else if (constants->clip.type == GSK_VULKAN_CLIP_ROUNDED_CIRCULAR)
+ pipeline_type = GSK_VULKAN_PIPELINE_BLUR_CLIP_ROUNDED;
+ else
+ FALLBACK ("Blur nodes can't deal with clip type %u\n", constants->clip.type);
+ op.type = GSK_VULKAN_OP_BLUR;
+ op.render.pipeline = gsk_vulkan_render_get_pipeline (render, pipeline_type);
+ 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;
@@ -543,6 +559,18 @@ gsk_vulkan_render_pass_upload (GskVulkanRenderPass *self,
}
break;
+ case GSK_VULKAN_OP_BLUR:
+ {
+ GskRenderNode *child = gsk_blur_node_get_child (op->render.node);
+
+ op->render.source = gsk_vulkan_render_pass_get_node_as_texture (self,
+ render,
+ uploader,
+ child,
+ &child->bounds);
+ }
+ break;
+
case GSK_VULKAN_OP_COLOR_MATRIX:
{
GskRenderNode *child = gsk_color_matrix_node_get_child (op->render.node);
@@ -607,6 +635,11 @@ gsk_vulkan_render_pass_count_vertex_data (GskVulkanRenderPass *self)
n_bytes += op->render.vertex_count;
break;
+ case GSK_VULKAN_OP_BLUR:
+ op->render.vertex_count = gsk_vulkan_blur_pipeline_count_vertex_data (GSK_VULKAN_BLUR_PIPELINE (op->render.pipeline));
+ n_bytes += op->render.vertex_count;
+ break;
+
case GSK_VULKAN_OP_BORDER:
op->render.vertex_count = gsk_vulkan_border_pipeline_count_vertex_data (GSK_VULKAN_BORDER_PIPELINE (op->render.pipeline));
n_bytes += op->render.vertex_count;
@@ -707,6 +740,17 @@ gsk_vulkan_render_pass_collect_vertex_data (GskVulkanRenderPass *self,
}
break;
+ case GSK_VULKAN_OP_BLUR:
+ {
+ op->render.vertex_offset = offset + n_bytes;
+ gsk_vulkan_blur_pipeline_collect_vertex_data (GSK_VULKAN_BLUR_PIPELINE (op->render.pipeline),
+ data + n_bytes + offset,
+ &op->render.node->bounds,
+ gsk_blur_node_get_radius (op->render.node));
+ n_bytes += op->render.vertex_count;
+ }
+ break;
+
case GSK_VULKAN_OP_COLOR_MATRIX:
{
op->render.vertex_offset = offset + n_bytes;
@@ -792,6 +836,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_BLUR:
case GSK_VULKAN_OP_COLOR_MATRIX:
op->render.descriptor_set_index = gsk_vulkan_render_reserve_descriptor_set (render, op->render.source);
break;
@@ -899,6 +944,39 @@ gsk_vulkan_render_pass_draw (GskVulkanRenderPass *self,
current_draw_index, 1);
break;
+ case GSK_VULKAN_OP_BLUR:
+ 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),
+ 0,
+ 1,
+ (VkDescriptorSet[1]) {
+ gsk_vulkan_render_get_descriptor_set (render, op->render.descriptor_set_index)
+ },
+ 0,
+ NULL);
+
+ current_draw_index += gsk_vulkan_blur_pipeline_draw (GSK_VULKAN_BLUR_PIPELINE (current_pipeline),
+ command_buffer,
+ current_draw_index, 1);
+ break;
+
case GSK_VULKAN_OP_COLOR:
if (current_pipeline != op->render.pipeline)
{
diff --git a/gsk/gskvulkanrenderprivate.h b/gsk/gskvulkanrenderprivate.h
index 29860f086e..4c01e82e9a 100644
--- a/gsk/gskvulkanrenderprivate.h
+++ b/gsk/gskvulkanrenderprivate.h
@@ -31,6 +31,9 @@ typedef enum {
GSK_VULKAN_PIPELINE_OUTSET_SHADOW,
GSK_VULKAN_PIPELINE_OUTSET_SHADOW_CLIP,
GSK_VULKAN_PIPELINE_OUTSET_SHADOW_CLIP_ROUNDED,
+ GSK_VULKAN_PIPELINE_BLUR,
+ GSK_VULKAN_PIPELINE_BLUR_CLIP,
+ GSK_VULKAN_PIPELINE_BLUR_CLIP_ROUNDED,
/* add more */
GSK_VULKAN_N_PIPELINES
} GskVulkanPipelineType;
diff --git a/gsk/meson.build b/gsk/meson.build
index 83be577f1f..7725171ae9 100644
--- a/gsk/meson.build
+++ b/gsk/meson.build
@@ -50,6 +50,7 @@ gsk_private_vulkan_compiled_shaders = []
if have_vulkan
gsk_private_sources += files([
'gskvulkanblendpipeline.c',
+ 'gskvulkanblurpipeline.c',
'gskvulkanborderpipeline.c',
'gskvulkanboxshadowpipeline.c',
'gskvulkanbuffer.c',
diff --git a/gsk/resources/vulkan/blur-clip-rounded.frag.spv b/gsk/resources/vulkan/blur-clip-rounded.frag.spv
new file mode 100644
index 0000000000..bdec4c9e9b
--- /dev/null
+++ b/gsk/resources/vulkan/blur-clip-rounded.frag.spv
Binary files differ
diff --git a/gsk/resources/vulkan/blur-clip-rounded.vert.spv b/gsk/resources/vulkan/blur-clip-rounded.vert.spv
new file mode 100644
index 0000000000..2e3c5ff522
--- /dev/null
+++ b/gsk/resources/vulkan/blur-clip-rounded.vert.spv
Binary files differ
diff --git a/gsk/resources/vulkan/blur-clip.frag.spv b/gsk/resources/vulkan/blur-clip.frag.spv
new file mode 100644
index 0000000000..d6619c9246
--- /dev/null
+++ b/gsk/resources/vulkan/blur-clip.frag.spv
Binary files differ
diff --git a/gsk/resources/vulkan/blur-clip.vert.spv b/gsk/resources/vulkan/blur-clip.vert.spv
new file mode 100644
index 0000000000..2e3c5ff522
--- /dev/null
+++ b/gsk/resources/vulkan/blur-clip.vert.spv
Binary files differ
diff --git a/gsk/resources/vulkan/blur.frag b/gsk/resources/vulkan/blur.frag
new file mode 100644
index 0000000000..2dd584b0c6
--- /dev/null
+++ b/gsk/resources/vulkan/blur.frag
@@ -0,0 +1,50 @@
+#version 420 core
+
+#include "clip.frag.glsl"
+
+layout(location = 0) in vec2 inPos;
+layout(location = 1) in flat vec2 inSize;
+layout(location = 2) in vec2 inTexCoord;
+layout(location = 3) in float inRadius;
+
+layout(set = 0, binding = 0) uniform sampler2D inTexture;
+
+layout(location = 0) out vec4 color;
+
+const int samples_x = 15; // must be odd
+const int samples_y = 15; // must be odd
+
+const int half_samples_x = samples_x / 2;
+const int half_samples_y = samples_y / 2;
+
+float Gaussian (float sigma, float x)
+{
+ return exp ( - (x * x) / (2.0 * sigma * sigma));
+}
+
+vec4 blur_pixel (in vec2 uv)
+{
+ float total = 0.0;
+ vec4 ret = vec4 (0);
+ float pixel_size_x = (1.0 / inSize.x);
+ float pixel_size_y = (1.0 / inSize.y);
+
+ for (int y = 0; y < samples_y; ++y)
+ {
+ float fy = Gaussian (inRadius, float(y) - float(half_samples_x));
+ float offset_y = float(y - half_samples_y) * pixel_size_y;
+ for (int x = 0; x < samples_x; ++x)
+ {
+ float fx = Gaussian (inRadius, float(x) - float(half_samples_x));
+ float offset_x = float(x - half_samples_x) * pixel_size_x;
+ total += fx * fy;
+ ret += texture(inTexture, uv + vec2(offset_x, offset_y)) * fx * fy;
+ }
+ }
+ return ret / total;
+}
+
+void main()
+{
+ color = clip (inPos, blur_pixel (inTexCoord));
+}
diff --git a/gsk/resources/vulkan/blur.frag.glsl b/gsk/resources/vulkan/blur.frag.glsl
new file mode 100644
index 0000000000..528db202b0
--- /dev/null
+++ b/gsk/resources/vulkan/blur.frag.glsl
@@ -0,0 +1,13 @@
+#version 420 core
+
+#include "clip.frag.glsl"
+
+layout(location = 0) in vec2 inPos;
+layout(location = 1) in float inRadius;
+
+layout(location = 0) out vec4 color;
+
+void main()
+{
+ color = clip (inPos, vec4(1, 0, 0, 0));
+}
diff --git a/gsk/resources/vulkan/blur.frag.spv b/gsk/resources/vulkan/blur.frag.spv
new file mode 100644
index 0000000000..d6619c9246
--- /dev/null
+++ b/gsk/resources/vulkan/blur.frag.spv
Binary files differ
diff --git a/gsk/resources/vulkan/blur.vert b/gsk/resources/vulkan/blur.vert
new file mode 100644
index 0000000000..4a5a138af8
--- /dev/null
+++ b/gsk/resources/vulkan/blur.vert
@@ -0,0 +1,41 @@
+
+#version 420 core
+
+#include "clip.vert.glsl"
+
+layout(location = 0) in vec4 inRect;
+layout(location = 1) in vec4 inTexRect;
+layout(location = 2) in float inRadius;
+
+layout(location = 0) out vec2 outPos;
+layout(location = 1) out flat vec2 outSize;
+layout(location = 2) out vec2 outTexCoord;
+layout(location = 3) out flat float outRadius;
+
+out gl_PerVertex {
+ vec4 gl_Position;
+};
+
+vec2 offsets[6] = { vec2(0.0, 0.0),
+ vec2(1.0, 0.0),
+ vec2(0.0, 1.0),
+ vec2(0.0, 1.0),
+ vec2(1.0, 0.0),
+ vec2(1.0, 1.0) };
+
+void main() {
+ vec4 rect = clip (inRect);
+ vec2 pos = rect.xy + rect.zw * offsets[gl_VertexIndex];
+ gl_Position = push.mvp * vec4 (pos, 0.0, 1.0);
+
+ outPos = pos;
+ outSize = inRect.zw;
+
+ vec4 texrect = vec4((rect.xy - inRect.xy) / inRect.zw,
+ rect.zw / inRect.zw);
+ texrect = vec4(inTexRect.xy + inTexRect.zw * texrect.xy,
+ inTexRect.zw * texrect.zw);
+ outTexCoord = texrect.xy + texrect.zw * offsets[gl_VertexIndex];
+
+ outRadius = inRadius;
+}
diff --git a/gsk/resources/vulkan/blur.vert.glsl b/gsk/resources/vulkan/blur.vert.glsl
new file mode 100644
index 0000000000..f50ca37980
--- /dev/null
+++ b/gsk/resources/vulkan/blur.vert.glsl
@@ -0,0 +1,30 @@
+#version 420 core
+
+#include "clip.vert.glsl"
+
+layout(location = 0) in vec4 inRect;
+layout(location = 1) in float inRadius;
+
+layout(location = 0) out vec2 outPos;
+layout(location = 1) out flat float outRadius;
+
+out gl_PerVertex {
+ vec4 gl_Position;
+};
+
+vec2 offsets[6] = { vec2(0.0, 0.0),
+ vec2(1.0, 0.0),
+ vec2(0.0, 1.0),
+ vec2(0.0, 1.0),
+ vec2(1.0, 0.0),
+ vec2(1.0, 1.0) };
+
+void main() {
+ vec4 rect = clip (inRect);
+
+ vec2 pos = rect.xy + rect.zw * offsets[gl_VertexIndex];
+ gl_Position = push.mvp * vec4 (pos, 0.0, 1.0);
+ outPos = pos;
+ outRadius = inRadius;
+}
+
diff --git a/gsk/resources/vulkan/blur.vert.spv b/gsk/resources/vulkan/blur.vert.spv
new file mode 100644
index 0000000000..f83b77a2e7
--- /dev/null
+++ b/gsk/resources/vulkan/blur.vert.spv
Binary files differ
diff --git a/gsk/resources/vulkan/meson.build b/gsk/resources/vulkan/meson.build
index 8595ccf605..bdca123ed6 100644
--- a/gsk/resources/vulkan/meson.build
+++ b/gsk/resources/vulkan/meson.build
@@ -8,6 +8,7 @@
gsk_private_vulkan_fragment_shaders = [
'blend.frag',
+ 'blur.frag',
'border.frag',
'color.frag',
'color-matrix.frag',
@@ -18,6 +19,7 @@ gsk_private_vulkan_fragment_shaders = [
gsk_private_vulkan_vertex_shaders = [
'blend.vert',
+ 'blur.vert',
'border.vert',
'color.vert',
'color-matrix.vert',