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 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
|
# Verify that gl_MaxGeometryInputComponents (or
# gl_MaxVertexOutputComponents, if smaller) floats can be exchanged
# between the vertex and geometry shader. Use a geometry shader input
# type of triangles_adjacency so that the total number of inputs
# received by the geometry shader is as large as possible.
[require]
GLSL >= 1.50
[vertex shader]
out blk {
float f[min(gl_MaxGeometryInputComponents, gl_MaxVertexOutputComponents)];
} outs;
void main()
{
for (int i = 0; i < outs.f.length(); i++)
outs.f[i] = float(gl_VertexID * 1000 + i + 1);
}
[geometry shader]
layout(triangles_adjacency) in;
layout(triangle_strip, max_vertices = 4) out;
in blk {
float f[min(gl_MaxGeometryInputComponents, gl_MaxVertexOutputComponents)];
} ins[];
out vec4 color;
void main()
{
const vec4 vertices[4] = vec4[4](
vec4(-1.0, -1.0, 0.0, 1.0),
vec4(-1.0, 1.0, 0.0, 1.0),
vec4( 1.0, -1.0, 0.0, 1.0),
vec4( 1.0, 1.0, 0.0, 1.0)
);
bool ok = true;
for (int i = 0; i < 6; i++) {
for (int j = 0; j < ins[i].f.length(); j++) {
if (ins[i].f[j] != float(i * 1000 + j + 1))
ok = false;
}
}
for (int i = 0; i < 4; i++) {
gl_Position = vertices[i];
color = ok ? vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0);
EmitVertex();
}
}
[fragment shader]
in vec4 color;
void main()
{
gl_FragColor = color;
}
[test]
clear color 0.0 0.0 0.0 0.0
clear
draw arrays GL_TRIANGLES_ADJACENCY 0 6
probe all rgba 0.0 1.0 0.0 1.0
|