shader_runner: Use piglit_height for framebuffer height.

It used to be piglit_width which works, too, as the framebuffer is hardcoded
to 250x250 pixels.

Signed-off-by: Fabian Bieler <fabianbieler@fastmail.fm>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
shader_runner: Allow new drawing modes.

Add primitives with adjacency and (for extreme future-proofness) patches to
recognized drawing modes.

Signed-off-by: Fabian Bieler <fabianbieler@fastmail.fm>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
util: Draw rectangles using triangle strips instead of quads.

This is useful for core profile OpenGL contexts and geometry shaders.

Signed-off-by: Fabian Bieler <fabianbieler@fastmail.fm>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
shader_runner: Draw instanced rectangles using triangle strips instead of quads.

This is useful for core profile OpenGL contexts and geometry shaders.

Signed-off-by: Fabian Bieler <fabianbieler@fastmail.fm>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
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."

Signed-off-by: Fabian Bieler <fabianbieler@fastmail.fm>
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."

Signed-off-by: Fabian Bieler <fabianbieler@fastmail.fm>
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."

Signed-off-by: Fabian Bieler <fabianbieler@fastmail.fm>
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"

Signed-off-by: Fabian Bieler <fabianbieler@fastmail.fm>
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."

Signed-off-by: Fabian Bieler <fabianbieler@fastmail.fm>
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.

Signed-off-by: Fabian Bieler <fabianbieler@fastmail.fm>
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."

Signed-off-by: Fabian Bieler <fabianbieler@fastmail.fm>
Reviewed-by: Brian Paul <brianp@vmware.com>
arb_geometry_shader4: Test geometry shader that doesn't generate any primitives.

Signed-off-by: Fabian Bieler <fabianbieler@fastmail.fm>
arb_geometry_shader4: Test mismatching varying arrays.

Test that array sizes of user-defined varyings are cross-validated between
vertex and geometry shaders.

Signed-off-by: Fabian Bieler <fabianbieler@fastmail.fm>
arb_geometry_shader4: Add basic 2d array tests.

Test basic indexing operations with 2d arrays.

Signed-off-by: Fabian Bieler <fabianbieler@fastmail.fm>
arb_geometry_shader4: Add further 2d array tests.

Add some tests that basically check that the compiler doesn't confuse the two
array dimensions.

Signed-off-by: Fabian Bieler <fabianbieler@fastmail.fm>
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.

Signed-off-by: Fabian Bieler <fabianbieler@fastmail.fm>
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.

Signed-off-by: Fabian Bieler <fabianbieler@fastmail.fm>
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"