!UPSTREAM: i965: Combine 4 boolean args of brw_urb_WRITE into a flags bitfield.

The arguments to brw_urb_WRITE() were getting pretty unwieldy, and we
have to add more flags to support geometry shaders anyhow.

Also plumb these flags through brw_clip_emit_vue() and
brw_set_urb_message().

TODO:
- Test on Gen4-6
!UPSTREAM: i965: Add an opcode for doing a URB write with an offset from a register (needed for GS).

TODO
- Squash in generalization
!UPSTREAM: i965: Add GS_OPCODE_THREAD_END

TODO:
- Verify that I'm returning the correct value from implied_mrf_writes() for this new opcode.
i965/gs: Add GS_OPCODE_SET_WRITE_OFFSET
i965/gs: Add GS_OPCODE_SET_VERTEX_COUNT
!UPSTREAM: i965/gs: add GS visitors
i965: Make some files safe to include from C
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.
!UPSTREAM: i965/gs: make the state atom for compiling Gen7 geometry shaders.

TODO: maybe disentangle
!UPSTREAM: i965: Fix some vec4 gs key setup

TODO:
- Test thoroughly
- Squash
!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: i965/vp: Keep track of the location of the first PROGRAM_STATE_VAR.

Previously, when compiling ARB vertex shader programs (and fixed
function vertex programs), we assumed that the first PROGRAM_STATE_VAR
was associated with the first element of the brw_vec4_prog_data::param
array.  However, in the patch that follows, we will need to allocate
space for clip plane uniforms before PROGRAM_STATE_VAR uniforms, so
that will no longer be true.

To prevent regressions, this patch records the location of the first
PROGRAM_STATE_VAR uniform, and uses that as an offset when processing
any ARB vertex program instruction that refers to a state var.

TODO: probably unnecessary for GLSL 1.50 style geometry shaders
!UPSTREAM: i965/gs: Assign clip plane uniform registers before emitting code.

The uniform registers for clip planes need to be assigned before we
try to emit the dot products that convert gl_ClipVertex into
gl_ClipDistance.

In vertex shaders the dot products are emitted by the call
emit_thread_end(), so it is safe to wait until just before that call
to set up the uniform registers for clip planes.  But in geometry
shaders, the dot products are emitted as we're traversing the IR
(since they happen during the shader's call to EmitVertex()).  So we
need to make sure the uniform registers are set up before then.

TODO: probably unnecessary for GLSL 1.50 style geometry shaders
!UPSTREAM: i965: turn on GS

TODO:
- Commit message
!UPSTREAM: i965/gs: write out cut bits

Stuff that needs fixing:
- Not yet configuring 3DSTATE_GS to indicate that cut bits are present
- Not handling >31 output vertices correctly
- Probably should pack vertex_count and cut_bits into a single register
- Code should be conditioned on whether the shader uses EndPrimitive()
- At end of thread, shouldn't do the write if vertex_count is a multiple of 32
- At end of thread, should write to the appropriate DWORD
- At EmitVertex time, should write cut bits if vertex_counter%32 == 31
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.