radeonsi: Refactor shader input / output handling code

In preparation for adding geometry shader support.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
radeonsi: Initial geometry shader support

Partly based on the corresponding r600g work by Vadim Girlin and Dave
Airlie.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
radeonsi: Fix handling of geometry shader output vertex ID

It needs to increment at shader runtime, not at shader compile time, as
the geometry shader can emit vertices in loops. LLVM automagically
converts the ID back to an immediate value if its value can be
determined at compile time.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
radeonsi: Generalize counting of shader parameters

Now it covers ES->GS as well as VS->PS.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
radeonsi: Handle TGSI_SEMANTIC_PRIMID

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
radeonsi: Handle adjacency primitives

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
radeonsi: Take GS into account for VS state in more places

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
radeonsi: Also export clip distances with geometry shader

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
radeonsi: Really dump TGSI code before any TGSI->LLVM conversion attempt

While we're at it, use the local variable 'sel'.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
radeonsi: Properly match ES outputs to GS inputs

Fixes piglit vs-gs-arrays-within-blocks-pass.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
radeonsi: Simplify shader PM4 state handling

Just always bind the current states before drawing.

Besides the simplification, as a bonus this makes sure the VS hardware
shader stage always uses the GS copy shader when a geometry shader is
active, fixing a number of GS related piglit tests.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
radeonsi: Fix streamout from geometry shader

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
radeonsi: Pass VS resource descriptors to the HW ES shader stage as well

This makes sure constants and samplers work in the vertex shader even
when a geometry shader is active.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
radeonsi: We don't support indirect addressing of geometry shader inputs

Fixes piglit spec/glsl-1.50/execution/geometry/dynamic_input_array_index

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
radeonsi: Geometry shader micro-optimizations

Move parameter loads out of loops, and use the instruction offset
instead of a VGPR for the vertex attribute offset when writing to the
ESGS ring buffer.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
radeonsi: Enable OpenGL 3.3

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
radeonsi: Put GS ring buffer descriptors with streamout buffer descriptors

And mark the constant buffers as read only for the GPU again.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
i915g: support more PIPE_CAPs
softpipe: Use alignment of 64 instead of 16 for buffer allocation

v2: Changed allocation alignment in softpipe_displaytarget_layout.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
softpipe: Set PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT to 64

v2: Fixed setting switch cases prior to
PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT incorrectly.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>