| 12
 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
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 
 | [require]
GLSL >= 1.50
GL_ARB_tessellation_shader
[vertex shader]
#version 150
in vec4 piglit_vertex;
void main()
{
    gl_Position = piglit_vertex;
}
[tessellation control shader]
#version 150
#extension GL_ARB_tessellation_shader : require
layout(vertices = 4) out;
uniform int index;
out block {
  float m1[16];
  float m2[14];
} var[];
out vec4 color[];
void main()
{
    for (int i = 0; i < 16; i++)
        var[gl_InvocationID].m1[i] = 1.0 + float(i);
    for (int i = 0; i < 14; i++)
        var[gl_InvocationID].m2[i] = 1.0 + float(16+i);
    if (index >= 16)
        var[gl_InvocationID].m2[index-16] = 0.0;
    else
        var[gl_InvocationID].m1[index] = 0.0;
    gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
    gl_TessLevelOuter = float[4](1.0, 1.0, 1.0, 1.0);
    gl_TessLevelInner = float[2](1.0, 1.0);
    barrier();
    bool pass = true;
    for (int i = 0; i < 16; i++) {
        float x = var[(gl_InvocationID + 1) % gl_PatchVerticesIn].m1[i];
        pass = pass && x == (index == i ?
                             0.0 :
                             1.0 + float(i));
    }
    for (int i = 0; i < 14; i++) {
        float x = var[(gl_InvocationID + 1) % gl_PatchVerticesIn].m2[i];
        pass = pass && x == (index == 16+i ?
                             0.0 :
                             17.0 + float(i));
    }
    color[gl_InvocationID] = pass ? vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0);
}
[tessellation evaluation shader]
#version 150
#extension GL_ARB_tessellation_shader : require
layout(quads, equal_spacing) in;
uniform int index;
in vec4 color[];
out vec4 fscolor;
#define INTERP_QUADj(INj, OUT) do { \
    vec4 v[4]; \
    for (int j = 0; j < 4; j++) v[j] = INj; \
    OUT = mix(mix(v[0], v[1], gl_TessCoord[0]), mix(v[2], v[3], gl_TessCoord[0]), \
              gl_TessCoord[1]); \
} while(false)
void main() {
    INTERP_QUADj(color[j], fscolor);
    INTERP_QUADj(gl_in[j].gl_Position, gl_Position);
}
[fragment shader]
#version 150
in vec4 fscolor;
out vec4 outcolor;
void main()
{
    outcolor = fscolor;
}
[test]
clear color 0.5 0.5 0.5 0.5
clear
patch parameter vertices 4
uniform int index 0
draw rect patch -1 -1 0.09 0.09
#draw arrays GL_PATCHES 0 4
probe rgb 6 6 0.0 1.0 0.0
uniform int index 1
draw rect patch -0.9 -1 0.09 0.09
probe rgb 18 6 0.0 1.0 0.0
uniform int index 2
draw rect patch -0.8 -1 0.09 0.09
probe rgb 31 6 0.0 1.0 0.0
uniform int index 3
draw rect patch -0.7 -1 0.09 0.09
probe rgb 43 6 0.0 1.0 0.0
uniform int index 4
draw rect patch -0.6 -1 0.09 0.09
probe rgb 56 6 0.0 1.0 0.0
uniform int index 5
draw rect patch -0.5 -1 0.09 0.09
probe rgb 68 6 0.0 1.0 0.0
uniform int index 6
draw rect patch -0.4 -1 0.09 0.09
probe rgb 81 6 0.0 1.0 0.0
uniform int index 7
draw rect patch -0.3 -1 0.09 0.09
probe rgb 93 6 0.0 1.0 0.0
uniform int index 8
draw rect patch -0.2 -1 0.09 0.09
probe rgb 106 6 0.0 1.0 0.0
uniform int index 9
draw rect patch -0.1 -1 0.09 0.09
probe rgb 118 6 0.0 1.0 0.0
uniform int index 10
draw rect patch 0 -1 0.09 0.09
probe rgb 131 6 0.0 1.0 0.0
uniform int index 11
draw rect patch 0.1 -1 0.09 0.09
probe rgb 143 6 0.0 1.0 0.0
uniform int index 12
draw rect patch 0.2 -1 0.09 0.09
probe rgb 156 6 0.0 1.0 0.0
uniform int index 13
draw rect patch 0.3 -1 0.09 0.09
probe rgb 168 6 0.0 1.0 0.0
uniform int index 14
draw rect patch 0.4 -1 0.09 0.09
probe rgb 181 6 0.0 1.0 0.0
uniform int index 15
draw rect patch 0.5 -1.0 0.09 0.09
probe rgb 193 6 0.0 1.0 0.0
uniform int index 16
draw rect patch -1 -0.9 0.09 0.09
probe rgb 6 18 0.0 1.0 0.0
uniform int index 17
draw rect patch -0.9 -0.9 0.09 0.09
probe rgb 18 18 0.0 1.0 0.0
uniform int index 18
draw rect patch -0.8 -0.9 0.09 0.09
probe rgb 31 18 0.0 1.0 0.0
uniform int index 19
draw rect patch -0.7 -0.9 0.09 0.09
probe rgb 43 18 0.0 1.0 0.0
uniform int index 20
draw rect patch -0.6 -0.9 0.09 0.09
probe rgb 56 18 0.0 1.0 0.0
uniform int index 21
draw rect patch -0.5 -0.9 0.09 0.09
probe rgb 68 18 0.0 1.0 0.0
uniform int index 22
draw rect patch -0.4 -0.9 0.09 0.09
probe rgb 81 18 0.0 1.0 0.0
uniform int index 23
draw rect patch -0.3 -0.9 0.09 0.09
probe rgb 93 18 0.0 1.0 0.0
uniform int index 24
draw rect patch -0.2 -0.9 0.09 0.09
probe rgb 106 18 0.0 1.0 0.0
uniform int index 25
draw rect patch -0.1 -0.9 0.09 0.09
probe rgb 118 18 0.0 1.0 0.0
uniform int index 26
draw rect patch 0 -0.9 0.09 0.09
probe rgb 131 18 0.0 1.0 0.0
uniform int index 27
draw rect patch 0.1 -0.9 0.09 0.09
probe rgb 143 18 0.0 1.0 0.0
uniform int index 28
draw rect patch 0.2 -0.9 0.09 0.09
probe rgb 156 18 0.0 1.0 0.0
uniform int index 29
draw rect patch 0.3 -0.9 0.09 0.09
probe rgb 168 18 0.0 1.0 0.0
 |