!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()
i965/gs: Fixup gl_PointSize on entry to geometry shaders.

gl_PointSize is stored in the w component of VARYING_SLOT_PSIZ, but
the geometry shader infrastructure assumes that it should look for all
geometry shader inputs of type float in the x component.  So when
compiling a geomtery shader that uses a gl_PointSize input, fix it up
during the shader prolog by moving the x component to the w component.

This is similar to how we emit fixups and workarounds for vertex
shader attributes.
!UPSTREAM: vbo: Update vbo_count_tessellated_primitives for new primitive types.

TODO: test.
!UPSTREAM: i965: Add new primitive types.

TODO: test.
!UPSTREAM: Debug optimization passes
i965/gs: Support UBOs by generating surface state and binding tables.

All but two of the piglit GLSL 1.50/uniform_buffer tests work, and
maxuniformblocksize and referenced-by-shader work.
!UPSTREAM: Expose GLSL 1.50 and GL 3.2 core contexts.

This lets me run tests normally, since globally doing GL version override
can break tests that require a compatibility context.
!UPSTREAM: Fix GS sampling

TODO:

- Seems like these functions ought to be rewritten to loop over
  program types.

- Handling of null gs seems clumsy.

- Can the same sampler be used in multiple shader stages (e.g. both VS
  and FS)?  If not, then it seems like we're going to run out of
  samplers in our bitfield.  If so, then is it guaranteed that
  fs->SamplerUnits[s] == gs->SamplerUnits[s]?  If so this needs an
  explanatory comment.  If not, this code seems broken.

- Decide what to do about code duplication.  Either I should de-dup
  the code or I suppose I should only update the gen7 code.

- Move to appropriate place in the series.
!UPSTREAM: Fix brwBindProgram
!UPSTREAM: Update brwNewProgram for geometry shaders
!UPSTREAM: Fix color clamping for VS when GS in use

TODO:
- Move to appropriate part of patch series.
- Probably unnecessary for GLSL 1.50 style geometry shaders
!UPSTREAM: mesa: Adapt ff_fragment_shader to account for geometry shaders.

The fixed-function fragment shader is built differently depending on
what outputs are generated by the previous stage in the pipeline.
Previously, that stage was known to be the vertex shader.  Now it can
be either the vertex or geometry shader.

TODO:
- Make sure no regressions
- Move to appropriate point in series
- Probably unnecessary for GLSL 1.50 style geometry shaders
!UPSTREAM: glsl: Add new geometry shader constants.

TOOD:
- These constants need to be plumbed through to the driver back-ends.
!UPSTREAM: WIP: ad gl_in to builtin_variables.cpp
main: Expose geometry shader constants in GL 3.0.