glsl: Return error_type instead of NULL if element_type() is called on non array type.

This matches the behavior of field_type() and other get_*_type() methods.

I looked through the calls to element_type() and didn't find a caller that
checks if it returns NULL.
glsl/linker: Use correct array length when linking inter-stage uniforms and varyings.
glsl: Only call mark_whole_array_access for arrays.
gallivm: Fix indirect input fetches for gs.
gallium/draw: Pass primitive ID as integer to the shader.

The shader interprets the value as an integer.
mesa/shaderapi: Allow 0 GEOMETRY_VERTICES_OUT.

ARB_geometry_shader4 spec Errors:
"The error INVALID_VALUE is generated by ProgramParameteriARB if <pname>
is GEOMETRY_VERTICES_OUT_ARB and <value> is negative."
mesa: Validate the drawing primitive against the geometry shader input primitive type.
mesa/main: Check for 0 size draws after validation.

Drawing 0 vertices is not an error.
When validating draw parameters move check for 0 vertices last, so that other
paramters (e.g.: the primitive type) are validated and the correct errors (if
applicable) are generated.
mesa/st: Allow geometry shaders without gl_Position export.

From the ARB_geometry_shader4 spec (section Geometry Shader outputs):
"The built-in special variable gl_Position is intended to hold the
homogeneous vertex position. Writing gl_Position is optional."
glsl/linker: Fail to link geometry shader without vertex shader.

ARB_geometry_shader4 spec 2.16:
"A program object that includes a geometry shader must also include a vertex
shader; otherwise a link error will occur."
glsl/linker: Fail if linking geometry shader with 0 GEOMETRY_VERTICES_OUT.

ARB_geometry_shader4 spec 2.15.2:
"Linking will also fail [...] if the program object contains objects to form a
geometry shader, and the value of GEOMETRY_VERTICES_OUT_ARB is zero."
glsl/linker: Check geometry output component count.

From the ARB_geometry_shader4 spec 2.16.4: Geometry Shader outputs:
"[...] the product of the total number of vertices and the sum of all
components of all active varying variables may not exceed the value of
MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB.  LinkProgram will fail if it
determines that the total component limit would be violated."
glsl: Enable geometry shader extension in vs and fs.

arb_geometry_shader and ext_geometry_shader make writing to gl_Position
optional in the vertex shader.

Also they enable reads from gl_PrimitiveID in the fragment shader.

From the ARB_geometry_shader4 spec (section "Geometry Shader Inputs"):
"Note that writing to gl_Position from either the vertex or [geometry] shader
is optional"

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."
glsl: Don't require exporting gl_Position if ARB_geometry_shader4 is enabled.

From the spec:
"Note that writing to gl_Position from either the vertex or
fragment shader is optional."