blob: 8b303104bb302b34d34526855607a238d2453c39 (
plain)
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
/* Keep these in sync with GPU_shader.h */
#define INTERLACE_ROW 0
#define INTERLACE_COLUMN 1
#define INTERLACE_CHECKERBOARD 2
#if __VERSION__ == 120
varying vec2 texCoord_interp;
#define fragColor gl_FragColor
#else
in vec2 texCoord_interp;
out vec4 fragColor;
#define texture2DRect texture
#endif
uniform int interlace_id;
uniform sampler2DRect image_a;
uniform sampler2DRect image_b;
bool interlace()
{
#if __VERSION__ == 120
if (interlace_id == INTERLACE_CHECKERBOARD) {
return int(mod(gl_FragCoord.x + gl_FragCoord.y, 2)) != 0;
}
else if (interlace_id == INTERLACE_ROW) {
return int(mod(gl_FragCoord.y, 2)) != 0;
}
else if (interlace_id == INTERLACE_COLUMN) {
return int(mod(gl_FragCoord.x, 2)) != 0;
}
#else
if (interlace_id == INTERLACE_CHECKERBOARD) {
return (int(gl_FragCoord.x + gl_FragCoord.y) & 1) != 0;
}
else if (interlace_id == INTERLACE_ROW) {
return (int(gl_FragCoord.y) & 1) != 0;
}
else if (interlace_id == INTERLACE_COLUMN) {
return (int(gl_FragCoord.x) & 1) != 0;
}
#endif
}
void main()
{
if (interlace()) {
fragColor = texture2DRect(image_a, texCoord_interp);
} else {
fragColor = texture2DRect(image_b, texCoord_interp);
}
}
|