mesa: fix error reported on gTexSubImage2D when level not valid

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
vc4: Optimize the other case of SEL_X_Y wih a 0 -> SEL_X_0(a).

Cleans up some output to be more obvious in a piglit test I'm looking at.
vc4: Actually clear the context's dirty flags.

I was trying to skip state updates when !dirty, and suspiciously
everything was always dirty.
vc4: Don't look up the compiled shaders unless state has changed.

Improves simulated norast performance on a little benchmark by 38.0965%
+/- 3.27534% (n=11).
vc4: Use the fnv1 hash function instead of gallium util's crc32.

Improves simulated norast performance on a little benchmark by 13.4012%
+/- 2.08459% (n=13).
glsl: improve accuracy of atan()

Our current atan()-approximation is pretty inaccurate at 1.0, so
let's try to improve the situation by doing a direct approximation
without going through atan.

This new implementation uses an 11th degree polynomial to approximate
atan in the [-1..1] range, and the following identitiy to reduce the
entire range to [-1..1]:

atan(x) = 0.5 * pi * sign(x) - atan(1.0 / x)

This range-reduction idea is taken from the paper "Fast computation
of Arctangent Functions for Embedded Applications: A Comparative
Analysis" (Ukil et al. 2011).

The polynomial that approximates atan(x) is:

x   * 0.9999793128310355 - x^3  * 0.3326756418091246 +
x^5 * 0.1938924977115610 - x^7  * 0.1173503194786851 +
x^9 * 0.0536813784310406 - x^11 * 0.0121323213173444

This polynomial was found with the following GNU Octave script:

x = linspace(0, 1);
y = atan(x);
n = [1, 3, 5, 7, 9, 11];
format long;
polyfitc(x, y, n)

The polyfitc function is not built-in, but too long to include here.
It can be downloaded from the following URL:

http://www.mathworks.com/matlabcentral/fileexchange/47851-constraint-polynomial-fit/content/polyfitc.m

This fixes the following piglit test:
shaders/glsl-const-folding-01

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
ilo: disassemble compacted instructions

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
gallium: Add tokens for DragonFly BSD.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Acked-by: Brian Paul <brianp@vmware.com>
clover: Use unreachable() from util/macros.h instead of assert(0).

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
clover: Add semantic information to module::argument for implicit parameter passing.

Reviewed-by: Jan Vesely <jan.vesely@rutgers.edu>
clover: Pass execution dimensions and offset to the kernel as implicit arguments.

Reviewed-by: Jan Vesely <jan.vesely@rutgers.edu>
clover: Append implicit arguments to the kernel argument list.

[ Francisco Jerez: Split off from a larger patch, and take a slightly
  different approach for passing the implicit arguments around. ]

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
clover: Fix unintended fall-through in kernel::argument::bind.
radeonsi: assume ClipDistance usage mask is always 0xf

No code in Mesa sets the usage mask to any other value.
The final mask is AND'ed with enable bits from the rasterizer state anyway.

If somebody implements setting usage masks in st/mesa, we can use
tgsi_shader_info to get it more easily.

This is a prerequisite for the following commit.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
radeonsi: remove vs.ucps_enabled from the shader key

Written CLIPDIST outputs are simply disabled in PA_CL_VS_OUT_CNTL.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
radeonsi: don't recompile shaders when changing nr_cbufs from 0 to 1

Both cases are equivalent.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
radeonsi: use tgsi_shader_info in si_llvm_emit_es_epilogue

tgsi_shader_info contains everything we need.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
radeonsi: don't rely on shader->output in si_llvm_emit_fs_epilogue

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
radeonsi: use tgsi_shader_info in fetch_input_gs

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
radeonsi: use tgsi_shader_info in si_shader_ps

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