i965/Gen4-5: ensure VUE slots for clipdistance are valid if user clipping is enabled.

V2: We don't particularly care where they fall in the VUE map, as long
as they are allocated somewhere, and occupy two contiguous slots. Don't
fiddle with the SF layout at all -- there's no need.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
i965/vs: Do legacy clip lowering earlier

We need to produce clip flags for the vertex header on Gen4/5, so
clip plane lowering has to be done before we try to emit the flags/psiz
attribute.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
i965/clip: Enable interpolation of clip distances

Previously we had disabled interpolation of the clip distances as a
special case, since they were unused.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
i965: add new VS_OPCODE_UNPACK_FLAGS_SIMD4X2

Splits the bottom 8 bits of f0.0 for further wrangling
in a SIMD4x2 program. The 4 bits corresponding to the channels in each
program flow are copied to the LSBs of dst.x visible to each flow.

This is useful for working with clipping flags in the VS.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
i965/Gen4-5: Set clip flags from clip distances

V2: - Use the new VS_OPCODE_UNPACK_FLAGS_SIMD4X2 to correctly split the
      flags for the two vertices being processed together.
    - Don't apply bogus masking of clip flags. The set of plane enables
      aren't included in the shader key, and we wouldn't want the
      recompiles anyway.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
i965/clip: Track offset into the vertex for clipdistance

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
i956/clip: push dp4 into load_clip_distance

Soon the dp4 is only going to be used for fixed clip planes.

V2: Remove old inaccurate comment about the behavior of this function;
add a better explanation above.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
i965/clip: Use clip distances for all user clipping

V2: Adjust explanation of load_clip_distance()

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
i965/clip: remove spurious clipvertex param

Nothing in the clipper uses gl_ClipVertex any more, so we don't care
where it is.

V2: Don't bother fishing out the clipvertex offset either.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
i965/clip: Support clip distances for line clipping

This does the same thing as we do for triangle clipping -- select the
appropriate source (either dot(hpos,fixed plane) or a clipdistance
slot).

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
i965: get rid of clip plane compaction
i965: allow 8 user clip planes on CTG+

There's no need to use a clip flag for NEGW on these gens, so
no reason we can't just enable 8 planes.

V2: - Bump (and document!) MAX_VERTS in the clip code.
    - Fix clip flag masks in the clip unit state and in the shader
      prolog
    - Move this to the end of the series for less breakage.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Paul Berry <stereotype441@gmail.com>