summaryrefslogtreecommitdiff
path: root/tests/shaders/glsl-fs-convolution-2.shader_test
blob: 9639b1a66f1195cadbfa870c035d0d4aa8767b11 (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
[require]
GLSL >= 1.10

[vertex shader]
varying vec4 texcoords;

void main()
{
	gl_Position = gl_Vertex;
	texcoords = (gl_Vertex + 1.0) / 2.0;
}

[fragment shader]
varying vec4 texcoords;
uniform sampler2D tex;

#define FILTER_SIZE 34
uniform vec2 o[FILTER_SIZE];
uniform float c[FILTER_SIZE];

/* Testcase from Owen Taylor of a shader being experimented with in
 * gnome-shell that failed on i965 due to register allocation.
*
* Unlike glsl-fs-convolution-1, this one prevented loop unrolling by
* using more iterations.
 */
void main()
{
	vec4 value = vec4(0.0);
	for (int i = 0; i < FILTER_SIZE; i++) {
		value += c[i] * texture2D(tex, texcoords.xy + o[i]);
	}

	gl_FragColor = value;
}

[test]
uniform int tex 0

uniform float c[0] 0.0
uniform float c[1] 0.0
uniform float c[2] 0.0
uniform float c[3] 0.0
uniform float c[4] 0.0
uniform float c[5] 0.0
uniform float c[6] 0.0
uniform float c[7] 0.0
uniform float c[8] 0.0
uniform float c[9] 0.0
uniform float c[10] 0.0
uniform float c[11] 0.0
uniform float c[12] 0.0
uniform float c[13] 0.0
uniform float c[14] 0.0
uniform float c[15] 0.0
uniform float c[16] 0.0
uniform float c[17] 0.0
uniform float c[18] 0.0
uniform float c[19] 0.0
uniform float c[20] 1.0
uniform float c[21] 0.0
uniform float c[22] 0.0
uniform float c[23] 0.0
uniform float c[24] 0.0
uniform float c[25] 0.0
uniform float c[26] 0.0
uniform float c[27] 0.0
uniform float c[28] 0.0
uniform float c[29] 0.0
uniform float c[30] 0.0
uniform float c[31] 0.0
uniform float c[32] 0.0
uniform float c[33] 0.0

uniform vec2 o[0] -1.0 1.0
uniform vec2 o[1] -1.0 1.0
uniform vec2 o[2] -1.0 1.0
uniform vec2 o[3] -1.0 1.0
uniform vec2 o[4] -1.0 1.0
uniform vec2 o[5] -1.0 1.0
uniform vec2 o[6] -1.0 1.0
uniform vec2 o[7] -1.0 1.0
uniform vec2 o[8] -1.0 1.0
uniform vec2 o[9] -1.0 1.0
uniform vec2 o[10] -1.0 1.0
uniform vec2 o[11] -1.0 1.0
uniform vec2 o[12] -1.0 1.0
uniform vec2 o[13] -1.0 1.0
uniform vec2 o[14] -1.0 1.0
uniform vec2 o[15] -1.0 1.0
uniform vec2 o[16] -1.0 1.0
uniform vec2 o[17] -1.0 1.0
uniform vec2 o[18] -1.0 1.0
uniform vec2 o[19] -1.0 1.0
uniform vec2 o[20] 0.0 0.0
uniform vec2 o[21] -1.0 1.0
uniform vec2 o[22] -1.0 1.0
uniform vec2 o[23] -1.0 1.0
uniform vec2 o[24] -1.0 1.0
uniform vec2 o[25] -1.0 1.0
uniform vec2 o[26] -1.0 1.0
uniform vec2 o[27] -1.0 1.0
uniform vec2 o[28] -1.0 1.0
uniform vec2 o[29] -1.0 1.0
uniform vec2 o[30] -1.0 1.0
uniform vec2 o[31] -1.0 1.0
uniform vec2 o[32] -1.0 1.0
uniform vec2 o[33] -1.0 1.0

texture rgbw 0 (8, 8)
draw rect -1 -1 2 2
relative probe rgb (0.25, 0.25) (1.0, 0.0, 0.0)
relative probe rgb (0.75, 0.25) (0.0, 1.0, 0.0)
relative probe rgb (0.25, 0.75) (0.0, 0.0, 1.0)
relative probe rgb (0.75, 0.75) (1.0, 1.0, 1.0)