r200: fix fog coordinate emit

Noticed by dungeon on phoronix:
http://phoronix.com/forums/showthread.php?65408-Radeon-R100-R200-Mesa-Driver-Sees-Attention&p=247018#post247018

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

Note: this is a candidate for the stable branches.
(cherry picked from commit afdd6f8c34705eae5048da03329750836bcecf44)
radeon: fix fog coordinate emit

Noticed by dungeon on phoronix:
http://phoronix.com/forums/showthread.php?65408-Radeon-R100-R200-Mesa-Driver-Sees-Attention&p=247018#post247018

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

Note: this is a candidate for the stable branches.
(cherry picked from commit e77c495d09105a1b6a13fd62d0d3585b019e1c66)
Remove -ffast-math from default CFLAGS

Fixes glsl-const-folding-01. inversesqrt(1.0) != 1.0 was evaluating as
true.

Signed-off-by: Matt Turner <mattst88@gmail.com>
(cherry picked from commit 2fdbbeca43e7b57095774e4228e6eea75a180fab)
llvmpipe: fix symbol conflict on Haiku

NOTE: This is a candidate for the 8.0 branch.

Signed-off-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 1550b0668e8914f12ed314d347f59c89ba42c20c)
svga: fix typedef conflicts on Haiku

NOTE: This is a candidate for the 8.0 branch.

Signed-off-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 32876a452f368529392619b1d2552594317e8420)
mesa: Don't use newlocale on Haiku

NOTE: This is a candidate for the 8.0 branch.

Signed-off-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 02a1f9f14d8c2c5d9f0a2592b4a52450c9e7ccfe)
glsl: Don't use newlocale on Haiku

NOTE: This is a candidate for the 8.0 branch.

Signed-off-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 873f3ae92e1d8a17ea228b38b4c20346d54ae045)
mesa: Fix handling of glCopyBufferSubData() for src == dst.

Fixes piglit ARB_copy_buffer-overlap, on swrast, which previously
assertion failed.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit 531e44415b078db105d0439ea90b3ea3bc3b0f7b)
mesa: remove LSB-first pixel packing check in glReadPixels

GL_UNPACK_LSB_FIRST only applies to bitmap data, not glReadPixels.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit 343100d1fcd5ee705e8b99cd9ff1259001f15081)
mesa: fix error in _mesa_format_matches_format_and_type() for RGB888

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit b019228d6bb00291315f2a4045fb30af89715433)
mesa: add BGR888 code in _mesa_format_matches_format_and_type()

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit 966720f507f71d2dce1f3499d7b29d98b615effe)
mesa/format_unpack: add LUMINANCE 8/16 UINT/INT

This just copies what the LUMINANCE_ALPHA bits do.

Fixes piglit tests on softpipe complaining about missing unpack.

Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit fef395c0c3a011cc23cc638358c116accf35b7a2)
vbo: fix node_attrsz[] usage in vbo_bind_vertex_list()

The node_attrsz[] array is initially copied from the node->attrsz[]
array but some values get rewritten.  Thereafter, we need to use the
node_attrsz[] values.

Fixes a bug when replaying a display list that uses generic vertex
array[16] (at least).

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit e53557996ece5ab877652b8f83ae40bb4c483453)
mesa: check_index_bounds off-by-one fix

in check_index_bounds the comparison needs to be "greater equal" since
contrary to the name _MaxElement is the count of the array (this matches
similar code in vbo_exec_DrawRangeElementsBaseVertex).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 1f4a853b1e4691400ab832c589b044b659c20c06)
Have __glImageSize handle format GL_DEPTH_STENCIL_NV the same way as the server does

There is a mismatch between the way the X server and GLX library
calculates the image size for format GL_DEPTH_STENCIL(|_NV|_EXT)

See https://bugs.freedesktop.org/show_bug.cgi?id=30102

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
(cherry picked from commit 8937c166efaaae6e05d8c8cd30be220b577729b8)
i965/fs: Move GL_CLAMP handling to coordinate setup.

We should be able to merge self-move instruction into the MRF move
anyway, and this simplifies things for the next commit.

NOTE: This is a candidate for the 8.0 release branch.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit 07e621c52329cd17b97051a26493626228d043b9)
i965/fs: Implement GL_CLAMP behavior on texture rectangles on gen6+.

We were doing saturate-based clamping on the [0,width] or [0,height]
coordinate, which meant only the first pixel was addressable.

Fixes piglit ARB_texture_rectangle/texwrap-RECT-bordercolor

NOTE: This is a candidate for the 8.0 release branch.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit 7c857a6b159debf76d4661f494fd2c97d205b5b1)
glsl: Avoid excessive loop unrolling.

Avoid unrollong loops that are either nested loops or
where the loop body times the unroll count is huge.

The change is far from being perfect but it extends the
loop unrolling decision heuristic by some additional
safeguard. In particular this cuts down compilation of
a shader precomputing atmospheric scattering integral
tables containing two nesting levels in a loop from
something way beyond some minutes (I never waited for
it to finish) to some fractions of a second.

This fixes piglit tests glsl-fs-unroll-explosion and
glsl-vs-unroll-explosion on r600g.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
(cherry picked from commit 67007080b716c7e51039a381f407ababd68230f7)
mesa: Fix push/pop of multisample coverage invert.

In the table of of push/pop attributes, this one doesn't fall under
the enable group.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 4b6e45c7d6a60be71540109866c71fe0d2f35569)
mesa: Include the multisample enables under GL_MULTISAMPLE_BIT attrib as well.

Fixes (with the previous commit) piglit GL_ARB_multisample/pushpop.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit b631b471d86747c8bb20c6c9c413ff1ff2ad6486)