mesa.git
13 years agogallium: add and use generic function for querying patented format support (v2)
Marek Olšák [Mon, 11 Apr 2011 04:23:00 +0000 (06:23 +0200)]
gallium: add and use generic function for querying patented format support (v2)

v2: Unsigned floats are allowed regardless of the configure switch.

13 years agoconfigure.ac: add an enable switch for float textures (v2)
Marek Olšák [Thu, 31 Mar 2011 23:12:41 +0000 (01:12 +0200)]
configure.ac: add an enable switch for float textures (v2)

So --enable-texture-float it is.

Hardware drivers (including the Gallium ones) should
use #ifdef TEXTURE_FLOAT_ENABLED to hide any code that may
expose floating-point renderbuffers via any interface,
public or private.

v2: Print a warning when using --enable-texture-float.

13 years agodocs: add patents.txt
Marek Olšák [Thu, 31 Mar 2011 23:12:41 +0000 (01:12 +0200)]
docs: add patents.txt

Thanks to José Fonseca for writing this.

13 years agor300g: enable A/L/LA/I float render targets
Marek Olšák [Tue, 29 Mar 2011 14:35:13 +0000 (16:35 +0200)]
r300g: enable A/L/LA/I float render targets

13 years agost/mesa: convert Mesa float formats to Gallium
Marek Olšák [Tue, 15 Feb 2011 23:40:37 +0000 (00:40 +0100)]
st/mesa: convert Mesa float formats to Gallium

Squashed commit of the following:

Author: Marek Olšák <maraeo@gmail.com>

    st/mesa: require RGBA16F and RGBA32F to be renderable
    st/mesa: fix L32F and L16F format translation
    st/mesa: also convert the R/RG float formats

commit 49a9948b6a81b7d813304d081139d98e95ba5d1a
Author: Luca Barbieri <luca@luca-barbieri.com>
Date:   Fri Aug 20 10:36:17 2010 +0200

    mesa/st: enable ARB_texture_float if supported formats allow it

commit 7383632f7b6f9021b65f4973b7e7c99f0e8ce9b2
Author: Luca Barbieri <luca@luca-barbieri.com>
Date:   Tue Aug 24 21:00:46 2010 +0200

    mesa/st: support ARB_texture_float internal formats

commit 7c362cc06982586c2d29fac55f6bcc4bcd1550b5
Author: Luca Barbieri <luca@luca-barbieri.com>
Date:   Tue Aug 24 21:00:33 2010 +0200

    mesa/st: convert L/A/I floating point formats

13 years agogallium: add A/L/LA/I floating point formats
Luca Barbieri [Tue, 15 Feb 2011 23:40:37 +0000 (00:40 +0100)]
gallium: add A/L/LA/I floating point formats

13 years agomesa: finish up ARB_texture_float
Marek Olšák [Tue, 15 Feb 2011 23:35:44 +0000 (00:35 +0100)]
mesa: finish up ARB_texture_float

Squashed commit of the following:

Author: Marek Olšák <maraeo@gmail.com>

    mesa: handle floating-point formats in _mesa_base_fbo_format
    mesa: add ARB/ATI_texture_float, remove MESAX_texture_float

commit 123bb110852739dffadcc81ad80b005b1c4f586d
Author: Luca Barbieri <luca@luca-barbieri.com>
Date:   Wed Aug 25 01:35:42 2010 +0200

    mesa: compute floatMode for FBOs and return it on RGBA_FLOAT_MODE

13 years agomesa: add R/RG floating-point formats
Marek Olšák [Tue, 15 Feb 2011 23:35:44 +0000 (00:35 +0100)]
mesa: add R/RG floating-point formats

13 years agomesa: fix L16F and L32F format properties
Marek Olšák [Tue, 15 Feb 2011 23:35:44 +0000 (00:35 +0100)]
mesa: fix L16F and L32F format properties

13 years agoAdd expected file for 095-recursive-define test case.
Carl Worth [Thu, 14 Apr 2011 23:18:35 +0000 (16:18 -0700)]
Add expected file for 095-recursive-define test case.

It's clear enough that the current segmentation fault isn't what we
want. And it's also very easy to know what we do want here, (just
check with any functional C preprocessor such as "gcc -E").

Add the desired output as an expected file so that the test suite
gives useful output, (showing the omitted output and the segfault),
rather than just reporting "No such file" for the expected file.

13 years agoglcpp: Simplify calling convention of parser's active_list functions
Carl Worth [Thu, 14 Apr 2011 22:35:41 +0000 (15:35 -0700)]
glcpp: Simplify calling convention of parser's active_list functions

These were all written as generic list functions, (accepting and returning
a list to act upon). But they were only ever used with parser->active as
the list. By simply accepting the parser itself, these functions can update
parser->active and now return nothing at all. This makes the code a bit
more compact.

And hopefully the code is no less readable since the functions are also
now renamed to have "_parser_active" in the name for better correlation
with nearby tests of the parser->active field.

13 years agoglcpp: Add --valgrind option to the glcpp-test utility
Carl Worth [Thu, 14 Apr 2011 21:55:52 +0000 (14:55 -0700)]
glcpp: Add --valgrind option to the glcpp-test utility

The common case for this test suite is to quickly test that everything
returns the correct results. In this case, the second run of the test
suite under valgrind was just annoying, (and the user would often
interrupt it).

Now, do what is wanted in the common case by default (just run the
test suite), and require a run with "glcpp-test --valgrind" in order
to test with valgrind.

13 years agoAdd an expected file for 084-unbalanced-parentheses
Carl Worth [Thu, 14 Apr 2011 21:38:56 +0000 (14:38 -0700)]
Add an expected file for 084-unbalanced-parentheses

The expected file here captures the current behavior of glcpp (which
is to generate an obscure "syntax error, unexpected $end" diagnostic
for this case).

It would certainly be better for glcpp to generate a nicer diagnostic,
(such as "missing closing parenthesis in function-like macro
definition" or so), but the current behavior is at least correct, and
expected. So we can make the test suite more useful by marking the
current behavior as expected.

13 years agoAdd an expected file for 094-divide-by-zero-short-circuit
Carl Worth [Thu, 14 Apr 2011 21:35:11 +0000 (14:35 -0700)]
Add an expected file for 094-divide-by-zero-short-circuit

The expected file here captures the current behavior of glcpp (which
is to generate a division-by-zero error) for this case.

It's easy to argue that it should be short-circuiting the evaluation
and not generating the diagnostic (which happens to be what gcc does).
But it doesn't seem like we should force this behavior on our
pre-processor, (and, as always, the GLSL specification of the
pre-processor is too vague on this point).

13 years agoAdd an expected file for 093-divide-by-zero
Carl Worth [Thu, 14 Apr 2011 21:29:34 +0000 (14:29 -0700)]
Add an expected file for 093-divide-by-zero

This test is behaving just fine already---it's generating an informative
diagnostic, ("error: division by 0 in preprocessor directive"), so adding
this in the expected file makes things pass.

13 years agomesa/st: Avoid spurious transfers when creating fbo textures without image data.
José Fonseca [Thu, 14 Apr 2011 14:22:49 +0000 (15:22 +0100)]
mesa/st: Avoid spurious transfers when creating fbo textures without image data.

We could actually try to do an early return both for gallium textures and
malloc memory textures, but I'm not sure exactly which situations
stImage->pt is NULL, and whether texImage->Data == NULL would be acceptible
or not.

Reviewed-by: Brian Paul <brianp@vmware.com>
13 years agost/mesa: add support for GL_RGBA + GL_UNSIGNED_INT_8_8_8_8 in st_fast_readpixels
pepp [Wed, 13 Apr 2011 11:03:31 +0000 (13:03 +0200)]
st/mesa: add support for GL_RGBA + GL_UNSIGNED_INT_8_8_8_8 in st_fast_readpixels

Signed-off-by: Brian Paul <brianp@vmware.com>
13 years agomesa: Expose ATI_draw_buffers.
Eric Anholt [Wed, 13 Apr 2011 19:02:54 +0000 (12:02 -0700)]
mesa: Expose ATI_draw_buffers.

This is the same as ARB_draw_buffers (which derived from it), except
for s/ARB/ATI/.  The glapi bits were already in place, and what was
missing was just the ARB_fp part.  The new Humble Bundle game "trine"
tries to use this extension without checking that it's exposed, which
this works around.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=36182
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
13 years agomesa: Add support for OPTION ATI_draw_buffers to ARB_fp.
Eric Anholt [Wed, 13 Apr 2011 19:07:31 +0000 (12:07 -0700)]
mesa: Add support for OPTION ATI_draw_buffers to ARB_fp.

Tested by piglit ati_draw_buffers-arbfp.
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
13 years agomesa: Add support for the ARB_fragment_program part of ARB_draw_buffers.
Eric Anholt [Wed, 13 Apr 2011 18:09:55 +0000 (11:09 -0700)]
mesa: Add support for the ARB_fragment_program part of ARB_draw_buffers.

Fixes fbo-drawbuffers-arbfp.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=34321
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
13 years agoi965/fs: Constant-fold immediates in src0 of SEL instructions.
Eric Anholt [Sat, 9 Apr 2011 18:29:59 +0000 (08:29 -1000)]
i965/fs: Constant-fold immediates in src0 of SEL instructions.

This is like what we do for add/mul, but we have to invert the
predicate to choose the other source instead.

This removes 5 extra moves of constants in nexuiz shaders.  No
statistically significant performance difference on my Sandybridge
laptop (n=5).

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
13 years agoi965/fs: Constant-fold immediates in src0 of CMP instructions.
Eric Anholt [Sat, 9 Apr 2011 18:22:42 +0000 (08:22 -1000)]
i965/fs: Constant-fold immediates in src0 of CMP instructions.

This is like what we do with add/mul, but we also have to flip the
conditional test.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
13 years agoglsl: Perform type checking on "^^" operands.
Eric Anholt [Sun, 10 Apr 2011 00:57:17 +0000 (14:57 -1000)]
glsl: Perform type checking on "^^" operands.

We were letting any old operand through, which generally resulted in
assertion failures later.

Fixes array-logical-xor.vert.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
13 years agoglsl: When we've emitted a semantic error for ==, return a bool constant.
Eric Anholt [Sat, 9 Apr 2011 22:54:34 +0000 (12:54 -1000)]
glsl: When we've emitted a semantic error for ==, return a bool constant.

This prevents later errors (including an assertion failure) from
cascading the failure.

Fixes invalid-equality-04.vert.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=33303
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@intel.com>
13 years agoglsl: Semantically check the RHS of `||' even when short-circuiting.
Eric Anholt [Sat, 9 Apr 2011 20:27:02 +0000 (10:27 -1000)]
glsl: Semantically check the RHS of `||' even when short-circuiting.

We just do the AST-to-HIR processing, and only push the instructions
if needed in the constant false case.

Fixes glslparsertest/glsl2/logic-02.frag

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
13 years agoglsl: Semantically check the RHS of `&&' even when short-circuiting.
Eric Anholt [Sat, 9 Apr 2011 20:27:02 +0000 (10:27 -1000)]
glsl: Semantically check the RHS of `&&' even when short-circuiting.

We just do the AST-to-HIR processing, and only push the instructions
if needed in the constant true case.

Fixes glslparsertest/glsl2/logic-01.frag

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
13 years agoglsl: Avoid cascading errors when looking for a scalar boolean and failing.
Eric Anholt [Sun, 10 Apr 2011 01:59:20 +0000 (15:59 -1000)]
glsl: Avoid cascading errors when looking for a scalar boolean and failing.

By always using a boolean, we should generally avoid further
complaints.  The failure case I see is logic_not, where the user might
understandably make the mistake of using `!' on a boolean vector (like
a piglit case did recently!), and then get a further complaint that
the new boolean type doesn't match the bvec it gets assigned to.

Fixes invalid-logic-not-06.vert (assertion failure when the bad type
ends up in an expression and ir_constant_expression gets angry).

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=33314
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
13 years agoglsl/opt_cpe: Reenable opt_copy_propagation_elements.cpp pass.
Eric Anholt [Sun, 3 Apr 2011 03:19:20 +0000 (20:19 -0700)]
glsl/opt_cpe: Reenable opt_copy_propagation_elements.cpp pass.

13 years agoglsl/opt_cpe: Fix a crash when a kill kills for two reasons.
Eric Anholt [Fri, 8 Apr 2011 17:54:50 +0000 (07:54 -1000)]
glsl/opt_cpe: Fix a crash when a kill kills for two reasons.

Fixes glsl-copy-propagation-loop-2 when this optimization pass is
re-enabled.

Reported-by: David Lamparter <equinox@diac24.net>
13 years agoglsl/opt_cpe: Kill when the assignment isn't something we recognize.
Eric Anholt [Sun, 3 Apr 2011 03:17:17 +0000 (20:17 -0700)]
glsl/opt_cpe: Kill when the assignment isn't something we recognize.

A few GLES2 tests tripped over this when using array dereferences to
hit channels on the LHS (see piglit test
glsl-copy-propagation-vector-indexing).  We wouldn't find the
ir_dereference_variable, and assume that that meant that it wasn't an
assignment to a scalar/vector, and thus not notice that the variable
had been changed.

13 years agosvga: defined QSZ in terms of SVGA3D_MAX_DRAW_PRIMITIVE_RANGES
Brian Paul [Wed, 13 Apr 2011 15:50:48 +0000 (09:50 -0600)]
svga: defined QSZ in terms of SVGA3D_MAX_DRAW_PRIMITIVE_RANGES

13 years agosvga: define SVGA3D_MAX_DRAW_PRIMITIVE_RANGES and update comments
Brian Paul [Wed, 13 Apr 2011 15:52:16 +0000 (09:52 -0600)]
svga: define SVGA3D_MAX_DRAW_PRIMITIVE_RANGES and update comments

13 years agost/mesa: minor clean-ups in update_textures()
Brian Paul [Wed, 13 Apr 2011 13:37:03 +0000 (07:37 -0600)]
st/mesa: minor clean-ups in update_textures()

13 years agomesa: 80-column wrapping and whitespace fixes
Brian Paul [Wed, 13 Apr 2011 13:35:25 +0000 (07:35 -0600)]
mesa: 80-column wrapping and whitespace fixes

13 years agomesa: fix some comments in sampler object code
Brian Paul [Wed, 13 Apr 2011 13:35:25 +0000 (07:35 -0600)]
mesa: fix some comments in sampler object code

13 years agoi965: Change assertion condition from implicit to explicit
Chad Versace [Thu, 7 Apr 2011 16:09:38 +0000 (09:09 -0700)]
i965: Change assertion condition from implicit to explicit

... because grokking explicit assertions requires fewer neurons.

In brw_misc_state.c:emit_depthbuffer, change assertion condition
    tiling != I915_TILING_X && tiling != I915_TILING_NONE
to
    tiling == I915_TILING_Y

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad.versace@intel.com>
13 years agoi965: Define BRW_DEPTHFORMAT_D24_UNORM_X8_UINT
Chad Versace [Sun, 27 Mar 2011 15:44:50 +0000 (08:44 -0700)]
i965: Define BRW_DEPTHFORMAT_D24_UNORM_X8_UINT

This depth format was added in Gen5.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad.versace@intel.com>
13 years agoi965: Document brw_context.state.depth_region
Chad Versace [Thu, 7 Apr 2011 23:32:23 +0000 (16:32 -0700)]
i965: Document brw_context.state.depth_region

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad.versace@intel.com>
13 years agoi965: Remove unnecessary release/reference of brw_context.state.depth_region
Chad Versace [Thu, 7 Apr 2011 22:44:24 +0000 (15:44 -0700)]
i965: Remove unnecessary release/reference of brw_context.state.depth_region

Release the old depth region and reference the new one *only* if it has
changed.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad.versace@intel.com>
13 years agoi965: Add comments about URB size units and limits.
Kenneth Graunke [Tue, 12 Apr 2011 22:21:21 +0000 (15:21 -0700)]
i965: Add comments about URB size units and limits.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Chris Wilson <chris@chris-wilson.co.uk>
13 years agoi965: Never enable the GS on Gen6.
Kenneth Graunke [Mon, 11 Apr 2011 18:00:03 +0000 (11:00 -0700)]
i965: Never enable the GS on Gen6.

Prior to Gen6, we use the GS for breaking down quads, quad-strips,
and line loops.  On Gen6, earlier stages already take care of this,
so we never need the GS.

Since this code is likely completely untested, remove it for now.
We can write new code when enabling real geometry shaders.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoRevert "i965: Reinstate max-index paranoia"
Chris Wilson [Tue, 12 Apr 2011 18:13:22 +0000 (19:13 +0100)]
Revert "i965: Reinstate max-index paranoia"

This reverts commit b4cbd2b312d53a50603e2cda925711bc9def4517.

It looked like a safe sanity check. It missed the issue of the start of
the buffer not being at 0, but even that was not enough to explain why
setting the max vertex index caused glyphs to be dropped from the game
'Achron'.

Instead, the issue appears to be related to the use of the vertex bias
and so we would need to re-emit the max-index every time we adjusted the
bias, so re-emitting the relocations and defeating the original
optimisation.

Reported-and-tested-by: Thomas Jones <thomas.jones@utoronto.ca>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=35163
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
13 years agoegl/wayland: Update to per-surface frame events
Benjamin Franzke [Wed, 16 Mar 2011 12:49:38 +0000 (13:49 +0100)]
egl/wayland: Update to per-surface frame events

13 years agonouveau_vieux: fix build since sampler objects merge
Dave Airlie [Tue, 12 Apr 2011 11:20:48 +0000 (21:20 +1000)]
nouveau_vieux: fix build since sampler objects merge

13 years agost/wgl: Prevent spurious framebuffer sizes when the window is minimized.
José Fonseca [Thu, 7 Apr 2011 18:15:55 +0000 (19:15 +0100)]
st/wgl: Prevent spurious framebuffer sizes when the window is minimized.

When the window is minimized GetClientRect will return zeros.

Instead of creating a 1x1 framebuffer, simply preserve the current window
size, until the window is restored or maximized again.

13 years agost/wgl: Fix debug output format specifiers of stw_framebuffer_get_size().
José Fonseca [Thu, 7 Apr 2011 17:20:38 +0000 (18:20 +0100)]
st/wgl: Fix debug output format specifiers of stw_framebuffer_get_size().

13 years agosvga: Rebind framebuffer and tss bindings strictly when necessary.
José Fonseca [Thu, 7 Apr 2011 15:54:37 +0000 (16:54 +0100)]
svga: Rebind framebuffer and tss bindings strictly when necessary.

The earlier change to ensure rendertargets and textures are always
rebound at every command buffer start had the downside of making
successive flushes no longer no-ops, as a command buffer with merely
the rebinding commands were being unnecessarily sent to the vGPU.

This change only re-emits the bindings when necessary, by keeping track
of the need to rebind outside of the dirty state update mechanism.

13 years agotexstore: fix regression stricter check for memcpy path for unorm88 and unorm1616
Hans de Goede [Sun, 10 Apr 2011 20:21:03 +0000 (22:21 +0200)]
texstore: fix regression stricter check for memcpy path for unorm88 and unorm1616

According to https://bugs.freedesktop.org/show_bug.cgi?id=34280
commit 5d1387b2da3626326410804026f8b92f1a121fdc causes the font corruption
problems people have been seeing under various apps and gnome-shell on r200
cards.

This commit changed (loosened) the check for using the memcpy path in the
former al88 / al1616 texstore functions, which are now also used to
store rg texures. This patch restores the old strict check in case of
al textures. I've no idea why this fixes things, since I don't know the
code in question at all. But after seeing the bisect in bfdo34280 point
to this commit, I gave this fix a try and it fixes the font issues seen on
r200 cards.

[airlied:
r200 has no native working A8, so it does an internal storage format of AL88
however srcFormat == internalFormat == ALPHA when we get to this point,
so it copies, but it wants to store into an AL88 not ALPHA so fails,
I'll also push a piglit test for this on r200].

Many thanks to Nicolas Kaiser who did all the hard work of tracking this down!

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
13 years ago ir_to_mesa: silence signed/unsigned comparison warnings
Brian Paul [Tue, 12 Apr 2011 03:29:06 +0000 (21:29 -0600)]
 ir_to_mesa: silence signed/unsigned comparison warnings

13 years agoconfigs: add r600 dir to DRI_DIRS
Brian Paul [Tue, 12 Apr 2011 03:23:14 +0000 (21:23 -0600)]
configs: add r600 dir to DRI_DIRS

13 years agor600: silence various compiler warnings
Brian Paul [Tue, 12 Apr 2011 03:22:54 +0000 (21:22 -0600)]
r600: silence various compiler warnings

13 years agoMerge branch 'arb_sampler_objects'
Brian Paul [Tue, 12 Apr 2011 03:19:41 +0000 (21:19 -0600)]
Merge branch 'arb_sampler_objects'

13 years agoRevert "i965: clear global offset to zero in m0.2 for VS DP read."
Zou Nan hai [Tue, 12 Apr 2011 02:52:50 +0000 (10:52 +0800)]
Revert "i965:   clear global offset to zero in m0.2 for VS DP read."

This reverts commit 66b66295d0bc856c69fdcccc22575580c7ecee16.
it was already fixed by commit 9d60a7ce08a67eb8b79c60f829d090ba4a37ed7e

13 years agoi965: Remove hint_gs_always and resulting dead code
Ian Romanick [Sat, 9 Apr 2011 01:06:35 +0000 (18:06 -0700)]
i965: Remove hint_gs_always and resulting dead code

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agointel: Fix ROUND_DOWN_TO macro
Ian Romanick [Fri, 8 Apr 2011 23:31:22 +0000 (16:31 -0700)]
intel: Fix ROUND_DOWN_TO macro

Previously the macro would (ALIGN(value - alignment - 1, alignment)).
At the very least, this was missing parenthesis around "alignment -
1".  As a result, if value was already aligned, it would be reduced by
alignment.  Condisder:

     x = ROUND_DOWN_TO(256, 128);

This becomes:

    x = ALIGN(256 - 128 - 1, 128);

Or:

    x = ALIGN(127, 128);

Which becomes:

    x = 128;

This macro is currently only used in brw_state_batch
(brw_state_batch.c).  It looks like the original version of this macro
would just use too much space in the batch buffer.  It's possible, but
not at all clear to me from the code, that the original behavior is
actually desired.

In any case, this patch does not cause any piglit regressions on my
Ironlake system.

I also think that ALIGN_FLOOR would be a better name for this macro,
but ROUND_DOWN_TO matches rounddown in the Linux kernel.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Whitwell <keithw@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agoglsl: Make GL_ARB_shader_stencil_export enable block be similar to other blocks
Ian Romanick [Fri, 8 Apr 2011 19:43:53 +0000 (12:43 -0700)]
glsl: Make GL_ARB_shader_stencil_export enable block be similar to other blocks

Tested-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agoglsl: Only let a shader enable GL_ARB_draw_instanced if the driver supports it
Ian Romanick [Fri, 8 Apr 2011 19:41:42 +0000 (12:41 -0700)]
glsl: Only let a shader enable GL_ARB_draw_instanced if the driver supports it

Also make the GL_ARB_draw_instanced block follow the same pattern as
the other blocks.

Tested-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agomesa: fixup r600 DRI driver for sampler object changes
Brian Paul [Mon, 11 Apr 2011 19:26:42 +0000 (13:26 -0600)]
mesa: fixup r600 DRI driver for sampler object changes

13 years agoi965: Move the SF VP from state caching to state streaming.
Eric Anholt [Wed, 9 Mar 2011 21:18:30 +0000 (13:18 -0800)]
i965: Move the SF VP from state caching to state streaming.

This is a 49.6% +/- 2.0% (n=9, IPS outlier removed) performance
improvement for the hacked-up-for-cache-misses scissor-many, and no
statistically significant performance difference for the
hacked-up-for-cache-hits version (n=9, IPS outlier removed).  No
statistically significant performance difference from ETQW (n=5) from
these last two commits.

13 years agoi965: Change the SF unit from state caching to state streaming.
Eric Anholt [Wed, 9 Mar 2011 19:11:04 +0000 (11:11 -0800)]
i965: Change the SF unit from state caching to state streaming.

This is a 28.1% +/- 1.4% (n=10) performance improvement for the
hacked-up-for-cache-misses scissor-many (n=10), and no statistically
significant wall-time performance difference for the
hacked-up-for-cache-hits version (n=9, first outlier in each removed
since IPS was warming up.  User time increased by about 4.7%, but
kernel time decreased equivalently).

13 years agoi965: Turn SF unit and viewport structs into pointers to prep for streaming.
Eric Anholt [Wed, 9 Mar 2011 18:51:52 +0000 (10:51 -0800)]
i965: Turn SF unit and viewport structs into pointers to prep for streaming.

I wanted to separate this mechanical change from the actual work.

13 years agou_vbuf_mgr: fixed vbo max_index calculation
pepp [Mon, 11 Apr 2011 15:16:45 +0000 (17:16 +0200)]
u_vbuf_mgr: fixed vbo max_index calculation

Signed-off-by: Marek Olšák <maraeo@gmail.com>
13 years agor600g: handle PIPE_CAP_FRAGMENT_COLOR_CLAMP_CONTROL in get_param
Marek Olšák [Mon, 11 Apr 2011 12:37:58 +0000 (14:37 +0200)]
r600g: handle PIPE_CAP_FRAGMENT_COLOR_CLAMP_CONTROL in get_param

13 years agodocs: GL_ARB_sampler_objects updates
Brian Paul [Sun, 10 Apr 2011 19:06:27 +0000 (13:06 -0600)]
docs: GL_ARB_sampler_objects updates

13 years agomesa: plug in new functions for GL_ARB_sampler_objects
Brian Paul [Sun, 10 Apr 2011 18:48:28 +0000 (12:48 -0600)]
mesa: plug in new functions for GL_ARB_sampler_objects

Build the new sources, plug the new functions into the dispatch table,
implement display list support.  And enable extension in the gallium
state tracker.

13 years agomesa: new code/functions for GL_ARB_sampler_objects
Brian Paul [Sun, 10 Apr 2011 18:47:47 +0000 (12:47 -0600)]
mesa: new code/functions for GL_ARB_sampler_objects

This implements the infrastructure for sampler objects and all the new
API functions.

13 years agomesa: alloc/free shared sampler objects
Brian Paul [Sun, 10 Apr 2011 18:47:00 +0000 (12:47 -0600)]
mesa: alloc/free shared sampler objects

13 years agomesa: new driver hooks for GL_ARB_sampler_objects
Brian Paul [Sun, 10 Apr 2011 18:46:32 +0000 (12:46 -0600)]
mesa: new driver hooks for GL_ARB_sampler_objects

13 years agomesa: add glGet for GL_ARB_sampler_objects
Brian Paul [Sun, 10 Apr 2011 18:46:15 +0000 (12:46 -0600)]
mesa: add glGet for GL_ARB_sampler_objects

13 years agomesa: move sampler state into new gl_sampler_object type
Brian Paul [Sun, 10 Apr 2011 18:44:46 +0000 (12:44 -0600)]
mesa: move sampler state into new gl_sampler_object type

gl_texture_object contains an instance of this type for the regular
texture object sampling state.  glGenSamplers() generates new instances
of gl_sampler_object which can override that state with glBindSampler().

13 years agoglapi: regenerated files for GL_ARB_sampler_objects
Brian Paul [Sun, 10 Apr 2011 18:42:24 +0000 (12:42 -0600)]
glapi: regenerated files for GL_ARB_sampler_objects

13 years agoglapi: interface for GL_ARB_sampler_objects
Brian Paul [Sun, 10 Apr 2011 18:41:39 +0000 (12:41 -0600)]
glapi: interface for GL_ARB_sampler_objects

13 years agoglx: Only remove the glx_display from the list after it's destroyed.
Henri Verbeet [Thu, 7 Apr 2011 21:48:28 +0000 (23:48 +0200)]
glx: Only remove the glx_display from the list after it's destroyed.

Signed-off-by: Henri Verbeet <hverbeet@gmail.com>
13 years agoglx: Destroy dri2Hash on DRI2 display destruction.
Henri Verbeet [Thu, 7 Apr 2011 21:48:28 +0000 (23:48 +0200)]
glx: Destroy dri2Hash on DRI2 display destruction.

Signed-off-by: Henri Verbeet <hverbeet@gmail.com>
13 years agomesa: Also update the color draw buffer if it's explicitly set to GL_NONE.
Henri Verbeet [Thu, 7 Apr 2011 21:48:28 +0000 (23:48 +0200)]
mesa: Also update the color draw buffer if it's explicitly set to GL_NONE.

NOTE: This is a candidate for the 7.10 branch.

Signed-off-by: Henri Verbeet <hverbeet@gmail.com>
13 years agodocs: fix typos in wayland spec
Nicolas Kaiser [Sun, 10 Apr 2011 12:04:44 +0000 (05:04 -0700)]
docs: fix typos in wayland spec

Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
Signed-off-by: Brian Paul <brianp@vmware.com>
13 years agodocs: fix typos in Mesa specs
Nicolas Kaiser [Sun, 10 Apr 2011 15:58:50 +0000 (09:58 -0600)]
docs: fix typos in Mesa specs

Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
Signed-off-by: Brian Paul <brianp@vmware.com>
13 years agonv50,nvc0: silence shader debug output
Christoph Bumiller [Sun, 10 Apr 2011 11:59:26 +0000 (13:59 +0200)]
nv50,nvc0: silence shader debug output

13 years agonvc0: make the card permit separate colour outputs
Christoph Bumiller [Sun, 10 Apr 2011 11:57:34 +0000 (13:57 +0200)]
nvc0: make the card permit separate colour outputs

13 years agonv50-nvc0: make use of COLOR_MASK,BLEND_ENABLE_COMMON
Christoph Bumiller [Sat, 9 Apr 2011 16:25:29 +0000 (18:25 +0200)]
nv50-nvc0: make use of COLOR_MASK,BLEND_ENABLE_COMMON

13 years agonvc0: shrink CSOs a little
Christoph Bumiller [Fri, 8 Apr 2011 13:32:18 +0000 (15:32 +0200)]
nvc0: shrink CSOs a little

13 years agonv50,nvc0: identify some line rasterization state
Christoph Bumiller [Thu, 31 Mar 2011 17:04:17 +0000 (19:04 +0200)]
nv50,nvc0: identify some line rasterization state

Fixes width of non-smooth (aliased) lines on nvc0.

13 years agonvc0: force perspective correction hint to nicest
Christoph Bumiller [Sun, 10 Apr 2011 11:55:01 +0000 (13:55 +0200)]
nvc0: force perspective correction hint to nicest

Fixes issues in e.g. nexuiz (desertfactory) or supertuxkart that
look like lighting bugs.

They're not visible with the software rasterizers because their
notion of linear interpolation seems to be different from that
of nv50/nvc0.

13 years agonv50,nvc0: don't insert instructions after the block terminator
Christoph Bumiller [Fri, 8 Apr 2011 13:51:48 +0000 (15:51 +0200)]
nv50,nvc0: don't insert instructions after the block terminator

13 years agoMake st_pipe_vertex_format return type in st_draw.h match st_draw.c
Alan Coopersmith [Fri, 8 Apr 2011 23:48:12 +0000 (16:48 -0700)]
Make st_pipe_vertex_format return type in st_draw.h match st_draw.c

Fixes compiler error from Sun compilers:
"state_tracker/st_draw.c", line 185: identifier redeclared: st_pipe_vertex_format
        current : function(unsigned int, unsigned int, unsigned int, unsigned char) returning enum pipe_format
        previous: function(unsigned int, unsigned int, unsigned int, unsigned char) returning unsigned int : "state_tracker/st_draw.h", line 73

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
13 years agoFix GET_PROGRAM_NAME() on Solaris to not try to modify a read-only string
Alan Coopersmith [Fri, 8 Apr 2011 20:03:16 +0000 (13:03 -0700)]
Fix GET_PROGRAM_NAME() on Solaris to not try to modify a read-only string

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
13 years agoRevert "r300g: handle DISCARD_WHOLE_RESOURCE for buffers"
Marek Olšák [Fri, 8 Apr 2011 21:19:53 +0000 (23:19 +0200)]
Revert "r300g: handle DISCARD_WHOLE_RESOURCE for buffers"

This reverts commit 437c748bf5072d2bded77a00c74c51cdb8b510e5.

The commit is wrong for several reasons. One of them is when we grab
a new buffer, we should update all the states it is bound in,
including all parallel contexts. I don't think this is even doable.

The correct solution would be upload data via a temporary buffer and
do resource_copy_region to the original one.

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

13 years agor300g: fix another crash with hyperz
Marek Olšák [Fri, 8 Apr 2011 21:16:17 +0000 (23:16 +0200)]
r300g: fix another crash with hyperz

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

13 years agoDisable direct rendering on Cygwin
Jon TURNEY [Mon, 14 Mar 2011 22:08:23 +0000 (22:08 +0000)]
Disable direct rendering on Cygwin

Add Cygwin platform-specific settings and drivers to build for dri driver:
- by default, disable direct rendering.
- if direct rendering is enabled, the swrast dridriver is the only one it's
sensible to try to build (this doesn't work at the moment as additional patches
are required to build a libGL which can load just swrast without the DRM headers,
even though there's no actual functional dependency)

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Julien Cristau <jcristau@debian.org>
13 years agoDisable direct rendering on GNU/Hurd
nobled [Mon, 14 Mar 2011 22:08:22 +0000 (22:08 +0000)]
Disable direct rendering on GNU/Hurd

The Hurd kernel doesn't have DRM yet.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Julien Cristau <jcristau@debian.org>
Reviewed-By: Jakob Bornecrantz <wallbraker@gmail.com>
13 years agoOnly require libdrm if direct rendering is actually enabled.
Samuel Thibault [Mon, 14 Mar 2011 22:08:21 +0000 (22:08 +0000)]
Only require libdrm if direct rendering is actually enabled.

Fix build when configured --with-driver=dri --disable-driglx-direct on targets
without drm e.g. GNU/Hurd and Cygwin

Based on the Debian patch file '05_hurd-ftbfs.diff' by Samuel Thibault.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Julien Cristau <jcristau@debian.org>
Reviewed-By: Jakob Bornecrantz <wallbraker@gmail.com>
13 years agor300g: fix crash when adding a new relocation
Marek Olšák [Fri, 8 Apr 2011 18:42:03 +0000 (20:42 +0200)]
r300g: fix crash when adding a new relocation

No idea why it's so hard to reproduce.
Broken with: c35572352e3e92683988ee8d151b47f4190d62f9

Thanks to Toni Spets for assistance.

13 years agor300g: emit US_FORMAT on R520 only
Marek Olšák [Fri, 8 Apr 2011 18:05:33 +0000 (20:05 +0200)]
r300g: emit US_FORMAT on R520 only

13 years agoi965/fs: Remove broken optimization for live intervals in loops.
Eric Anholt [Sun, 3 Apr 2011 04:11:32 +0000 (18:11 -1000)]
i965/fs: Remove broken optimization for live intervals in loops.

The theory here was to detect a temporary variable used within a loop,
and avoid considering it live across the entire loop.  However, it was
overeager and failed when the first definition of the variable
appeared within the loop but was only conditionally defined.

Fixes glsl-fs-loop-redundant-condition.

13 years agou_vbuf_mgr: fix crash with unsupported vertex format in hw VBOs
Marek Olšák [Fri, 8 Apr 2011 17:31:26 +0000 (19:31 +0200)]
u_vbuf_mgr: fix crash with unsupported vertex format in hw VBOs

13 years agor300g: fix crash with hyperz
Marek Olšák [Fri, 8 Apr 2011 11:27:14 +0000 (13:27 +0200)]
r300g: fix crash with hyperz

r300_update_hyperz_state is no longer required to be called here.

13 years agor300g: Properly take the sampler view's first_level into account when sampling.
Henri Verbeet [Mon, 17 Jan 2011 21:03:30 +0000 (22:03 +0100)]
r300g: Properly take the sampler view's first_level into account when sampling.

Signed-off-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Marek Olšák <maraeo@gmail.com>
13 years agollvmpipe: Take the sampler view's first_level into account when sampling.
Fabian Bieler [Thu, 31 Mar 2011 10:32:52 +0000 (12:32 +0200)]
llvmpipe: Take the sampler view's first_level into account when sampling.

13 years agosoftpipe: Take the sampler view's first_level into account when sampling.
Henri Verbeet [Mon, 17 Jan 2011 21:03:30 +0000 (22:03 +0100)]
softpipe: Take the sampler view's first_level into account when sampling.

Signed-off-by: Brian Paul <brianp@vmware.com>
13 years agost/mesa: Clamp min_lod to the max miplevel as well.
Henri Verbeet [Mon, 17 Jan 2011 21:03:30 +0000 (22:03 +0100)]
st/mesa: Clamp min_lod to the max miplevel as well.

Otherwise min_lod can potentially be larger than the clamped max_lod. The
code that follows will swap min_lod and max_lod in that case, resulting in a
max_lod larger than MAX_LEVEL.

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