!UPSTREAM: i965/gs: add GS visitors.
i965: Make prim_to_hw_prim accessible outside brw_draw.c.

We will need access to this array in order to configure the geometry
shader.
i965/vec4: Make a function for setting up vec4 program key clip info.

This functionality will need to be reused by geometry shaders.
!UPSTREAM: i965/gs: make the state atom for compiling Gen7 geometry shaders.

TODO: maybe disentangle
!UPSTREAM: i965/gs: Generalize some error messages for GS.

TODO: find more places to generalize.
TODO: Don't use "VS/GS" terminology.  Use "vec4" terminology, since that will endure longer.
i965/gs(gen7): Allocate URB space for use by geometry shader.
!UPSTREAM: i965/gs(gen7): Allocate push constant space.
i965/vs: generalize push const upload in preparation for GS.
i965/gs: set up GS state.
!UPSTREAM: 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.

v2 (Paul Berry <stereotype441@gmail.com>): Fix indexing order for
gl_ClipDistanceIn lowering.  Properly lower bulk assignment of
gl_ClipDistanceIn[i].

TODO: May need to rework for GLSL 1.50.
!UPSTREAM: 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."

Reviewed-by: Paul Berry <stereotype441@gmail.com>

TODO: May not be necessary for GLSL 1.50 style geometry shaders.  Make a test to validate.
!UPSTREAM: mesa: fix transform feedback when a geometry shader is active.

TODO: test
!UPSTREAM: Primitive ID part 1.
!UPSTREAM: Primitive ID part 2.
!UPSTREAM: Primitive ID part 3.
!UPSTREAM: Primitive ID part 4.
!UPSTREAM: i965: turn on GS.

TODO:
- Commit message
i965/gen7: Allow URB_WRITE channel masks to be used.

Previously, brw_urb_WRITE() would unconditionally override the channel
masks in the URB_WRITE message to 0xff (indicating that all channels
should be written to the URB).

For geometry shaders, we need the ability to set the channel masks
programatically, so create a flag to prevent brw_urb_WRITE() from
overriding them.
!UPSTREAM: i965/gen7: Add the ability to send URB_WRITE_OWORD messages.

This will be used by geometry shaders to implement EndPrimitive()
functionality.

TODO:
- Move to appropriate place in series.
!UPSTREAM: i965/gs: implement EndPrimitive() functionality.

Stuff that needs fixing:
- Probably should pack vertex_count and cut_bits into a single register
- Code should be conditioned on whether the shader uses EndPrimitive()