glsl: Add a new glsl_type::sampler_coordinate_components() function.

This computes the number of components necessary to address a sampler
based on its dimensionality.  It will be useful for texturing built-ins.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
glsl: Use sampler_coordinate_components instead of passing it by hand.

We used to pass the number of components actually used for the
coordinate (rather than padding, shadow comparitors, and projectors) by
hand, specifying it on every _texture() call.

The new helper function can just compute this, eliminating a lot of
potential mistakes.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
trace: Support bigger TGSI shaders.

Trivial.
trace: Several enhancements to dump_state.py

- Handle more calls
- Handle more state
- Try to normalize the output a bit, to eliminate spurious differences
llvmpipe: Remove the special path for TGSI_OPCODE_EXP.

It was wrong for EXP.y, as we clamped the source before computing the
fractional part, and this opcode should be rarely used, so it's not
worth the hassle.
os: First check for __GLIBC__ and then for PIPE_OS_BSD

Fixes FTBFS on kfreebsd-*

Debian GNU/kFreeBSD doesn't provide getprogname() since it uses stdlib.h
from glibc. Instead it provides program_invocation_short_name from glibc.

You can find the same order in src/mesa/drivers/dri/common/xmlconfig.c

Cc: "9.2" <mesa-stable@lists.freedesktop.org>
Tested-by: Julien Cristau <jcristau@debian.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
radeon/uvd: use more sane defaults for bitstream buffer size

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
radeon/uvd: move more logic into the common files

Move the code back into the common UVD files since we now
have base structures for R600 and radeonsi.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
mesa: Disallow TransformFeedbackVaryings when active.

Fixes a subcase of Piglit's new ARB_transform_feedback2 api-errors test.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
mesa: Track the vertex program active at BeginTransformFeedback() time.

The next few patches will use this for API error checking.

All of the drivers appear to CALLOC_STRUCT transform feedback objects,
so this should be properly NULL initialized on creation.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
mesa: Reject ResumeTransformFeedback if the wrong program is bound.

This is actually a pretty important error condition: otherwise, you
could set up transform feedback with one program, and resume it with
a program that generates a completely different set of outputs.

Fixes a subcase of Piglit's new ARB_transform_feedback2 api-errors test.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
mesa: Disallow relinking if a program is used by an active XFB object.

Paused transform feedback objects may refer to a program other than the
current program.  If any active objects refer to a program, LinkProgram
must reject the request to relink.

The code to detect this is ugly since _mesa_HashWalk is awkward to use,
but unfortunately we can't use hash_table_foreach since there's no way
to get at the underlying struct hash_table (and even then, we'd need to
handle locking somehow).

Fixes the last subcase of Piglit's new ARB_transform_feedback2
api-errors test.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
radeon: don't emit VGT_STRMOUT_BUFFER_BASE on SI

The register doesn't exist on SI.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
radeon: don't emit streamout state if there are no streamout buffers

This could happen if set_stream_output_targets is called twice
in a row without a draw call in between.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
radeonsi: integrate shared streamout state

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
radeonsi: initialize the first CS like any other

So that the "init" state is always emitted first and not later in draw_vbo.

This fixes streamout where the "init" state, which disables streamout,
was emitted in draw_vbo after streamout was enabled.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
radeonsi: handle rasterizer_discard and set GS_OUT_PRIM_TYPE

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
radeonsi: bind streamout buffers to VGT and the vertex shader

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
radeonsi: implement streamout flush properly

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
radeonsi: fix streamout queries

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>