fix the spelling in whole piglit
[piglit.git] / tests / spec / glsl-1.50 / execution / out-of-ssa-DFS-pre-order.shader_test
blobda53037b51ce401980061de0e3195b6569ee0bcb
1 # Reproducer for issue 3712
2 # https://gitlab.freedesktop.org/mesa/mesa/-/issues/3712
3 [require]
4 GLSL >= 1.50
5 GL_ARB_compute_shader
6 GL_ARB_shader_storage_buffer_object
8 [compute shader]
9 #version 150
10 #extension GL_ARB_compute_shader: require
11 #extension GL_ARB_shader_storage_buffer_object: require
12 // #define SKIP_NOOP
14 layout(local_size_x = 1) in;
15 layout(binding = 0) writeonly buffer Result {
16    ivec4 result[];
19 layout(binding = 1) writeonly buffer Noop {
20    ivec4 noop[];
23 ivec4 choose(ivec4 a, ivec4 b) {
24    ivec4 c = b;
25    if (b.x == b.y) {            // True in trivial case
26       c = a;
27    } else if (a.x > a.y) {      // Never true
28       c = min(a, b);
29    }
30    return c;
33 ivec4 transform(uint ref) {
34    return ivec4(ref, float(ref)+1.0, float(ref)+2.0, float(ref)+3.0);
37 shared ivec4 sh_value;
39 void main() {
40    ivec4 value = ivec4(0, 0, 0, 0);
41    uint loop_breaker = 0u;
42    uint i = 0u;
44    if (gl_LocalInvocationID.x == 0u) {
45       while (true) {
46          ivec4 ix = transform(i);
47          i++;
48          if (i == 1u) {
49             value = choose(ix, value);
50             if (loop_breaker == 0u) {
51                break;
52             }
53             loop_breaker--;
54          }
55       }
56       ivec4 a_0 = transform(gl_GlobalInvocationID.x);
57       ivec4 a_1 = choose(value, a_0);
58 #ifndef SKIP_NOOP
59       noop[gl_GlobalInvocationID.x] = a_1;
60 #endif
61       sh_value = value;
62    }
63    value = sh_value;
64    result[gl_GlobalInvocationID.x] = value;
67 [test]
68 ssbo 0 64
69 ssbo 1 64
71 compute 2 1 1
73 probe ssbo int 0 0  == 0
74 probe ssbo int 0 4  == 1
75 probe ssbo int 0 8  == 2
76 probe ssbo int 0 12 == 3
77 probe ssbo int 0 16 == 0
78 probe ssbo int 0 20 == 1
79 probe ssbo int 0 24 == 2
80 probe ssbo int 0 28 == 3