summaryrefslogtreecommitdiff
path: root/tests/shaders/glsl-vs-arrays-2.shader_test
blob: bdb476f94e34948c623cb024b9621957b4b30f44 (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
[require]
GLSL >= 1.10

[vertex shader]
/* VS array access (read-only) from temps using a varying
 * array index per vert.
 */
uniform float one;
varying vec4 color;
void main()
{
	vec4 colors[4];
	colors[0] = vec4(one, 0.0, 0.0, 0.0);
	colors[1] = vec4(0.0, one, 0.0, 0.0);
	colors[2] = vec4(0.0, 0.0, one, 0.0);
	colors[3] = vec4(one, 0.0, one, 0.0);

	gl_Position = gl_Vertex;

	int index = int((gl_Vertex.x + 1.0) * 0.5 + (gl_Vertex.y + 1.0));
	color = colors[index];
}

[fragment shader]
varying vec4 color;
void main()
{
	gl_FragColor = color;
}

[test]
uniform float one 1.0
draw rect -1 -1 2 2
relative probe rgb (0.0, 0.0) (1.0, 0.0, 0.0, 0.0)
relative probe rgb (1.0, 0.0) (0.0, 1.0, 0.0, 0.0)
relative probe rgb (0.0, 1.0) (0.0, 0.0, 1.0, 0.0)
relative probe rgb (1.0, 1.0) (1.0, 0.0, 1.0, 0.0)