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.
This commit is contained in:
Benjamin Otte 2017-01-17 02:20:08 +01:00
parent 8ffecabd93
commit c7d899c535
32 changed files with 42 additions and 105 deletions

View File

@ -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 \

View File

@ -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;

View File

@ -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 {

View File

@ -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 {

Binary file not shown.

View File

@ -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;

View File

@ -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;

View File

@ -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;

Binary file not shown.

View File

@ -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;

View File

@ -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;
};

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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 {

Binary file not shown.

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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;

Binary file not shown.