cmake: move defaults into the per-platform section
[piglit.git] / tests / shaders / glsl-predication-on-large-array.shader_test
blobc82eda9510ac0d224cae7770e5e9abfacce1329a
1 [require]
2 GLSL >= 1.20
4 [vertex shader passthrough]
6 [fragment shader]
7 /*
8 Test predication on values from large array
10 Big local arrays may be handled differently than smaller ones, e.g. stored in
11 a global memory. However drivers may have a subtle error combining this
12 optimization with helper invocations of fragment shader.
14 Since all side-effects of helper invocations are being ignored - driver may
15 also erroneously ignore stores to a local array which was lowered to
16 a global memory.
18 This may cause an issue when a control flow in helper invocation depends
19 on the value written to such array.
21 To test this we make a loop which depends on a value written to a big local
22 array, so if stores are being ignored - the loop will become infinite,
23 causing a hang.
27 #version 120
29 int map[2048];
31 uniform int indexInArray;
33 void main() {
34   for (int i = 0; i < map.length(); i++) {
35     map[i] = 0;
36   }
38   int i = min(indexInArray, map.length() - 1);
40   do {
41     if(map[i] == 1){
42       break;
43     }else{
44       map[i] = 1;
45     }
46   }
47   while (true);
49   gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
52 [test]
53 uniform int indexInArray 500
54 clear color 0.0 0.0 0.0 0.0
55 clear
56 draw rect -1.0 -1.0 2.0 2.0
57 relative probe rect rgb (0.0, 0.0, 0.5, 0.5) (0.0, 1.0, 0.0)