47 lines
1.0 KiB
GLSL
47 lines
1.0 KiB
GLSL
@vs vs_mix
|
|
in vec2 position;
|
|
in vec2 uv;
|
|
|
|
out vec2 texcoord;
|
|
|
|
void main() {
|
|
gl_Position = vec4(position, 0.5, 1.0);
|
|
texcoord = uv;
|
|
}
|
|
@end
|
|
|
|
@fs fs_mix
|
|
in vec2 texcoord;
|
|
out vec4 frag_color;
|
|
|
|
layout(binding=1) uniform mix_fs_params {
|
|
int op;
|
|
/*
|
|
List of mixs:
|
|
0. blur for ssao
|
|
1. dilate.
|
|
2. normal blur
|
|
*/
|
|
};
|
|
|
|
layout(binding = 0) uniform texture2D mixtex_a;
|
|
layout(binding = 1) uniform texture2D mixtex_b;
|
|
layout(binding = 2) uniform texture2D mixtex_c;
|
|
layout(binding = 0) uniform sampler mixsmp;
|
|
|
|
void main() {
|
|
if(op == 0) {
|
|
vec2 texelSize = 1.0 / vec2(textureSize(sampler2D(mixtex_a, mixsmp), 0));
|
|
vec3 result = vec3(0.0);
|
|
result += texture(sampler2D(mixtex_a, mixsmp), texcoord).xyz;
|
|
result += texture(sampler2D(mixtex_b, mixsmp), texcoord).xyz;
|
|
result = texture(sampler2D(mixtex_c, mixsmp), texcoord).xyz;
|
|
frag_color = vec4(result, 1.0);
|
|
} else {
|
|
frag_color = vec4(1.0);
|
|
}
|
|
}
|
|
@end
|
|
|
|
@program mix vs_mix fs_mix
|