summaryrefslogtreecommitdiff
path: root/src/rend2/glsl/down4x_fp.glsl
diff options
context:
space:
mode:
Diffstat (limited to 'src/rend2/glsl/down4x_fp.glsl')
-rw-r--r--src/rend2/glsl/down4x_fp.glsl34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/rend2/glsl/down4x_fp.glsl b/src/rend2/glsl/down4x_fp.glsl
new file mode 100644
index 00000000..0f88fb2e
--- /dev/null
+++ b/src/rend2/glsl/down4x_fp.glsl
@@ -0,0 +1,34 @@
+uniform sampler2D u_TextureMap;
+
+uniform vec2 u_InvTexRes;
+varying vec2 var_TexCoords;
+
+void main()
+{
+ vec4 color;
+ vec2 tc;
+
+ tc = var_TexCoords + u_InvTexRes * vec2(-1.5, -1.5); color = texture2D(u_TextureMap, tc);
+ tc = var_TexCoords + u_InvTexRes * vec2(-0.5, -1.5); color += texture2D(u_TextureMap, tc);
+ tc = var_TexCoords + u_InvTexRes * vec2( 0.5, -1.5); color += texture2D(u_TextureMap, tc);
+ tc = var_TexCoords + u_InvTexRes * vec2( 1.5, -1.5); color += texture2D(u_TextureMap, tc);
+
+ tc = var_TexCoords + u_InvTexRes * vec2(-1.5, -0.5); color += texture2D(u_TextureMap, tc);
+ tc = var_TexCoords + u_InvTexRes * vec2(-0.5, -0.5); color += texture2D(u_TextureMap, tc);
+ tc = var_TexCoords + u_InvTexRes * vec2( 0.5, -0.5); color += texture2D(u_TextureMap, tc);
+ tc = var_TexCoords + u_InvTexRes * vec2( 1.5, -0.5); color += texture2D(u_TextureMap, tc);
+
+ tc = var_TexCoords + u_InvTexRes * vec2(-1.5, 0.5); color += texture2D(u_TextureMap, tc);
+ tc = var_TexCoords + u_InvTexRes * vec2(-0.5, 0.5); color += texture2D(u_TextureMap, tc);
+ tc = var_TexCoords + u_InvTexRes * vec2( 0.5, 0.5); color += texture2D(u_TextureMap, tc);
+ tc = var_TexCoords + u_InvTexRes * vec2( 1.5, 0.5); color += texture2D(u_TextureMap, tc);
+
+ tc = var_TexCoords + u_InvTexRes * vec2(-1.5, 1.5); color += texture2D(u_TextureMap, tc);
+ tc = var_TexCoords + u_InvTexRes * vec2(-0.5, 1.5); color += texture2D(u_TextureMap, tc);
+ tc = var_TexCoords + u_InvTexRes * vec2( 0.5, 1.5); color += texture2D(u_TextureMap, tc);
+ tc = var_TexCoords + u_InvTexRes * vec2( 1.5, 1.5); color += texture2D(u_TextureMap, tc);
+
+ color *= 0.0625;
+
+ gl_FragColor = color;
+}