glsl: Parse the GLSL 1.50 GS layout qualifiers.

Limited semantic checking (compatibility between declarations, checking
that they're in the right shader target, etc.) is done.

v2: Remove stray debug printfs.

v3 (Paul Berry <stereotype441@gmail.com>): Process input layout
qualifiers at ast_to_hir time rather than at parse time, since certain
error conditions depend on the relative ordering between input layout
qualifiers, declarations, and calls to .length().  Remove spurious
'\n's from calls to _mesa_glsl_error().
!UPSTREAM: glsl: Export the compiler's GS layout qualifiers to the gl_shader.

Next step is to validate them at link time.

v2 (Paul Berry <stereotype441@gmail.com>): Don't attempt to export the
layout qualifiers in the event of a compile error, since some of them
are set up by ast_to_hir(), and ast_to_hir() isn't guaranteed to have
run in the event of a compile error.

TODO: why are shader->Geom.InputType and shader->Geom.OutputType set
to ~0 if not set?
glsl: Cross-validate GS layout qualifiers while intrastage linking.

This gets piglit's geometry-basic test running.

TODO: Still need to validate that the GS layout qualifiers don't get used
in places they shouldn't (like an interface block, or a particular shader
input or output)
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: Add EXT_texture_array support for geometry shaders

TODO:

- Move into appropriate place in series

- Would it be better (or even feasible?) to convert the .vert to a
  .glsl and eliminate the redundant functions from the .frag?  Or
  maybe we should have a better mechanism for excluding/including Lod
  versions of texturing functions.
!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
Permit non-ubo input interface arrays to use non-const indexing.

From the GLSL ES 3.00 spec:

    "All indexes used to index a uniform block array must be constant
    integral expressions."

Similar text exists in GLSL specs since 1.50.

When we implemented this, the only type of interface block supported
by Mesa was uniform blocks, so we required all indexes used to index
any interface block to be constant integral expressions.

Now that we are adding interface block support for GLSL 1.50, we need
a more specific check.
glsl: Allow geometry shader input instance arrays to be unsized
WIP: GS input size fixes