summaryrefslogtreecommitdiff
path: root/tests/shaders/glsl-fs-loop-nested-if.shader_test
blob: cc99d2f0bfbe543ad293352cbd2685ed1a3d48a5 (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
[require]
GLSL >= 1.10

[vertex shader]
varying vec2 pos;
void main()
{
	gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
	pos = gl_Vertex.xy;
}

[fragment shader]
varying vec2 pos;
void main()
{
	vec3 c = vec3(0.0);

	/* To reproduce bugzilla #30030, the extraneous "&& (pos.x < 57.0)"
	 * is necessary.
	 */
	if ((pos.y < 0.0) && (pos.x < 57.0)) {
		if (pos.x < 0.0)
			for (int i = 0; i < 5; i++)
				c.r += 0.2;
		else
			for (int i = 0; i < 5; i++)
				c.g += 0.2;
	} else {
		if (pos.x < 0.0)
			for (int i = 0; i < 5; i++)
				c.b += 0.2;
		else
			for (int i = 0; i < 5; i++)
				c += vec3(0.2);

	}

	gl_FragColor = vec4(c, 1.0);
}

[test]
draw rect -1 -1 2 2
relative probe rgb (0.2, 0.2) (1.0, 0.0, 0.0)
relative probe rgb (0.7, 0.2) (0.0, 1.0, 0.0)
relative probe rgb (0.2, 0.7) (0.0, 0.0, 1.0)
relative probe rgb (0.7, 0.7) (1.0, 1.0, 1.0)