arb_geometry_shader4: Test valid input primitives.

Test that glProgramParameter() triggers the required errors.

The geometry shader input primitive type is limited to a subset
of OpenGL primitive types.

From the ARB_geometry_shader4 spec (section Errors):
"The error INVALID_VALUE is generated by ProgramParameteriARB if <pname> is
GEOMETRY_INPUT_TYPE_ARB and <value> is not one of POINTS, LINES,
LINES_ADJACENCY_ARB, TRIANGLES or TRIANGLES_ADJACENCY_ARB."
arb_geometry_shader4: Test valid output primitives.

Test that glProgramParameter() triggers the required errors.

The geometry shader output primitive type is limited to a subset
of OpenGL primitive types.

From the ARB_geometry_shader4 spec (section Errors):
"The error INVALID_VALUE is generated by ProgramParameteriARB if <pname> is
GEOMETRY_OUTPUT_TYPE_ARB and <value> is not one of POINTS, LINE_STRIP or
TRIANGLE_STRIP."
arb_geometry_shader4: Test valid vertices out count.

Test that glProgramParameter() triggers the required errors.

The value of GEOMETRY_VERTICES_OUT is limited by the implementation
dependend constants MAX_GEOMETRY_OUTPUT_VERTICES and
MAX_VERTEX_VARYING_COMPONENTS.

From the ARB_geometry_shader4 spec (section Errors):
"The error INVALID_VALUE is generated by ProgramParameteriARB if <pname> is
GEOMETRY_VERTICES_OUT_ARB and <value> is negative.

The error INVALID_VALUE is generated by ProgramParameteriARB if <pname> is
GEOMETRY_VERTICES_OUT_ARB and <value> exceeds
MAX_GEOMETRY_OUTPUT_VERTICES_ARB.

The error INVALID_VALUE is generated by ProgramParameteriARB if <pname> is
set to GEOMETRY_VERTICES_OUT_ARB and the product of <value> and the sum of
all components of all active varying variables exceeds
MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB."
squash! arb_geometry_shader4: Test valid vertices out count.

Don't count gl_Position against MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS.
arb_geometry_shader4: Test valid drawing modes.

Test that glDrawArrays() triggers the required errors.

The geometry shader input type limits the valid primitive types of glBegin()
(including implicit glBegin()).

From the ARB_geometry_shader4 spec (section Errors):
"The error INVALID_OPERATION is generated if Begin, or any command that
implicitly calls Begin, is called when a geometry shader is active and:

    * the input primitive type of the current geometry shader is
      POINTS and <mode> is not POINTS,

    * the input primitive type of the current geometry shader is
      LINES and <mode> is not LINES, LINE_STRIP, or LINE_LOOP,

    * the input primitive type of the current geometry shader is
      TRIANGLES and <mode> is not TRIANGLES, TRIANGLE_STRIP or
      TRIANGLE_FAN,

    * the input primitive type of the current geometry shader is
      LINES_ADJACENCY_ARB and <mode> is not LINES_ADJACENCY_ARB or
      LINE_STRIP_ADJACENCY_ARB, or

    * the input primitive type of the current geometry shader is
      TRIANGLES_ADJACENCY_ARB and <mode> is not
      TRIANGLES_ADJACENCY_ARB or TRIANGLE_STRIP_ADJACENCY_ARB."
arb_geometry_shader4: Link without vertex shader.

Test that linking fails without vertex shader present.

ARB_geometry_shader4 spec 2.15.2:
"Linking will also fail if the program object contains objects to form a
geometry shader (see section 2.16), but no objects to form a vertex shader"
arb_geometry_shader4: Test input overrun.

Test that linking fails if the geometry shader accesses more components than
are available for every input primitive type.

ARB_geometry_shader4 spec 2.16.1:
"However, a program object, containing a shader object that access more input
vertices than are available for the input primitive type of the program
object, will not link."
arb_geometry_shader4: Test indexing geometry shader input arrays.

All geometry shader input varyings are arrays.
Array varyings are two-dimensional arrays.

Test indexing of scalar, vector and matrix varyings.
arb_geometry_shader4: Test that adjacent vertices are ignored when no geometry shader is active.

Draw the adjacency version of a primitive in red and blend the normal version
of that primitive in green on top of it. Check that the entire framebuffer is
yellow or black.

Test this with and without indexed drawing (glDrawElements and glDrawArrays).

ARB_geometry_shader4 spec 2.6.1:
"If a geometry shader is not active, the "adjacent" vertices are ignored."
arb_geometry_shader4: Test geometry shader that doesn't generate any primitives.
arb_geometry_shader4: Test mismatching varying arrays.

Test that array sizes of user-defined varyings are cross-validated between
vertex and geometry shaders.
arb_geometry_shader4: Add basic 2d array tests.

Test basic indexing operations with 2d arrays.
arb_geometry_shader4: Add further 2d array tests.

Add some tests that basically check that the compiler doesn't confuse the two
array dimensions.
arb_geometry_shader4: Test gl_TexCoordIn indexing.

From the ARB_geometry_shader4 spec (section ):
"Indices used to subscript gl_TexCoord must either be an integral constant
expressions, or this array must be re-declared by the shader with a size."

And from the GLSL 1.1 spec page 99 (page 105 of the PDF):
"Multiple modules can declare it [gl_TexCoord] with different sizes, the
maximum will be used at link time."

Presumably, this also applies to gl_TexCoordIn.
arb_geometry_shader4: Test that gl_VerticesIn is const.

Test that gl_VerticesIn can be used as a valid constant expression.

Also test that it evaluates to 3 for triangles.
arb_geometry_shader4: Don't export position in vertex shader.

Do not write to gl_Position in a glsl 1.1 version vertex shader with the
geometry shader extension enabled.

From the GL_ARB_geometry_shader4 spec (section "Geometry Shader Inputs"):
"Note that writing to gl_Position from either the vertex or [geometry] shader
is optional"
arb_geometry_shader4: Read primitive ID in fragment shader.

Test reading the primitive ID in a glsl 1.1 fragment shader with the
geometry shader extension enabled.

From the ARB_geometry_shader4 spec (section Geometry Shader outputs):
"The built-in gl_PrimitiveID provides a single integer that serves as a
primitive identifier.  This written primitive ID is available to fragment
shaders."
arb_geometry_shader4: Test two sided triangles.

Draw 8 triangles on the screen like so:

    +-+-+
    |/|/|
    +-+-+
    |/|/|
    +-+-+

The left 4 triangles are front facing, the right 4 triangles are backfacing.
Flip the top 4 triangles in the geometry shader (swap the first and last vertex)
and write to both front and back color. The result should be a 2x2 checkerboard.
arb_geometry_shader: Test passing a single float varying from vs to gs.
arb_geometry_shader4: Test primitive assembly.

Test primitive assembly before and after geometry shader execution using
transform feedback. The test uses all valid combinations of geometry shader
input and output primitive type as well as drawn primitive type.

It draws up to 12 vertices (set via command line). The only vertex attribute
is a zero-base vertex id. The vertex shader simple passes through the vertex
attribute. The geometry shader writes zero to two identical primitives (also
set via command line). For each primitive it uses the first n input vertices
and m extra vertices (where n,m can be set via command line options).