1#version 450 2 3layout(std140, set = 0, binding = 0) uniform UBO 4{ 5 mat4 MVP; 6 vec4 OutputSize; 7 vec4 OriginalSize; 8 vec4 SourceSize; 9} global; 10 11#pragma stage vertex 12layout(location = 0) in vec4 Position; 13layout(location = 1) in vec2 TexCoord; 14layout(location = 0) out vec2 vTexCoord; 15 16void main() 17{ 18 gl_Position = global.MVP * Position; 19 vTexCoord = TexCoord; 20} 21 22#pragma stage fragment 23layout(location = 0) in vec2 vTexCoord; 24layout(location = 0) out vec4 FragColor; 25layout(set = 0, binding = 2) uniform sampler2D Source; 26 27#include "blur_params.inc" 28 29#define kernel(x) exp(-GLOW_FALLOFF * (x) * (x)) 30 31void main() 32{ 33 vec3 col = vec3(0.0); 34 float dy = global.SourceSize.w; 35 36 float k_total = 0.0; 37 for (int i = -TAPS; i <= TAPS; i++) 38 { 39 float k = kernel(i); 40 k_total += k; 41 col += k * texture(Source, vTexCoord + vec2(0.0, float(i) * dy)).rgb; 42 } 43 44 FragColor = vec4(col / k_total, 1.0); 45} 46