-
Notifications
You must be signed in to change notification settings - Fork 1
/
dual-up.fs.glsl
29 lines (22 loc) · 922 Bytes
/
dual-up.fs.glsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#version 300 es
// dual-up.fs.glsl
precision highp float;
#define SUPPORT 6.0
uniform sampler2D uTexture;
uniform vec2 uSrcSize;
uniform float uCoeff;
uniform bool uVertical;
in vec2 vTexCoord;
out vec4 oFragColor;
void main() {
vec2 halfpixel = 0.5 / uSrcSize;
vec4 sum = texture(uTexture, vTexCoord + vec2(-halfpixel.x * 2.0, 0.0));
sum += texture(uTexture, vTexCoord + vec2(-halfpixel.x, halfpixel.y)) * 2.0;
sum += texture(uTexture, vTexCoord + vec2(0.0, halfpixel.y * 2.0));
sum += texture(uTexture, vTexCoord + vec2(halfpixel.x, halfpixel.y)) * 2.0;
sum += texture(uTexture, vTexCoord + vec2(halfpixel.x * 2.0, 0.0));
sum += texture(uTexture, vTexCoord + vec2(halfpixel.x, -halfpixel.y)) * 2.0;
sum += texture(uTexture, vTexCoord + vec2(0.0, -halfpixel.y * 2.0));
sum += texture(uTexture, vTexCoord + vec2(-halfpixel.x, -halfpixel.y)) * 2.0;
oFragColor = sum / 12.0;
}