[gtk+] vulkan: Move push constants into their own header



commit c7d899c535afce21e0d2ffea94520a2625e4da80
Author: Benjamin Otte <otte redhat com>
Date:   Tue Jan 17 02:20:08 2017 +0100

    vulkan: Move push constants into their own header
    
    This is the first step towards easing maintenance of the Vulkan shaders
    by moving common code into headers.

 gsk/Makefile.am                                    |    1 +
 gsk/resources/vulkan/blend-clip-rounded.vert.glsl  |    9 ++-------
 gsk/resources/vulkan/blend-clip-rounded.vert.spv   |  Bin 4940 -> 4940 bytes
 gsk/resources/vulkan/blend-clip.vert.glsl          |    9 ++-------
 gsk/resources/vulkan/blend-clip.vert.spv           |  Bin 4604 -> 4604 bytes
 gsk/resources/vulkan/blend.vert.glsl               |    9 ++-------
 gsk/resources/vulkan/blend.vert.spv                |  Bin 1964 -> 1964 bytes
 gsk/resources/vulkan/border-clip-rounded.vert.glsl |    9 ++-------
 gsk/resources/vulkan/border-clip-rounded.vert.spv  |  Bin 9312 -> 9312 bytes
 gsk/resources/vulkan/border-clip.vert.glsl         |    9 ++-------
 gsk/resources/vulkan/border-clip.vert.spv          |  Bin 8952 -> 8952 bytes
 gsk/resources/vulkan/border.vert.glsl              |    9 ++-------
 gsk/resources/vulkan/border.vert.spv               |  Bin 7216 -> 7216 bytes
 gsk/resources/vulkan/color-clip-rounded.vert.glsl  |    9 ++-------
 gsk/resources/vulkan/color-clip-rounded.vert.spv   |  Bin 2176 -> 2176 bytes
 gsk/resources/vulkan/color-clip.vert.glsl          |    9 ++-------
 gsk/resources/vulkan/color-clip.vert.spv           |  Bin 3588 -> 3588 bytes
 .../vulkan/color-matrix-clip-rounded.vert.glsl     |    9 ++-------
 .../vulkan/color-matrix-clip-rounded.vert.spv      |  Bin 5292 -> 5292 bytes
 gsk/resources/vulkan/color-matrix-clip.vert.glsl   |    9 ++-------
 gsk/resources/vulkan/color-matrix-clip.vert.spv    |  Bin 4956 -> 4956 bytes
 gsk/resources/vulkan/color-matrix.vert.glsl        |    9 ++-------
 gsk/resources/vulkan/color-matrix.vert.spv         |  Bin 2316 -> 2316 bytes
 gsk/resources/vulkan/color.vert.glsl               |    9 ++-------
 gsk/resources/vulkan/color.vert.spv                |  Bin 1780 -> 1780 bytes
 gsk/resources/vulkan/constants.glsl                |   11 +++++++++++
 gsk/resources/vulkan/linear-clip-rounded.vert.glsl |    9 ++-------
 gsk/resources/vulkan/linear-clip-rounded.vert.spv  |  Bin 6208 -> 6208 bytes
 gsk/resources/vulkan/linear-clip.vert.glsl         |    9 ++-------
 gsk/resources/vulkan/linear-clip.vert.spv          |  Bin 5856 -> 5856 bytes
 gsk/resources/vulkan/linear.vert.glsl              |    9 ++-------
 gsk/resources/vulkan/linear.vert.spv               |  Bin 7648 -> 7648 bytes
 32 files changed, 42 insertions(+), 105 deletions(-)
---
diff --git a/gsk/Makefile.am b/gsk/Makefile.am
index d665e1d..3814845 100644
--- a/gsk/Makefile.am
+++ b/gsk/Makefile.am
@@ -58,6 +58,7 @@ gsk_private_vulkan_source_c = \
        gskvulkanrenderpass.c \
        gskvulkanshader.c
 gsk_private_vulkan_include_shaders = \
+       resources/vulkan/constants.glsl \
        resources/vulkan/rounded-rect.glsl
 gsk_private_vulkan_shaders = \
        resources/vulkan/blend-clip.frag.glsl \
diff --git a/gsk/resources/vulkan/blend-clip-rounded.vert.glsl 
b/gsk/resources/vulkan/blend-clip-rounded.vert.glsl
index c680c65..221cbbe 100644
--- a/gsk/resources/vulkan/blend-clip-rounded.vert.glsl
+++ b/gsk/resources/vulkan/blend-clip-rounded.vert.glsl
@@ -1,15 +1,10 @@
 #version 420 core
 
+#include "constants.glsl"
+
 layout(location = 0) in vec4 inRect;
 layout(location = 1) in vec4 inTexRect;
 
-layout(push_constant) uniform PushConstants {
-    mat4 mvp;
-    vec4 clip_bounds;
-    vec4 clip_widths;
-    vec4 clip_heights;
-} push;
-
 layout(location = 0) out vec2 outPos;
 layout(location = 1) out vec2 outTexCoord;
 layout(location = 2) out flat vec4 outClipBounds;
diff --git a/gsk/resources/vulkan/blend-clip-rounded.vert.spv 
b/gsk/resources/vulkan/blend-clip-rounded.vert.spv
index 0c27a6b..2a2d7ce 100644
Binary files a/gsk/resources/vulkan/blend-clip-rounded.vert.spv and 
b/gsk/resources/vulkan/blend-clip-rounded.vert.spv differ
diff --git a/gsk/resources/vulkan/blend-clip.vert.glsl b/gsk/resources/vulkan/blend-clip.vert.glsl
index 0d66a2d..b1c622b 100644
--- a/gsk/resources/vulkan/blend-clip.vert.glsl
+++ b/gsk/resources/vulkan/blend-clip.vert.glsl
@@ -1,15 +1,10 @@
 #version 420 core
 
+#include "constants.glsl"
+
 layout(location = 0) in vec4 inRect;
 layout(location = 1) in vec4 inTexRect;
 
-layout(push_constant) uniform PushConstants {
-    mat4 mvp;
-    vec4 clip_bounds;
-    vec4 clip_widths;
-    vec4 clip_heights;
-} push;
-
 layout(location = 0) out vec2 outTexCoord;
 
 out gl_PerVertex {
diff --git a/gsk/resources/vulkan/blend-clip.vert.spv b/gsk/resources/vulkan/blend-clip.vert.spv
index a12f3c8..494f916 100644
Binary files a/gsk/resources/vulkan/blend-clip.vert.spv and b/gsk/resources/vulkan/blend-clip.vert.spv differ
diff --git a/gsk/resources/vulkan/blend.vert.glsl b/gsk/resources/vulkan/blend.vert.glsl
index 30c1474..17be873 100644
--- a/gsk/resources/vulkan/blend.vert.glsl
+++ b/gsk/resources/vulkan/blend.vert.glsl
@@ -1,15 +1,10 @@
 #version 420 core
 
+#include "constants.glsl"
+
 layout(location = 0) in vec4 inRect;
 layout(location = 1) in vec4 inTexRect;
 
-layout(push_constant) uniform PushConstants {
-    mat4 mvp;
-    vec4 clip_bounds;
-    vec4 clip_widths;
-    vec4 clip_heights;
-} push;
-
 layout(location = 0) out vec2 outTexCoord;
 
 out gl_PerVertex {
diff --git a/gsk/resources/vulkan/blend.vert.spv b/gsk/resources/vulkan/blend.vert.spv
index dafd915..962a1b4 100644
Binary files a/gsk/resources/vulkan/blend.vert.spv and b/gsk/resources/vulkan/blend.vert.spv differ
diff --git a/gsk/resources/vulkan/border-clip-rounded.vert.glsl 
b/gsk/resources/vulkan/border-clip-rounded.vert.glsl
index 8939a95..a66d7f7 100644
--- a/gsk/resources/vulkan/border-clip-rounded.vert.glsl
+++ b/gsk/resources/vulkan/border-clip-rounded.vert.glsl
@@ -1,18 +1,13 @@
 #version 420 core
 
+#include "constants.glsl"
+
 layout(location = 0) in vec4 inRect;
 layout(location = 1) in vec4 inCornerWidths;
 layout(location = 2) in vec4 inCornerHeights;
 layout(location = 3) in vec4 inBorderWidths;
 layout(location = 4) in mat4 inBorderColors;
 
-layout(push_constant) uniform PushConstants {
-    mat4 mvp;
-    vec4 clip_bounds;
-    vec4 clip_widths;
-    vec4 clip_heights;
-} push;
-
 layout(location = 0) out vec2 outPos;
 layout(location = 1) out flat vec4 outColor;
 layout(location = 2) out flat vec4 outRect;
diff --git a/gsk/resources/vulkan/border-clip-rounded.vert.spv 
b/gsk/resources/vulkan/border-clip-rounded.vert.spv
index 5aae91a..5271686 100644
Binary files a/gsk/resources/vulkan/border-clip-rounded.vert.spv and 
b/gsk/resources/vulkan/border-clip-rounded.vert.spv differ
diff --git a/gsk/resources/vulkan/border-clip.vert.glsl b/gsk/resources/vulkan/border-clip.vert.glsl
index 5de7a12..8db91a5 100644
--- a/gsk/resources/vulkan/border-clip.vert.glsl
+++ b/gsk/resources/vulkan/border-clip.vert.glsl
@@ -1,18 +1,13 @@
 #version 420 core
 
+#include "constants.glsl"
+
 layout(location = 0) in vec4 inRect;
 layout(location = 1) in vec4 inCornerWidths;
 layout(location = 2) in vec4 inCornerHeights;
 layout(location = 3) in vec4 inBorderWidths;
 layout(location = 4) in mat4 inBorderColors;
 
-layout(push_constant) uniform PushConstants {
-    mat4 mvp;
-    vec4 clip_bounds;
-    vec4 clip_widths;
-    vec4 clip_heights;
-} push;
-
 layout(location = 0) out vec2 outPos;
 layout(location = 1) out flat vec4 outColor;
 layout(location = 2) out flat vec4 outRect;
diff --git a/gsk/resources/vulkan/border-clip.vert.spv b/gsk/resources/vulkan/border-clip.vert.spv
index 5a505d8..ce5e85e 100644
Binary files a/gsk/resources/vulkan/border-clip.vert.spv and b/gsk/resources/vulkan/border-clip.vert.spv 
differ
diff --git a/gsk/resources/vulkan/border.vert.glsl b/gsk/resources/vulkan/border.vert.glsl
index 48efbc7..744f500 100644
--- a/gsk/resources/vulkan/border.vert.glsl
+++ b/gsk/resources/vulkan/border.vert.glsl
@@ -1,18 +1,13 @@
 #version 420 core
 
+#include "constants.glsl"
+
 layout(location = 0) in vec4 inRect;
 layout(location = 1) in vec4 inCornerWidths;
 layout(location = 2) in vec4 inCornerHeights;
 layout(location = 3) in vec4 inBorderWidths;
 layout(location = 4) in mat4 inBorderColors;
 
-layout(push_constant) uniform PushConstants {
-    mat4 mvp;
-    vec4 clip_bounds;
-    vec4 clip_widths;
-    vec4 clip_heights;
-} push;
-
 layout(location = 0) out vec2 outPos;
 layout(location = 1) out flat vec4 outColor;
 layout(location = 2) out flat vec4 outRect;
diff --git a/gsk/resources/vulkan/border.vert.spv b/gsk/resources/vulkan/border.vert.spv
index 384eebe..6a6cf93 100644
Binary files a/gsk/resources/vulkan/border.vert.spv and b/gsk/resources/vulkan/border.vert.spv differ
diff --git a/gsk/resources/vulkan/color-clip-rounded.vert.glsl 
b/gsk/resources/vulkan/color-clip-rounded.vert.glsl
index a3c5535..2303d90 100644
--- a/gsk/resources/vulkan/color-clip-rounded.vert.glsl
+++ b/gsk/resources/vulkan/color-clip-rounded.vert.glsl
@@ -1,15 +1,10 @@
 #version 420 core
 
+#include "constants.glsl"
+
 layout(location = 0) in vec4 inRect;
 layout(location = 1) in vec4 inColor;
 
-layout(push_constant) uniform PushConstants {
-    mat4 mvp;
-    vec4 clip_bounds;
-    vec4 clip_widths;
-    vec4 clip_heights;
-} push;
-
 layout(location = 0) out vec2 outPos;
 layout(location = 1) out flat vec4 outColor;
 layout(location = 2) out flat vec4 outClipBounds;
diff --git a/gsk/resources/vulkan/color-clip-rounded.vert.spv 
b/gsk/resources/vulkan/color-clip-rounded.vert.spv
index 4414e99..b283554 100644
Binary files a/gsk/resources/vulkan/color-clip-rounded.vert.spv and 
b/gsk/resources/vulkan/color-clip-rounded.vert.spv differ
diff --git a/gsk/resources/vulkan/color-clip.vert.glsl b/gsk/resources/vulkan/color-clip.vert.glsl
index b893217..724cee1 100644
--- a/gsk/resources/vulkan/color-clip.vert.glsl
+++ b/gsk/resources/vulkan/color-clip.vert.glsl
@@ -1,15 +1,10 @@
 #version 420 core
 
+#include "constants.glsl"
+
 layout(location = 0) in vec4 inRect;
 layout(location = 1) in vec4 inColor;
 
-layout(push_constant) uniform PushConstants {
-    mat4 mvp;
-    vec4 clip_bounds;
-    vec4 clip_widths;
-    vec4 clip_heights;
-} push;
-
 out gl_PerVertex {
   vec4 gl_Position;
 };
diff --git a/gsk/resources/vulkan/color-clip.vert.spv b/gsk/resources/vulkan/color-clip.vert.spv
index 0089004..c07e45f 100644
Binary files a/gsk/resources/vulkan/color-clip.vert.spv and b/gsk/resources/vulkan/color-clip.vert.spv differ
diff --git a/gsk/resources/vulkan/color-matrix-clip-rounded.vert.glsl 
b/gsk/resources/vulkan/color-matrix-clip-rounded.vert.glsl
index 2875e63..5d3e340 100644
--- a/gsk/resources/vulkan/color-matrix-clip-rounded.vert.glsl
+++ b/gsk/resources/vulkan/color-matrix-clip-rounded.vert.glsl
@@ -1,17 +1,12 @@
 #version 420 core
 
+#include "constants.glsl"
+
 layout(location = 0) in vec4 inRect;
 layout(location = 1) in vec4 inTexRect;
 layout(location = 2) in mat4 inColorMatrix;
 layout(location = 6) in vec4 inColorOffset;
 
-layout(push_constant) uniform PushConstants {
-    mat4 mvp;
-    vec4 clip_bounds;
-    vec4 clip_widths;
-    vec4 clip_heights;
-} push;
-
 layout(location = 0) out vec2 outPos;
 layout(location = 1) out vec2 outTexCoord;
 layout(location = 2) out flat vec4 outClipBounds;
diff --git a/gsk/resources/vulkan/color-matrix-clip-rounded.vert.spv 
b/gsk/resources/vulkan/color-matrix-clip-rounded.vert.spv
index 49271e4..d4db483 100644
Binary files a/gsk/resources/vulkan/color-matrix-clip-rounded.vert.spv and 
b/gsk/resources/vulkan/color-matrix-clip-rounded.vert.spv differ
diff --git a/gsk/resources/vulkan/color-matrix-clip.vert.glsl 
b/gsk/resources/vulkan/color-matrix-clip.vert.glsl
index 94d4ef8..7f9b778 100644
--- a/gsk/resources/vulkan/color-matrix-clip.vert.glsl
+++ b/gsk/resources/vulkan/color-matrix-clip.vert.glsl
@@ -1,17 +1,12 @@
 #version 420 core
 
+#include "constants.glsl"
+
 layout(location = 0) in vec4 inRect;
 layout(location = 1) in vec4 inTexRect;
 layout(location = 2) in mat4 inColorMatrix;
 layout(location = 6) in vec4 inColorOffset;
 
-layout(push_constant) uniform PushConstants {
-    mat4 mvp;
-    vec4 clip_bounds;
-    vec4 clip_widths;
-    vec4 clip_heights;
-} push;
-
 layout(location = 0) out vec2 outTexCoord;
 layout(location = 1) out flat mat4 outColorMatrix;
 layout(location = 5) out flat vec4 outColorOffset;
diff --git a/gsk/resources/vulkan/color-matrix-clip.vert.spv b/gsk/resources/vulkan/color-matrix-clip.vert.spv
index 6648e24..84c3846 100644
Binary files a/gsk/resources/vulkan/color-matrix-clip.vert.spv and 
b/gsk/resources/vulkan/color-matrix-clip.vert.spv differ
diff --git a/gsk/resources/vulkan/color-matrix.vert.glsl b/gsk/resources/vulkan/color-matrix.vert.glsl
index 20b3bbd..ac1ccc0 100644
--- a/gsk/resources/vulkan/color-matrix.vert.glsl
+++ b/gsk/resources/vulkan/color-matrix.vert.glsl
@@ -1,17 +1,12 @@
 #version 420 core
 
+#include "constants.glsl"
+
 layout(location = 0) in vec4 inRect;
 layout(location = 1) in vec4 inTexRect;
 layout(location = 2) in mat4 inColorMatrix;
 layout(location = 6) in vec4 inColorOffset;
 
-layout(push_constant) uniform PushConstants {
-    mat4 mvp;
-    vec4 clip_bounds;
-    vec4 clip_widths;
-    vec4 clip_heights;
-} push;
-
 layout(location = 0) out vec2 outTexCoord;
 layout(location = 1) out flat mat4 outColorMatrix;
 layout(location = 5) out flat vec4 outColorOffset;
diff --git a/gsk/resources/vulkan/color-matrix.vert.spv b/gsk/resources/vulkan/color-matrix.vert.spv
index 2985b74..fa89276 100644
Binary files a/gsk/resources/vulkan/color-matrix.vert.spv and b/gsk/resources/vulkan/color-matrix.vert.spv 
differ
diff --git a/gsk/resources/vulkan/color.vert.glsl b/gsk/resources/vulkan/color.vert.glsl
index 873ccfc..ab71cda 100644
--- a/gsk/resources/vulkan/color.vert.glsl
+++ b/gsk/resources/vulkan/color.vert.glsl
@@ -1,15 +1,10 @@
 #version 420 core
 
+#include "constants.glsl"
+
 layout(location = 0) in vec4 inRect;
 layout(location = 1) in vec4 inColor;
 
-layout(push_constant) uniform PushConstants {
-    mat4 mvp;
-    vec4 clip_bounds;
-    vec4 clip_widths;
-    vec4 clip_heights;
-} push;
-
 layout(location = 0) out vec4 outColor;
 
 out gl_PerVertex {
diff --git a/gsk/resources/vulkan/color.vert.spv b/gsk/resources/vulkan/color.vert.spv
index 0d571ef..05d74a6 100644
Binary files a/gsk/resources/vulkan/color.vert.spv and b/gsk/resources/vulkan/color.vert.spv differ
diff --git a/gsk/resources/vulkan/constants.glsl b/gsk/resources/vulkan/constants.glsl
new file mode 100644
index 0000000..427f42b
--- /dev/null
+++ b/gsk/resources/vulkan/constants.glsl
@@ -0,0 +1,11 @@
+#ifndef _CONSTANTS_
+#define _CONSTANTS_
+
+layout(push_constant) uniform PushConstants {
+    mat4 mvp;
+    vec4 clip_bounds;
+    vec4 clip_widths;
+    vec4 clip_heights;
+} push;
+
+#endif
diff --git a/gsk/resources/vulkan/linear-clip-rounded.vert.glsl 
b/gsk/resources/vulkan/linear-clip-rounded.vert.glsl
index 3426cce..c06021d 100644
--- a/gsk/resources/vulkan/linear-clip-rounded.vert.glsl
+++ b/gsk/resources/vulkan/linear-clip-rounded.vert.glsl
@@ -1,5 +1,7 @@
 #version 420 core
 
+#include "constants.glsl"
+
 struct ColorStop {
   float offset;
   vec4 color;
@@ -21,13 +23,6 @@ layout(location = 12) in vec4 inColors5;
 layout(location = 13) in vec4 inColors6;
 layout(location = 14) in vec4 inColors7;
 
-layout(push_constant) uniform PushConstants {
-    mat4 mvp;
-    vec4 clip_bounds;
-    vec4 clip_widths;
-    vec4 clip_heights;
-} push;
-
 layout(location = 0) out vec2 outPos;
 layout(location = 1) out float outGradientPos;
 layout(location = 2) out flat int outRepeating;
diff --git a/gsk/resources/vulkan/linear-clip-rounded.vert.spv 
b/gsk/resources/vulkan/linear-clip-rounded.vert.spv
index 901fff9..800e090 100644
Binary files a/gsk/resources/vulkan/linear-clip-rounded.vert.spv and 
b/gsk/resources/vulkan/linear-clip-rounded.vert.spv differ
diff --git a/gsk/resources/vulkan/linear-clip.vert.glsl b/gsk/resources/vulkan/linear-clip.vert.glsl
index 818d5ab..4ec7f2e 100644
--- a/gsk/resources/vulkan/linear-clip.vert.glsl
+++ b/gsk/resources/vulkan/linear-clip.vert.glsl
@@ -1,5 +1,7 @@
 #version 420 core
 
+#include "constants.glsl"
+
 struct ColorStop {
   float offset;
   vec4 color;
@@ -21,13 +23,6 @@ layout(location = 12) in vec4 inColors5;
 layout(location = 13) in vec4 inColors6;
 layout(location = 14) in vec4 inColors7;
 
-layout(push_constant) uniform PushConstants {
-    mat4 mvp;
-    vec4 clip_bounds;
-    vec4 clip_widths;
-    vec4 clip_heights;
-} push;
-
 layout(location = 0) out float outGradientPos;
 layout(location = 1) out flat int outRepeating;
 layout(location = 2) out flat int outStopCount;
diff --git a/gsk/resources/vulkan/linear-clip.vert.spv b/gsk/resources/vulkan/linear-clip.vert.spv
index 57199f9..e7d4cf6 100644
Binary files a/gsk/resources/vulkan/linear-clip.vert.spv and b/gsk/resources/vulkan/linear-clip.vert.spv 
differ
diff --git a/gsk/resources/vulkan/linear.vert.glsl b/gsk/resources/vulkan/linear.vert.glsl
index d9d107e..7a55c61 100644
--- a/gsk/resources/vulkan/linear.vert.glsl
+++ b/gsk/resources/vulkan/linear.vert.glsl
@@ -1,5 +1,7 @@
 #version 420 core
 
+#include "constants.glsl"
+
 struct ColorStop {
   float offset;
   vec4 color;
@@ -21,13 +23,6 @@ layout(location = 12) in vec4 inColors5;
 layout(location = 13) in vec4 inColors6;
 layout(location = 14) in vec4 inColors7;
 
-layout(push_constant) uniform PushConstants {
-    mat4 mvp;
-    vec4 clip_bounds;
-    vec4 clip_widths;
-    vec4 clip_heights;
-} push;
-
 layout(location = 0) out float outGradientPos;
 layout(location = 1) out flat int outRepeating;
 layout(location = 2) out flat int outStopCount;
diff --git a/gsk/resources/vulkan/linear.vert.spv b/gsk/resources/vulkan/linear.vert.spv
index ab3b4ac..f2b120f 100644
Binary files a/gsk/resources/vulkan/linear.vert.spv and b/gsk/resources/vulkan/linear.vert.spv differ


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