blob: ac8acc9d9a92314331b0433b487745994bec0211 (
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
|
[require]
GLSL >= 1.10
[vertex shader]
void main()
{
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
}
[fragment shader]
// Pass loop info as uniforms to avoid unrolling
// We test 300 iterations because that's greater than PS3.0's 255 loop
// iteration limit.
uniform int iters;
uniform float step;
uniform float expected;
void main()
{
float sum = 0.0;
int i;
for (i = 0; i < iters; i++) {
sum += step;
}
if (sum == expected) {
gl_FragColor = vec4(0, 1, 0, 1); // green=good
} else {
gl_FragColor = vec4(1, 0, 0, 1); // red=bad
}
}
[test]
uniform int iters 300
uniform float step 1.0
uniform float expected 300.0
draw rect -1 -1 2 2
probe rgb 1 1 0 1 0
|