summaryrefslogtreecommitdiffstats
path: root/video/out/gl_video_shaders.glsl
diff options
context:
space:
mode:
Diffstat (limited to 'video/out/gl_video_shaders.glsl')
-rw-r--r--video/out/gl_video_shaders.glsl43
1 files changed, 21 insertions, 22 deletions
diff --git a/video/out/gl_video_shaders.glsl b/video/out/gl_video_shaders.glsl
index ff2a019b30..9998badbca 100644
--- a/video/out/gl_video_shaders.glsl
+++ b/video/out/gl_video_shaders.glsl
@@ -237,29 +237,24 @@ float[6] weights6(sampler2D lookup, float f) {
return float[6](c1.r, c1.g, c1.b, c2.r, c2.g, c2.b);
}
-float[8] weights8(sampler2D lookup, float f) {
- vec4 c1 = texture(lookup, vec2(0.25, f));
- vec4 c2 = texture(lookup, vec2(0.75, f));
- return float[8](c1.r, c1.g, c1.b, c1.a, c2.r, c2.g, c2.b, c2.a);
-}
-
-float[12] weights12(sampler2D lookup, float f) {
- vec4 c1 = texture(lookup, vec2(1.0/6.0, f));
- vec4 c2 = texture(lookup, vec2(0.5, f));
- vec4 c3 = texture(lookup, vec2(5.0/6.0, f));
- return float[12](c1.r, c1.g, c1.b, c1.a,
- c2.r, c2.g, c2.b, c2.a,
- c3.r, c3.g, c3.b, c3.a);
-}
+#define WEIGHTS_N(NAME, N) \
+ float[N] NAME(sampler2D lookup, float f) { \
+ float r[N]; \
+ for (int n = 0; n < N / 4; n++) { \
+ vec4 c = texture(lookup, \
+ vec2(1.0 / (N / 2) + n / float(N / 4), f)); \
+ r[n * 4 + 0] = c.r; \
+ r[n * 4 + 1] = c.g; \
+ r[n * 4 + 2] = c.b; \
+ r[n * 4 + 3] = c.a; \
+ } \
+ return r; \
+ }
-float[16] weights16(sampler2D lookup, float f) {
- vec4 c1 = texture(lookup, vec2(0.125, f));
- vec4 c2 = texture(lookup, vec2(0.375, f));
- vec4 c3 = texture(lookup, vec2(0.625, f));
- vec4 c4 = texture(lookup, vec2(0.875, f));
- return float[16](c1.r, c1.g, c1.b, c1.a, c2.r, c2.g, c2.b, c2.a,
- c3.r, c3.g, c3.b, c3.a, c4.r, c4.g, c4.b, c4.a);
-}
+WEIGHTS_N(weights8, 8)
+WEIGHTS_N(weights12, 12)
+WEIGHTS_N(weights16, 16)
+WEIGHTS_N(weights32, 32)
#define CONVOLUTION_SEP_N(NAME, N) \
vec4 NAME(VIDEO_SAMPLER tex, vec2 texcoord, vec2 pt, float weights[N]) {\
@@ -276,6 +271,7 @@ CONVOLUTION_SEP_N(convolution_sep6, 6)
CONVOLUTION_SEP_N(convolution_sep8, 8)
CONVOLUTION_SEP_N(convolution_sep12, 12)
CONVOLUTION_SEP_N(convolution_sep16, 16)
+CONVOLUTION_SEP_N(convolution_sep32, 32)
// The dir parameter is (0, 1) or (1, 0), and we expect the shader compiler to
// remove all the redundant multiplications and additions.
@@ -295,6 +291,7 @@ SAMPLE_CONVOLUTION_SEP_N(sample_convolution_sep6, 6, sampler2D, convolution_sep6
SAMPLE_CONVOLUTION_SEP_N(sample_convolution_sep8, 8, sampler2D, convolution_sep8, weights8)
SAMPLE_CONVOLUTION_SEP_N(sample_convolution_sep12, 12, sampler2D, convolution_sep12, weights12)
SAMPLE_CONVOLUTION_SEP_N(sample_convolution_sep16, 16, sampler2D, convolution_sep16, weights16)
+SAMPLE_CONVOLUTION_SEP_N(sample_convolution_sep32, 32, sampler2D, convolution_sep32, weights32)
#define CONVOLUTION_N(NAME, N) \
@@ -316,6 +313,7 @@ CONVOLUTION_N(convolution6, 6)
CONVOLUTION_N(convolution8, 8)
CONVOLUTION_N(convolution12, 12)
CONVOLUTION_N(convolution16, 16)
+CONVOLUTION_N(convolution32, 32)
#define SAMPLE_CONVOLUTION_N(NAME, N, SAMPLERT, CONV_FUNC, WEIGHTS_FUNC) \
vec4 NAME(SAMPLERT lookup, VIDEO_SAMPLER tex, vec2 texsize, vec2 texcoord) {\
@@ -333,6 +331,7 @@ SAMPLE_CONVOLUTION_N(sample_convolution6, 6, sampler2D, convolution6, weights6)
SAMPLE_CONVOLUTION_N(sample_convolution8, 8, sampler2D, convolution8, weights8)
SAMPLE_CONVOLUTION_N(sample_convolution12, 12, sampler2D, convolution12, weights12)
SAMPLE_CONVOLUTION_N(sample_convolution16, 16, sampler2D, convolution16, weights16)
+SAMPLE_CONVOLUTION_N(sample_convolution32, 32, sampler2D, convolution32, weights32)
// Unsharp masking