i965/fs: Rename vp_outputs_written to input_slots_valid.

With the introduction of geometry shaders, fragment inputs will no
longer come exclusively from the vertex shader; sometimes they come
from the geometry shader.  So the name "vp_outputs_written" will
become a misnomer.  This patch renames vp_outputs_written to
input_slots_valid, to reflect the true meaning of the bitfield from
the fragment shader's point of view: it indicates which of the
possible input slots contain valid data that was written by the
previous shader stage.
draw/gs: fix allocation of buffer for GS output vertices

Before, it accounted for the size of the vertices but not the other fields
in the vertex_header struct, which caused memory corruption.
mesa: add EXT_geometry_shader4 and ARB_geometry_shader4 to extension list
mesa: account for geometry shader texture fetches in update_texture_state
glcpp: define extension macros for EXT/ARB_geometry_shader4
glsl: add builtins for EXT/ARB_geometry_shader4
glsl: add ir_emitvertex and ir_endprim instruction types

These correspond to the EmitVertex and EndPrimitive functions in GLSL.

v2 (Paul Berry <stereotype441@gmail.com>): Add stub implementations of
new pure visitor functions to i965's vec4_visitor and fs_visitor
classes.
glsl: lower gl_ClipDistanceIn to gl_ClipDistanceInMESA in lower_clip_distance

This corresponds to the lowering of gl_ClipDistance to gl_ClipDistanceMESA.
It converts the 2D array gl_ClipDistanceIn from EXT/ARB_geometry_shader4 to
a 1D array of vec4s, gl_ClipDistanceInMESA.
glsl: support compilation of geometry shaders via EXT/ARB_geometry_shader4

This commit adds all of the parsing and semantics for EXT/ARB_geometry_shader4,
including support for 2D arrays as inputs.

v2 (Paul Berry <stereotype441@gmail.com>): Adjust i965's
brw_link_shader() to pass the new is_geometry_shader argument to
do_set_program_inouts.
st/mesa, glsl_to_tgsi: add support for geometry shaders

Note (Paul Berry <stereotype441@gmail.com>): I'm not sure I rebased
this correctly.  It appears that some amount of 2D array support was
added to tgsi after the patch was originally written.
WIP: make vec4_visitor::vp more generic
WIP: clean up uses of prog_data.
WIP: split brw_vs_compile out to brw_vec4_compile
WIP: split brw_vs_prog_key
WIP: split brw_vs_prog_data
WIP: make vec4_vs_visitor class
WIP: extract virtual functions from ir_variable visitor

Includes making a new function to handle variables of type
ir_var_system_value, which differ in VS and GS.

The following functions have been renamed to reflect their generic
purpose, rather than their VS-specific behaviour:

- emit_attribute_fixups() -> emit_prolog()
- emit_vertex_program_code() -> emit_program_code()
- emit_urb_writes() -> emit_thread_end()
WIP: move VS-specific functions to vec4_vs_visitor
WIP: move VS-specific data members to vs_vec4_visitor.
WIP: Generalize data structures pointed to by vec4_generator.

vec4_generator never used the vertex-shader-specific parts of these
data structures anyway.