mesa.git
11 years agoglsl/preprocessor: Extract version directive processing into a function.
Paul Berry [Thu, 2 Aug 2012 20:06:45 +0000 (13:06 -0700)]
glsl/preprocessor: Extract version directive processing into a function.

Version directive handling is going to have to be used within two
parser rules, one for desktop-style version directives (e.g. "#version
130") and one for the new ES-style version directive (e.g. "#version
300 es"), so this patch moves it to a function that can be called from
both rules.

No functional change.

[mattst88] v2: Use intmax_t instead of int for version argument. Would
otherwise write garbage after #version since PRIiMAX was reading 64-bits
instead of 32.

[idr] v3: A later commit fixes the caller of
_glcpp_parser_handle_version_declaration to pass the correct number of
parameters.  Fix it in the patch that changes the interface instead.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Carl Worth <cworth@cworth.org>
11 years agoglsl: Enable GLSL ES 3.00 features inherited from desktop GLSL.
Paul Berry [Thu, 2 Aug 2012 15:18:12 +0000 (08:18 -0700)]
glsl: Enable GLSL ES 3.00 features inherited from desktop GLSL.

This patch turns on the following features for GLSL ES 3.00:

- Array constructors, whole array assignment, and array comparisons.
- Second and third operands of ?: may be arrays.
- Use of "in" and "out" qualifiers on globals.
- Bitwise and modulus operators.
- Integral vertex shader inputs.
- Range-checking of literal integers.
- array.length method.
- Function calls may be constant expressions.
- Integral varyings must be qualified with "flat".
- Interpolation and centroid qualifiers may not be applied to vertex
  shader inputs.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Carl Worth <cworth@cworth.org>
11 years agoglsl: parse GLSL ES 3.00 keywords correctly.
Paul Berry [Thu, 2 Aug 2012 15:17:55 +0000 (08:17 -0700)]
glsl: parse GLSL ES 3.00 keywords correctly.

GLSL ES 3.00 adds the following keywords over GLSL 1.00: uint,
uvec[2-4], matNxM, centroid, flat, smooth, various samplers, layout,
switch, default, and case.

Additionally, it reserves a large number of keywords, some of which
were already reserved in versions of desktop GL that Mesa supports,
some of which are new to Mesa.

A few of the reserved keywords in GLSL ES 3.00 are keywords that are
supported in all other versions of GLSL: attribute, varying,
sampler1D, sampler1DShador, sampler2DRect, and sampler2DRectShadow.

This patch updates the lexer to handle all of the new keywords
correctly when the language being parsed is GLSL 3.00 ES.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Carl Worth <cworth@cworth.org>
11 years agoglsl: Rework lexer keyword handling in preparation for GLSL 3.00 ES.
Paul Berry [Thu, 2 Aug 2012 02:04:59 +0000 (19:04 -0700)]
glsl: Rework lexer keyword handling in preparation for GLSL 3.00 ES.

This patch expands the lexer KEYWORD macro to take two additional
arguments: the GLSL ES versions in which the given keyword was first
reserved, and supported, respectively.  This will allow us to
trivially add support for GLSL 3.00 ES keywords, even though the set
of GLSL 3.00 ES keywords is neither a subset or a superset of the
keywords corresponding to any desktop GLSL version.

The new KEYWORD macro makes use of the
_mesa_glsl_parse_state::is_version() function, so it accepts 0 as
meaning "unsupported" (rather than 999, which we used previously).

Note that a few keywords ("packed" and "row_major") are supported
*either* when GLSL 1.40 is in use or when ARB_uniform_buffer_obj
support is enabled.  Previously, we handled these by cleverly taking
advantage of the fact that the KEYWORD macro didn't parenthesize its
arguments in the usual way.  Now they are handled more
straightforwardly, with a new macro, KEYWORD_WITH_ALT.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Carl Worth <cworth@cworth.org>
11 years agoglsl: Make use of new _mesa_glsl_parse_state::check_version() function.
Paul Berry [Sun, 5 Aug 2012 16:57:01 +0000 (09:57 -0700)]
glsl: Make use of new _mesa_glsl_parse_state::check_version() function.

Previous to this patch, we were not very consistent about the errors
we generate when a shader tried to use a feature that is prohibited in
the current GLSL version.  Some error messages failed to mention the
GLSL version currently in use (or did so inaccurately), and some error
messages failed to mention the first GLSL version in which the given
feature is allowed.

This patch reworks all of the error checks to use the check_version()
function, which produces error messages in a standard form
(approximately "$FEATURE forbidden in $CURRENT_GLSL_VERSION
($REQUIRED_GLSL_VERSION required).").

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Carl Worth <cworth@cworth.org>
11 years agoglsl: Make use of new _mesa_glsl_parse_state::is_version() function.
Paul Berry [Wed, 1 Aug 2012 21:50:05 +0000 (14:50 -0700)]
glsl: Make use of new _mesa_glsl_parse_state::is_version() function.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Carl Worth <cworth@cworth.org>
11 years agoglsl: Add GLSL version query functions.
Paul Berry [Thu, 2 Aug 2012 02:09:24 +0000 (19:09 -0700)]
glsl: Add GLSL version query functions.

With the advent of GLSL 3.00 ES, the version checks we perform in the
GLSL compiler (to determine which language features are present) will
become more complicated.  To reduce the complexity, this patch adds
functions check_version() and is_version() to _mesa_glsl_parse_state.
These functions take two version numbers: a desktop GLSL version and a
GLSL ES version, and return a boolean indicating whether the GLSL
version being compiled is at least the required version.  So, for
example, is_version(130, 300) returns true if the GLSL version being
compiled is at least desktop GLSL 1.30 or GLSL 3.00.

The check_version() function additionally produces an error message if
the version check fails, informing the user of which GLSL version(s)
support the given feature.

[v2, idr]: Add PRINTFLIKE annotation to the new method.  The numbering of th
parameters is correct because GCC is silly.

[v3, idr]: Fix copy-and-paste error in the comment before
_mesa_glsl_parse_state::is_version.  Noticed by Ken.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Carl Worth <cworth@cworth.org>
11 years agoglsl: Compute version_string on the fly.
Paul Berry [Thu, 2 Aug 2012 13:45:30 +0000 (06:45 -0700)]
glsl: Compute version_string on the fly.

Fixes a bug where version_string would be left uninitialized if no
GLSL "#version" directive was used.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Carl Worth <cworth@cworth.org>
11 years agoglsl: Make a function to express a GLSL version ir human-readable form.
Paul Berry [Thu, 2 Aug 2012 01:36:57 +0000 (18:36 -0700)]
glsl: Make a function to express a GLSL version ir human-readable form.

This will be useful in generating more helpful error messages,
especially with the addition of GLSL 3.00 ES support.

[v2, idr]: Rename ctx parameter to mem_ctx

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Carl Worth <cworth@cworth.org>
11 years agoglsl: Simplify symbol table version checking.
Paul Berry [Thu, 2 Aug 2012 00:44:02 +0000 (17:44 -0700)]
glsl: Simplify symbol table version checking.

Previously, we stored the GLSL language version in the
glsl_symbol_table struct.  But this was unnecessary--all
glsl_symbol_table needs to know is whether functions and variables
have separate namespaces (they do in GLSL 1.10 only).

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Carl Worth <cworth@cworth.org>
11 years agomesa: Add ARB_ES3_compatibility flag.
Paul Berry [Mon, 6 Aug 2012 17:22:44 +0000 (10:22 -0700)]
mesa: Add ARB_ES3_compatibility flag.

Adding this now makes it easier to develop and test GLES3 features, since we
can do initial development and testing using desktop GL.  Later GLSL compiler
patches check for either ctx->Extensions.ARB_ES3_compatibility or
_mesa_is_gles3 to allow certain features (i.e., "#version 300 es").

[v2, idr]: Just edits to the commit message.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Carl Worth <cworth@cworth.org>
11 years agoradeonsi: Fix cube texture coordinates.
Michel Dänzer [Mon, 3 Dec 2012 11:46:30 +0000 (12:46 +0100)]
radeonsi: Fix cube texture coordinates.

8 more piglits.

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
11 years agoradeon/llvm: Export prepare_cube_coords helper to driver.
Michel Dänzer [Mon, 3 Dec 2012 11:45:41 +0000 (12:45 +0100)]
radeon/llvm: Export prepare_cube_coords helper to driver.

To be used by radeonsi.

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
11 years agomesa: use rand() instead of random()
Brian Paul [Thu, 6 Dec 2012 18:54:36 +0000 (11:54 -0700)]
mesa: use rand() instead of random()

As Vinson Lee did in commit bb284669f85a32900bfec648d68ba4c4300772f4
in hash_table.c

Signed-off-by: Brian Paul <brianp@vmware.com>
11 years agomesa: validate that sync objects were created by mesa
Jordan Justen [Tue, 4 Dec 2012 09:24:07 +0000 (01:24 -0800)]
mesa: validate that sync objects were created by mesa

Previously, the user could send in a pointer that was not created
by mesa. When we dereferenced that pointer, there would be an
exception.

Now we keep a set of pointers and verify that the pointer
exists in that set before dereferencing it.

Note: This fixes several crashing gles3conform tests.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agomain/syncobj: return GL_INVALID_VALUE for invalid sync objects
Jordan Justen [Tue, 4 Dec 2012 09:17:23 +0000 (01:17 -0800)]
main/syncobj: return GL_INVALID_VALUE for invalid sync objects

Note: The GL/GLES3 web man pages don't seem to properly
document glWaitSync's error when the sync object is invalid.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agomesa: add set support (stores a set of pointers)
Eric Anholt [Tue, 4 Dec 2012 09:03:57 +0000 (01:03 -0800)]
mesa: add set support (stores a set of pointers)

From: git://people.freedesktop.org/~anholt/hash_table

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
[jordan.l.justen@intel.com: minor rework for mesa]
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agollvmpipe: Fix statement before declaration.
José Fonseca [Thu, 6 Dec 2012 17:23:11 +0000 (17:23 +0000)]
llvmpipe: Fix statement before declaration.

11 years agoutil: Add util_copy_box helper.
José Fonseca [Wed, 5 Dec 2012 20:15:40 +0000 (20:15 +0000)]
util: Add util_copy_box helper.

Must users of util_copy_rect() need or should deal with volumes.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agogallium/util: Move the util_copy/fill_rect into u_surface.
José Fonseca [Wed, 5 Dec 2012 09:04:21 +0000 (09:04 +0000)]
gallium/util: Move the util_copy/fill_rect into u_surface.

u_rect.h said these should move to a different file, and u_surface seems
a better home.

Leave #include "util/u_surface.h" to avoid having to touch thousand of
files.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agogallium/os: Cleanup up os_time_get/os_time_get_nano.
José Fonseca [Wed, 5 Dec 2012 08:59:21 +0000 (08:59 +0000)]
gallium/os: Cleanup up os_time_get/os_time_get_nano.

- Re-implement os_time_get in terms of os_time_get_nano() for consistency
- Use CLOCK_MONOTONIC as recommended
- Only use clock_gettime on Linux for now.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agogallium/os: Fix os_time_sleep() on Windows for small durations.
José Fonseca [Tue, 4 Dec 2012 19:44:08 +0000 (19:44 +0000)]
gallium/os: Fix os_time_sleep() on Windows for small durations.

Prevents undetermined sleeps.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agometa: Disable GL_FRAGMENT_SHADER_ATI in MESA_META_SHADER
Stefan Dösinger [Wed, 5 Dec 2012 22:08:21 +0000 (23:08 +0100)]
meta: Disable GL_FRAGMENT_SHADER_ATI in MESA_META_SHADER

Fixes clears in Wine on r200.

NOTE: This is a candidate for stable release branches.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agoradeon: Initialize swrast before setting limits
Stefan Dösinger [Wed, 5 Dec 2012 22:08:20 +0000 (23:08 +0100)]
radeon: Initialize swrast before setting limits

NOTE: This is a candidate for stable release branches.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agor200: Initialize swrast before setting limits
Stefan Dösinger [Wed, 5 Dec 2012 22:08:19 +0000 (23:08 +0100)]
r200: Initialize swrast before setting limits

Otherwise the driver announces 4096 vertex shader constants and other
way too high limits.

NOTE: This is a candidate for stable release branches.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agomesa: fix compiler warnings when including GL/gl.h with other gl headers
Matthew Waters [Sun, 2 Dec 2012 11:28:34 +0000 (22:28 +1100)]
mesa: fix compiler warnings when including GL/gl.h with other gl headers

GL/gl.h provides some definitions (GL_FALSE, GL_ONE, etc) that have
the same value as other gl headers but are represented differently
(0 vs 0x0 and 1 vs 0x1).
This causes compiler warnings about redefining such definitions when
including GL/gl.h with other gl headers.

Fixes http://bugs.freedesktop.org/show_bug.cgi?id=57802

Signed-off-by: Brian Paul <brianp@vmware.com>
11 years agogallivm: Fix lerping of (un)signed normalized numbers.
José Fonseca [Thu, 6 Dec 2012 09:30:53 +0000 (09:30 +0000)]
gallivm: Fix lerping of (un)signed normalized numbers.

Several issues actually:

- Fix a regression in unsigned normalized in the rescaling
  [0, 255] to [0, 256]

- Ensure we use signed shifts where appropriate (instead of
  unsigned shifts)

- Refactor the code slightly -- move all the logic inside
  lp_build_lerp_simple().

This change, plus an adjustment in the tolerance of signed normalized
results in piglit fbo-blending-formats fixes bug 57903

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agogallivm: Fix lp_build_print_value of smaller integer types.
José Fonseca [Thu, 6 Dec 2012 08:50:46 +0000 (08:50 +0000)]
gallivm: Fix lp_build_print_value of smaller integer types.

They need to be converted to the native integer type to prevent garbage
in higher order bits from being printed.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agollvmpipe: remove unused variable
Brian Paul [Thu, 6 Dec 2012 15:34:08 +0000 (08:34 -0700)]
llvmpipe: remove unused variable

11 years agodraw: remove some dead constant buffer code
Brian Paul [Thu, 6 Dec 2012 00:18:30 +0000 (17:18 -0700)]
draw: remove some dead constant buffer code

Remove the draw_vs_set_constants() and draw_gs_set_constants()
functions and the draw->vs.aligned_constants,
draw->vs.aligned_constant_storage and draw->vs.const_storage_size
fields.  None of it was used.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
11 years agoandroid: Fix build of libmesa_program
Chad Versace [Thu, 6 Dec 2012 05:34:26 +0000 (21:34 -0800)]
android: Fix build of libmesa_program

Commit 4097308 fixed the build in a questionable way. It worked at the
time, but, as Ian pointed out, the fix would likely fail at a future
commit due to the indeterminism of parallel builds. And that's exactly
what happened; the fix no longer works. `mm -j4` on Fedora 17 fails for
me.

The problem is that there is no rule for program_parse.tab.h. To fix that,
this patch adds a rule that makes program_parse.tab.c depend on
program_parse.tab.h. Technically, the c file does not depend on the
h file. However, because the two files are generated together by a single
invocation of Bison, any rule that forces execution of Bison is
sufficient.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
11 years agollvmpipe: EXT_transform_feedback support (v1.1)
Dave Airlie [Tue, 4 Dec 2012 20:50:07 +0000 (06:50 +1000)]
llvmpipe: EXT_transform_feedback support (v1.1)

I'd written most of this ages ago, but never finished it off.

This passes 115/130 piglit tests so far. I'll look into the
others as time permits.

v1.1: fix calloc return check as suggested by Jose.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agoi965: Add a debug flag for counting cycles spent in each compiled shader.
Eric Anholt [Tue, 27 Nov 2012 22:10:52 +0000 (14:10 -0800)]
i965: Add a debug flag for counting cycles spent in each compiled shader.

This can be used for two purposes: Using hand-coded shaders to determine
per-instruction timings, or figuring out which shader to optimize in a
whole application.

Note that this doesn't cover the instructions that set up the message to
the URB/FB write -- we'd need to convert the MRF usage in these
instructions to GRFs so that our offsets/times don't overwrite our
shader outputs.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
v2: Check the timestamp reset flag in the VS, which is apparently
    getting set fairly regularly in the range we watch, resulting in
    negative numbers getting added to our 32-bit counter, and thus large
    values added to our uint64_t.
v3: Rebase on reladdr changes, removing a new safety check that proved
    impossible to satisfy.  Add a comment to the AOP defs from Ken's
    review, and put them in a slightly more sensible spot.
v4: Check timestamp reset in the FS as well.

11 years agoi965: Add a flag for instructions with normal writemasking disabled.
Eric Anholt [Wed, 28 Nov 2012 22:16:03 +0000 (14:16 -0800)]
i965: Add a flag for instructions with normal writemasking disabled.

For getting values from the new timestamp register, the channels we
load have nothing to do with the pixels dispatched.

11 years agor600g: use default action for min/max opcode in tgsi to llvm
Vincent Lejeune [Thu, 29 Nov 2012 22:46:15 +0000 (23:46 +0100)]
r600g: use default action for min/max opcode in tgsi to llvm

Reveiwed-by: Tom Stellard <thomas.stellard at amd.com>
11 years agogallivm: Have a default emit function for min/max opcode
Vincent Lejeune [Thu, 29 Nov 2012 22:43:31 +0000 (23:43 +0100)]
gallivm: Have a default emit function for min/max opcode

Reveiwed-by: Tom Stellard <thomas.stellard at amd.com>
11 years agor600g: use default action for fdiv/rcp opcode
Vincent Lejeune [Thu, 29 Nov 2012 22:45:30 +0000 (23:45 +0100)]
r600g: use default action for fdiv/rcp opcode

Reveiwed-by: Tom Stellard <thomas.stellard at amd.com>
11 years agogallivm: have a default emit function for fdiv/rcp
Vincent Lejeune [Thu, 29 Nov 2012 22:43:05 +0000 (23:43 +0100)]
gallivm: have a default emit function for fdiv/rcp

Reveiwed-by: Tom Stellard <thomas.stellard at amd.com>
11 years agor600g: Use default mul/mad function for tgsi-to-llvm
Vincent Lejeune [Tue, 27 Nov 2012 23:35:55 +0000 (00:35 +0100)]
r600g: Use default mul/mad function for tgsi-to-llvm

Reveiwed-by: Tom Stellard <thomas.stellard at amd.com>
11 years agoglsl: add new variable declaration in function body in lower_output_read
Vincent Lejeune [Fri, 23 Nov 2012 16:53:06 +0000 (17:53 +0100)]
glsl: add new variable declaration in function body in lower_output_read

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
11 years agodraw: set precalc_flat flag for AA lines too
Brian Paul [Tue, 4 Dec 2012 23:32:01 +0000 (16:32 -0700)]
draw: set precalc_flat flag for AA lines too

Fixes flat shading for AA lines.  demos/src/trivial/line-smooth is a
test case which hits this.

Note: This is a candidate for the stable branches.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agomesa: expose ARB_texture_cube_map_array in core contexts as well
Chris Forbes [Wed, 5 Dec 2012 05:03:04 +0000 (18:03 +1300)]
mesa: expose ARB_texture_cube_map_array in core contexts as well

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@gmail.com>
11 years agoscons: Require drm to build gallium/state_trackers/egl/x11/x11_screen.c.
Vinson Lee [Tue, 4 Dec 2012 07:24:12 +0000 (23:24 -0800)]
scons: Require drm to build gallium/state_trackers/egl/x11/x11_screen.c.

x11_screen.c includes xf86drm.h, which comes from libdrm-dev.

This patch fixes this build error.

  Compiling src/gallium/state_trackers/egl/x11/x11_screen.c ...
src/gallium/state_trackers/egl/x11/x11_screen.c:30:21: fatal error: xf86drm.h: No such file or directory

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
11 years agoi965/fs: Add support for uniform array access with a variable index.
Eric Anholt [Fri, 9 Nov 2012 00:06:24 +0000 (16:06 -0800)]
i965/fs: Add support for uniform array access with a variable index.

Serious Sam 3 had a shader hitting this path, but it's used rarely so it
didn't show a significant performance difference (n=7).  It does reduce
compile time massively, though -- one shader goes from 14s compile time
and 11723 instructions generated to .44s and 499 instructions.

Note that some shaders lose 16-wide mode because we don't support
16-wide and pull constants at the moment (generally, things looping over
a few-element array where the loop isn't getting unrolled).  Given that
those shaders are being generated with 15-20% fewer instructions, it
probably outweighs the loss of 16-wide.

11 years agoi965/fs: Conditionalize constant-index UBO load code and add comments.
Eric Anholt [Thu, 8 Nov 2012 23:55:36 +0000 (15:55 -0800)]
i965/fs: Conditionalize constant-index UBO load code and add comments.

I wanted to separate this step for easier reviewing when I add the
variable-index case next.

11 years agoi965/fs: Restrict optimization that would fail for gen7's SENDs from GRFs
Eric Anholt [Fri, 9 Nov 2012 19:48:20 +0000 (11:48 -0800)]
i965/fs: Restrict optimization that would fail for gen7's SENDs from GRFs

v2: Fix SNB math bug in register_coalesce() where I was looking at the
    instruction to be removed, not the instruction to be copy propagated
    into.

11 years agoi965/fs: Allow source mods on gen7+ math.
Eric Anholt [Mon, 26 Nov 2012 18:23:07 +0000 (10:23 -0800)]
i965/fs: Allow source mods on gen7+ math.

This gen6 restriction was removed in gen7 as the mathbox merge to act
more like a normal instruction was finished in the hardware.

11 years agoi965/fs: Add instruction emit for varying-index reads of uniforms.
Eric Anholt [Wed, 7 Nov 2012 19:18:34 +0000 (11:18 -0800)]
i965/fs: Add instruction emit for varying-index reads of uniforms.

The gen7 send-from-GRF path is sufficiently different from the perspective of
IR generation and optimization that I just made it a separate opcode.

v2: fix whitespace, rebase on Ken's recent refactor.

11 years agoi965/fs: Rename the existing pull constant load opcode.
Eric Anholt [Wed, 7 Nov 2012 18:42:34 +0000 (10:42 -0800)]
i965/fs: Rename the existing pull constant load opcode.

We're going to use another send message for handling loads with a varying
per-fragment array index.

11 years agoi965: Add a header_present flag for setting up dp read messages.
Eric Anholt [Fri, 9 Nov 2012 19:17:48 +0000 (11:17 -0800)]
i965: Add a header_present flag for setting up dp read messages.

As of gen7, we can skip the header on some messages, and this can make
optimization on those messages much nicer when you've got GRFs instead of MRFs
as the source.

11 years agoi965/gen7: Add some safety checks for send messages from GRFs.
Eric Anholt [Fri, 9 Nov 2012 19:38:14 +0000 (11:38 -0800)]
i965/gen7: Add some safety checks for send messages from GRFs.

11 years agogallivm: Re-add the kludge for lp_build_lerp of fixed point types.
José Fonseca [Tue, 4 Dec 2012 21:16:13 +0000 (21:16 +0000)]
gallivm: Re-add the kludge for lp_build_lerp of fixed point types.

I removed it in commit 7d44d354bdba853e453ce3991396e2b0933468f4 but
texture sample code still relies on it.

Not sure how to this cleanly, so put it pack for now.

11 years agoscons: Link against librt
José Fonseca [Tue, 4 Dec 2012 19:36:52 +0000 (19:36 +0000)]
scons: Link against librt

Fixes missing clock_gettime symbol.

11 years agoutil/u_debug: Cleanup/fix debug_dump_image.
José Fonseca [Sun, 2 Dec 2012 18:57:53 +0000 (18:57 +0000)]
util/u_debug: Cleanup/fix debug_dump_image.

- Handle other formats.
- Prevent CRLF on Windows.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agotranslate: Fix the fetch function assertions.
José Fonseca [Wed, 21 Nov 2012 16:17:22 +0000 (16:17 +0000)]
translate: Fix the fetch function assertions.

fetch_rgba_float is NULL for integer formats, and vice-versa.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agoutil/u_draw: Skip rendering instead of aborting when excessive number of instances...
José Fonseca [Fri, 16 Nov 2012 17:57:38 +0000 (17:57 +0000)]
util/u_draw: Skip rendering instead of aborting when excessive number of instances is found.

This is a temporary hack. I believe the only way of properly fixing this
is to check buffer overflow just before fetching based on addresses,
instead of number of vertices/instances. This change simply allows tests
that stress buffer overflows to complete without asserting, and should
not affect valid rendering.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agodraw: Properly limit vertex buffer fetches on draw arrays.
José Fonseca [Fri, 16 Nov 2012 17:09:05 +0000 (17:09 +0000)]
draw: Properly limit vertex buffer fetches on draw arrays.

We need to clamp vertex buffer fetch based on its size, not based on the
user specified max index hint.

This matches draw_pt_fetch_run() above.

NOTE: This is a candidate for the stable branches.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agodraw: Use symbolic primitive names in debug output.
José Fonseca [Thu, 15 Nov 2012 20:36:55 +0000 (20:36 +0000)]
draw: Use symbolic primitive names in debug output.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agodraw: Consider the geometry shader when choosing the vertex size.
José Fonseca [Thu, 15 Nov 2012 20:35:20 +0000 (20:35 +0000)]
draw: Consider the geometry shader when choosing the vertex size.

A single vertex size is chosen for the whole pipeline. So the number of
geometry shader outputs must also be taken in consideration.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agotgsi: Allow TXF from buffers.
José Fonseca [Thu, 15 Nov 2012 14:20:35 +0000 (14:20 +0000)]
tgsi: Allow TXF from buffers.

There is more work necessary to properly support buffers in shaders, but
this gets things a bit further along.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agoutil/surface: Always use the surface format when clearing.
José Fonseca [Thu, 15 Nov 2012 14:19:55 +0000 (14:19 +0000)]
util/surface: Always use the surface format when clearing.

Not the texture format, as they might differ.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agotgsi: Increase maximum number of temps to 4096.
José Fonseca [Thu, 15 Nov 2012 09:16:59 +0000 (09:16 +0000)]
tgsi: Increase maximum number of temps to 4096.

To match Shader Model 4 limits, as specified in
http://msdn.microsoft.com/en-us/library/windows/desktop/ff471378.aspx

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agollvmpipe: Fix alignment.
José Fonseca [Tue, 4 Dec 2012 19:09:28 +0000 (19:09 +0000)]
llvmpipe: Fix alignment.

My understanding and actual implementation of how the pixels are being
fetch differed.

This fixes bug 57863.

Trivial.

11 years agogallivm: Generalize lp_build_mul and lp_build_lerp for signed normalized types.
José Fonseca [Tue, 4 Dec 2012 13:38:52 +0000 (13:38 +0000)]
gallivm: Generalize lp_build_mul and lp_build_lerp for signed normalized types.

This fixes fdo bug 57755 and most of the failures of piglit fbo-blending-formats
GL_EXT_texture_snorm.

GL_INTENSITY_SNORM is still failing, but problem is probably elsewhere,
as GL_R8_SNORM works fine.

11 years agoautomake/gallium: attempt to fix -lrt
Dave Airlie [Mon, 3 Dec 2012 23:25:13 +0000 (09:25 +1000)]
automake/gallium: attempt to fix -lrt

fix non-automake bits in pipe-load to.

Should fix:
http://bugs.freedesktop.org/57852

Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agou_cache: fix dereference before NULL check
Dave Airlie [Fri, 30 Nov 2012 08:48:47 +0000 (18:48 +1000)]
u_cache: fix dereference before NULL check

11 years agointel: Always enable GL_ARB_framebuffer_object
Ian Romanick [Sat, 1 Dec 2012 18:56:40 +0000 (10:56 -0800)]
intel: Always enable GL_ARB_framebuffer_object

Now that _mesa_BindFramebuffer does the right thing in ES contexts when the
gl_extensions::ARB_framebuffer_object bit is set, the Intel driver doesn't
need this hack.

No piglit or GLES2 conformance regressions observed on IVB, and this
patch (and the previous) fix es3conform's framebuffer_srgb_draw and
transform_feedback_misc tests.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agomesa: Only require Gen'ed name for glBind{Framebuffer,Renderbuffer} on desktop
Ian Romanick [Sat, 1 Dec 2012 18:50:57 +0000 (10:50 -0800)]
mesa: Only require Gen'ed name for glBind{Framebuffer,Renderbuffer} on desktop

Desktop OpenGL implementations that support either
GL_ARB_framebuffer_object or OpenGL 3.0 must require names from
glGenFramebuffers for glBindFramebuffer.  We have enforced this rule for
quite some time.  However, OpenGL ES 1.0, 2.0, and 3.0 implementations
are required to allow user-defined names (e.g., not from
glGenFramebuffers{OES,}).

The Intel drivers have hacked around this by not enabling
GL_ARB_framebuffer_object in an ES context.  Instead, just pick the
correct behavior in _mesa_BindFramebuffer based on the context API.

Chad pointed out in a review e-mail:

    "I'd like to point out, though, that glBindFramebufferEXT and
    glBindRenderbufferEXT are still broken on desktop GL because they
    don't accept user-genned names. But that fix belongs to a different
    series."

Currently glBindFramebufferEXT is an alias for glBindFramebuffer.
Unalising two functions presents some difficulty, so we'll have to
revisit this eventually.

v2: Perform same check in _mesa_BindRenderbuffer too.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> [v1]
11 years agomesa: fix uint64 printing in syncobj.c
Brian Paul [Mon, 3 Dec 2012 15:37:10 +0000 (08:37 -0700)]
mesa: fix uint64 printing in syncobj.c

To silence printf format warnings.

v2: insert "0x" prefix

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
11 years agomesa: Disable GL_NV_primitive_restart extension in core contexts.
Kenneth Graunke [Mon, 3 Dec 2012 06:30:45 +0000 (22:30 -0800)]
mesa: Disable GL_NV_primitive_restart extension in core contexts.

The NV formulation of primitive restart is turned on/off with
glEnableClientState/glDisableClientState.  These two functions don't
exist in core contexts, which mean that GL_NV_primitive_restart is
essentially useless...even broken.

However, leaving it on causes oglconform's primitive-restart-nv tests to
run in OpenGL 3.1 contexts, which results in them all failing.  This
patch causes 29 subtests to go from "fail" to "not run".

NOTE: This is a candidate for stable branches.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoi965: Allow INTEL_DEBUG=fs as a synonym for INTEL_DEBUG=wm.
Kenneth Graunke [Mon, 3 Dec 2012 04:36:16 +0000 (20:36 -0800)]
i965: Allow INTEL_DEBUG=fs as a synonym for INTEL_DEBUG=wm.

I keep accidentally trying to use it.  "fs" is a sensible name for
fragment shader debugging, and "wm" is...not.  It's also more symmetric
with "vs".

Leave INTEL_DEBUG=wm because old habits die hard.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agogallium/auxiliary: Add -fno-rtti to CXXFLAGS on LLVM >= 3.2.
Johannes Obermayr [Fri, 30 Nov 2012 22:53:58 +0000 (23:53 +0100)]
gallium/auxiliary: Add -fno-rtti to CXXFLAGS on LLVM >= 3.2.

Also remove the recently added and overloaded LLVM_CXXFLAGS from CXXFLAGS.

Note: This is a candidate for the stable branches.

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
11 years agor300g: Give CLIP_DISABLE another try
Stefan Dösinger [Mon, 3 Dec 2012 16:40:52 +0000 (17:40 +0100)]
r300g: Give CLIP_DISABLE another try

Signed-off-by: Marek Olšák <maraeo@gmail.com>
11 years agoi965: Include codegen time in the INTEL_DEBUG=perf stall detection.
Eric Anholt [Fri, 30 Nov 2012 20:55:50 +0000 (12:55 -0800)]
i965: Include codegen time in the INTEL_DEBUG=perf stall detection.

In the VS case, we were missing the entire compile time in the stall
detection!

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Don't leak the IR annotation into later instructions.
Eric Anholt [Fri, 30 Nov 2012 00:51:13 +0000 (16:51 -0800)]
i965: Don't leak the IR annotation into later instructions.

After walking our IR instructions (Mesa or GLSL), we don't want to also
mark the start of the FB/URB writes or whatever as being that IR.  This
can end up being misleading when the end of the IR visit got copy
propagated out to a later instruction in the URB writes.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965/vp: Fix crashes with INTEL_DEBUG=vs.
Eric Anholt [Fri, 30 Nov 2012 21:02:11 +0000 (13:02 -0800)]
i965/vp: Fix crashes with INTEL_DEBUG=vs.

The VP generation doesn't set up the output reg strings, so if you
didn't happen to get these values as 0 on the stack, you'd lose.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965/vs: Fix uninitialized shader pointer used in debug output.
Eric Anholt [Fri, 30 Nov 2012 00:49:36 +0000 (16:49 -0800)]
i965/vs: Fix uninitialized shader pointer used in debug output.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoandroid: fix bison warning of conflicting outputs to file
Adrian Marius Negreanu [Fri, 30 Nov 2012 07:52:20 +0000 (09:52 +0200)]
android: fix bison warning of conflicting outputs to file

Bison -o parameter expects a .c file.
The corresponding .h filename is obtained
by removing the extension of the initial .c.

This was breaking compilation on Ubuntu 12.04

libmesa_dricore_intermediates/libmesa_dricore.a(program_parse.tab.o): In
function `_mesa_parse_arb_program':
external/mesa/src/mesa/program/program_parse.y:2682: multiple definition
of `_mesa_parse_arb_program'
libmesa_dricore_intermediates/libmesa_dricore.a(lex.yy.o):external/mesa/src/mesa/program/program_parse.y:2682:
first defined here

Signed-off-by: Adrian Marius Negreanu <adrian.m.negreanu@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-and-tested-by: Chad Versace <chad.versace@linux.intel.com>
11 years agost/mesa: add null pointer check in st_renderbuffer_delete()
Brian Paul [Mon, 3 Dec 2012 15:30:04 +0000 (08:30 -0700)]
st/mesa: add null pointer check in st_renderbuffer_delete()

In my testing I haven't found any cases where we get a null context
pointer, but it might still be possible.  Check for null just to be safe.

Note: This is a candidate for the stable branches.

11 years agost/glx: accept GLX_SAMPLE_BUFFERS/SAMPLES_ARB == 0
Brian Paul [Sun, 2 Dec 2012 23:18:22 +0000 (16:18 -0700)]
st/glx: accept GLX_SAMPLE_BUFFERS/SAMPLES_ARB == 0

Only fail if GLX_SAMPLE_BUFFERS_ARB or GLX_SAMPLES_ARB are non-zero.
We were already doing this in the older swrast/glx code.

This fixes a piglit/waffle problem where we'd always fail to get a
visual/config and report the test as "skip".

Note: This is a candidate for the stable branches.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agomesa: remove warning message in _mesa_reference_renderbuffer_()
Brian Paul [Sat, 1 Dec 2012 17:52:42 +0000 (10:52 -0700)]
mesa: remove warning message in _mesa_reference_renderbuffer_()

We were warning when there was no current context and we're about
to delete a renderbuffer, but that happens fairly often and isn't
really a problem.

Fixes http://bugs.freedesktop.org/show_bug.cgi?id=57754

Note: This is a candidate for the stable branches.

Tested-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agollvmpipe: Implement PIPE_QUERY_TIMESTAMP and PIPE_QUERY_TIME_ELAPSED.
James Benton [Mon, 3 Dec 2012 07:00:37 +0000 (07:00 +0000)]
llvmpipe: Implement PIPE_QUERY_TIMESTAMP and PIPE_QUERY_TIME_ELAPSED.

This required an update for the query storage in llvmpipe, there
can now be an active query per query type, so an occlusion query
can run at the same time as a time elapsed query.

Based on PIPE_QUERY_TIME_ELAPSED patch from Dave Airlie.

v2: fix up piglits for timers (also from Dave Airlie)

a) if we don't render anything the result is 0, so just
return the current time

b) add missing screen get_timestamp callback.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: José Fonseca <jfonseca@vmware.com>
11 years agogallivm: fix srgb format fetch
Roland Scheidegger [Sat, 1 Dec 2012 16:04:54 +0000 (17:04 +0100)]
gallivm: fix srgb format fetch

we need to rely on util code for fetching those, just like before
9f06061d50f90bf425a5337cea1b0adb94a46d25.
Fixes bugs 57699 and 57756.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
11 years agollvmpipe: Refactor convert_to/from_blend_type to convert in place.
José Fonseca [Fri, 30 Nov 2012 18:06:46 +0000 (18:06 +0000)]
llvmpipe: Refactor convert_to/from_blend_type to convert in place.

This fixes the "Source and destination overlap in memcpy" valgrind
warnings.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agollvmpipe: Improve color buffer loads/stores alignment.
José Fonseca [Mon, 3 Dec 2012 13:55:45 +0000 (13:55 +0000)]
llvmpipe: Improve color buffer loads/stores alignment.

Tell LLVM the exact alignment we can guarantee, based on the fs block
dimensions, pixel format, and the alignment of the resource base pointer
and stride.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agollvmpipe: Recompute the fs shader key when framebuffer varies.
José Fonseca [Fri, 30 Nov 2012 17:32:29 +0000 (17:32 +0000)]
llvmpipe: Recompute the fs shader key when framebuffer varies.

The fs shader now depends on the color buffer formats. The shader key was
extended to accommodate this, but llvmpipe_update_derived needs to be
updated to check the framebuffer dirty flag.

This fixes bug 57674.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
11 years agor300g: increment num_z_clears only if we have Hyper-Z
Marek Olšák [Sun, 2 Dec 2012 21:22:39 +0000 (22:22 +0100)]
r300g: increment num_z_clears only if we have Hyper-Z

11 years agor300g: add blacklist for apps that shouldn't steal hyperz access
Marek Olšák [Sun, 2 Dec 2012 18:26:16 +0000 (19:26 +0100)]
r300g: add blacklist for apps that shouldn't steal hyperz access

11 years agor300g: enable Hyper-Z by default on r500
Marek Olšák [Sun, 2 Dec 2012 16:06:49 +0000 (17:06 +0100)]
r300g: enable Hyper-Z by default on r500

I fixed the only known bugs on r500 with 0222b2bd4107b9e5cabfbc06c1a6ca3eae.
Now there are no piglit regressions with Hyper-Z and all apps I tested seem
to work.

To summarize how it works:
- Only one process can use it at a time. This is a hardware limitation.
- The first process to clear a zbuffer gets the exclusive access to use
  Hyper-Z.
- Compositors don't use any zbuffer, so they won't steal it, but some web
  browsers do, so make sure there's no web browser running if you want your
  game to use Hyper-Z.
- There's no need to restart an app which couldn't get the access to Hyper-Z.
  Just quit the app which took it, the driver can turn it on for the other app
  in the middle of rendering.
- If an app gets the access to Hyper-Z, it prints "radeon: Acquired Hyper-Z"
  to stdout.

r300-r400:
  Hyper-Z will be enabled by default on r300-r400 once sufficient testing is
  done with piglit and Lightsmark at least.
  Be sure to set the env var RADEON_HYPERZ and run piglit with parameters: -c 0

11 years agor300g: clear the ZB cache before clearing ZMASK or HIZ
Marek Olšák [Sun, 2 Dec 2012 04:41:48 +0000 (05:41 +0100)]
r300g: clear the ZB cache before clearing ZMASK or HIZ

This fixes wrong rendering in Lightsmark and
the piglit/depthstencil-render-miplevels.

I think I fixed Hyper-Z. So far every app seems to work like a charm.

11 years agoRevert "r300g: fix occlusion queries when depth test is disabled or zbuffer is missing"
Marek Olšák [Sun, 2 Dec 2012 03:40:36 +0000 (04:40 +0100)]
Revert "r300g: fix occlusion queries when depth test is disabled or zbuffer is missing"

It broke Hyper-Z terribly.

11 years agodri: Fix i965 build
Chad Versace [Sun, 2 Dec 2012 01:03:59 +0000 (17:03 -0800)]
dri: Fix i965 build

The following commit broke the i965 build:

    commit 4a486f8bf2ca3d88228f8313282289abe78bc2f8
    Author: Marek Olšák <maraeo@gmail.com>
    Date:   Fri Nov 23 18:31:42 2012 +0100

    glx/dri2: add and use new driver hook flush_with_flags

That commit added a forward declaration of enum __DRI2throttleReason to
dri_interface.h. C++ 98 does not allow forward declarations of enums.

The fix: Move the enum's definition to earlier in the file.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
11 years agost/dri: implement new driver hook flush_with_flags
Marek Olšák [Fri, 23 Nov 2012 17:33:54 +0000 (18:33 +0100)]
st/dri: implement new driver hook flush_with_flags

v2: added documentation for dri_flush as per Brian's request

11 years agost/mesa: make st_flush do what glFlush does
Marek Olšák [Fri, 23 Nov 2012 16:42:11 +0000 (17:42 +0100)]
st/mesa: make st_flush do what glFlush does

11 years agoglx/dri2: add and use new driver hook flush_with_flags
Marek Olšák [Fri, 23 Nov 2012 17:31:42 +0000 (18:31 +0100)]
glx/dri2: add and use new driver hook flush_with_flags

11 years agoglx: move the glFlush call one layer down
Marek Olšák [Tue, 13 Nov 2012 16:06:37 +0000 (17:06 +0100)]
glx: move the glFlush call one layer down

11 years agor300g: refuse to create too large textures
Marek Olšák [Sat, 1 Dec 2012 21:40:00 +0000 (22:40 +0100)]
r300g: refuse to create too large textures

11 years agor300g: fix memory leaks in texture_create error paths
Marek Olšák [Sat, 1 Dec 2012 21:38:36 +0000 (22:38 +0100)]
r300g: fix memory leaks in texture_create error paths

11 years agor300g: fix revoking hyperz access
Marek Olšák [Sat, 1 Dec 2012 20:18:59 +0000 (21:18 +0100)]
r300g: fix revoking hyperz access

The bug was uncovered by 67c8e96f5ace67f9c17556934ee9532877d3a00.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=57763

11 years agogallivm: drop border wrap clamping code
Roland Scheidegger [Fri, 30 Nov 2012 19:46:23 +0000 (20:46 +0100)]
gallivm: drop border wrap clamping code

The border clamping code is unnecessary, since we don't care if a wrapped
coord value is -1 or <-1 (same for length vs. >length), in either case the
border handling code will mask out the offset and replace the texel value with
the border color.
Note that technically this is not entirely correct. Omitting clamping on the
float coords means that flt->int conversion may result in undefined values for
values of very large magnitude.
However there's no reason we should honor this here since:
a) we don't care for that for ordinary wrap modes in the aos code when
   converting coords and the problem is worse there (as we've got only
   effectively 24 instead of 32bits)
b) at least in some cases the clamping was done already in int space hence
   doing nothing to fix that problem.
c) with sse2 flt->int conversion with such values results in 0x80000000 which
   is just perfect (for clamp to border - not so much for the ordinary clamp to
   edge).

Reviewed-by: Brian Paul <brianp@vmware.com>