perf/pixel-rate: new pixel throughput microbenchmark
[piglit.git] / tests / spec / glsl-1.30 / execution / vs-loop-uint-induction-var-4.shader_test
blob8842ec3087c56a41acc35520af4a5717b420de4c
1 # This tests that we do not unroll a loop in error thinking we know the max
2 # trip count due to the induction variable being uint. i.e The max trip count
3 # here is 4294967295 with this test we are making sure the compiler doesn't
4 # mistakenly think the trip count is 4.
5 [require]
6 GLSL >= 1.30
8 [vertex shader]
9 #version 130
11 uniform uint induction_init;
13 void main()
15   gl_Position = gl_Vertex;
17   vec4 colour = vec4(1.0, 1.0, 1.0, 1.0);
18   vec4 colour2 = vec4(0.0, 0.0, 0.0, 1.0);
20   uint j = 0u;
21   uint i = induction_init;
22   while (true) {
24      if (j > 4u) {
25         colour = vec4(1.0, 0.0, 0.0, 1.0);
26      }
28      if (!(3u < i)) {
29         break;
30      }
32      colour = vec4(0.0, 1.0, 0.0, 1.0);
34      i++;
35      j++;
36   }
38   gl_FrontColor = colour + colour2;
41 [fragment shader]
42 void main()
44   gl_FragColor = gl_Color;
47 [test]
48 clear color 0.5 0.5 0.5 0.5
50 # unit_max 4294967295
52 # induction_init equivalent to starting at int -5
53 uniform uint induction_init 4294967291
54 draw rect -1 -1 2 2
55 probe all rgba 1.0 0.0 0.0 1.0
57 # induction_init equivalent to starting at int -3
58 uniform uint induction_init 4294967293
59 draw rect -1 -1 2 2
60 probe all rgba 0.0 1.0 0.0 1.0
62 uniform uint induction_init 0
63 draw rect -1 -1 2 2
64 probe all rgba 1.0 1.0 1.0 1.0