mesa.git
13 years agoglsl: Avoid division-by-zero during constant-folding
Chad Versace [Tue, 1 Feb 2011 18:14:28 +0000 (10:14 -0800)]
glsl: Avoid division-by-zero during constant-folding

Avoid division-by-zero when constant-folding the following expression
types:
    ir_unop_rsq
    ir_binop_div
    ir_binop_mod

Fixes bugs:
https://bugs.freedesktop.org//show_bug.cgi?id=33306
https://bugs.freedesktop.org//show_bug.cgi?id=33508

Fixes Piglit tests:
glslparsertest/glsl2/div-by-zero-01.frag
glslparsertest/glsl2/div-by-zero-02.frag
glslparsertest/glsl2/div-by-zero-03.frag
glslparsertest/glsl2/modulus-zero-01.frag
glslparsertest/glsl2/modulus-zero-02.frag

NOTE: This is a candidate for the 7.9 and 7.10 branches.

13 years agoglsl: Fix constant-folding for reciprocal expressions
Chad Versace [Tue, 1 Feb 2011 17:09:33 +0000 (09:09 -0800)]
glsl: Fix constant-folding for reciprocal expressions

Do not constant-fold a reciprocal if any component of the reciprocated
expression is 0. For example, do not constant-fold `1 / vec4(0, 1, 2, 3)`.

Incorrect, previous behavior
----------------------------
Reciprocals were constant-folded even when some component of the
reciprocated expression was 0. The incorrectly applied arithmetic was:
   1 / 0 := 0
For example,
   1 / vec4(0, 1, 2, 3) = vec4(0, 1, 1/2, 1/3)

NOTE: This is a candidate for the 7.9 and 7.10 branches.

13 years agosvga: Flush upload buffers or we get asserts
José Fonseca [Wed, 2 Feb 2011 11:28:41 +0000 (11:28 +0000)]
svga: Flush upload buffers or we get asserts

Based on work from Jakob Bornecrantz, Michel Dänzer, and Brian Paul.

13 years agoglsl: Fix use of uninitialized values in _mesa_glsl_parse_state ctor.
Kenneth Graunke [Wed, 2 Feb 2011 07:47:26 +0000 (23:47 -0800)]
glsl: Fix use of uninitialized values in _mesa_glsl_parse_state ctor.

This has probably existed since e5e34ab18eeaffa465 or so.

NOTE: This is a candidate for the 7.9 and 7.10 branches.

13 years agoglsl: Fix invalid use of ralloc_asprintf in prototype_string.
Kenneth Graunke [Wed, 2 Feb 2011 07:31:35 +0000 (23:31 -0800)]
glsl: Fix invalid use of ralloc_asprintf in prototype_string.

This was my mistake when converting from talloc to ralloc.  I was
confused because the other calls in the function are to asprintf_append
and the original code used str as the context rather than NULL.

Fixes bug #33823.

13 years agor600g: use burst exports in shaders
Christian König [Tue, 1 Feb 2011 23:24:34 +0000 (00:24 +0100)]
r600g: use burst exports in shaders

Join multiple exports into just one instruction
instead of exporting each register separately.

13 years agor200: remove 0x4243 pci id
Alex Deucher [Wed, 2 Feb 2011 00:13:54 +0000 (19:13 -0500)]
r200: remove 0x4243 pci id

There's no such device.  0x4243 is a pci bridge id,
not a GPU.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
13 years agoi915: Only mark a register as available if all components are written
Ian Romanick [Tue, 1 Feb 2011 21:35:36 +0000 (13:35 -0800)]
i915: Only mark a register as available if all components are written

Previously a register would be marked as available if any component
was written.  This caused shaders such as this:

  0: TEX TEMP[0].xyz, INPUT[14].xyyy, texture[0], 2D;
  1: MUL TEMP[1], UNIFORM[0], TEMP[0].xxxx;
  2: MAD TEMP[2], UNIFORM[1], TEMP[0].yyyy, TEMP[1];
  3: MAD TEMP[1], UNIFORM[2], TEMP[0].zzzz, TEMP[2];
  4: ADD TEMP[0].xyz, TEMP[1].xyzx, UNIFORM[3].xyzx;
  5: TEX TEMP[1].w, INPUT[14].xyyy, texture[0], 2D;
  6: MOV TEMP[0].w, TEMP[1].wwww;
  7: MOV OUTPUT[2], TEMP[0];
  8: END

to produce incorrect code such as this:

  BEGIN
  DCL S[0]
  DCL T_TEX0
  R[0] = MOV T_TEX0.xyyy
  U[0] = TEXLD S[0],R[0]
  R[0].xyz = MOV U[0]
  R[1] = MUL CONST[0], R[0].xxxx
  R[2] = MAD CONST[1], R[0].yyyy, R[1]
  R[1] = MAD CONST[2], R[0].zzzz, R[2]
  R[0].xyz = ADD R[1].xyzx, CONST[3].xyzx
  R[0] = MOV T_TEX0.xyyy
  U[0] = TEXLD S[0],R[0]
  R[1].w = MOV U[0]
  R[0].w = MOV R[1].wwww
  oC = MOV R[0]
  END

Note that T_TEX0 is copied to R[0], but the xyz components of R[0] are
still expected to hold a calculated value.

Fixes piglit tests draw-elements-vs-inputs, fp-kill, and
glsl-fs-color-matrix.  It also fixes Meego bugzilla #13005.

NOTE: This is a candidate for the 7.9 and 7.10 branches.

13 years agomesa: glGetUniform only returns a single element of an array
Ian Romanick [Thu, 27 Jan 2011 20:24:27 +0000 (12:24 -0800)]
mesa: glGetUniform only returns a single element of an array

Also return it as the correct type.  Previously the whole array would
be returned and each element would be expanded to a vec4.

Fixes piglit test getuniform-01 and bugzilla #29823.

13 years agoglsl: Fix printf_length() on MSVC.
José Fonseca [Tue, 1 Feb 2011 10:41:46 +0000 (10:41 +0000)]
glsl: Fix printf_length() on MSVC.

13 years agoglsl: Fix memory error when creating the supported version string.
Kenneth Graunke [Tue, 1 Feb 2011 08:20:01 +0000 (00:20 -0800)]
glsl: Fix memory error when creating the supported version string.

Passing ralloc_vasprintf_append a 0-byte allocation doesn't work.  If
passed a non-NULL argument, ralloc calls strlen to find the end of the
string.  Since there's no terminating '\0', it runs off the end.

Fixes a crash introduced in 14880a510a1a288df0778395097d5a52806abfb0.

13 years agor600g: just change tile type when buffer is set to depth.
Dave Airlie [Tue, 1 Feb 2011 04:38:45 +0000 (14:38 +1000)]
r600g: just change tile type when buffer is set to depth.

Not 100% sure on this one, but this is how it should work,
the question is whether it will uncover other bugs elsewhere.

13 years agor600g: align the tiling modes with what the DDX and kernel expects.
Dave Airlie [Tue, 1 Feb 2011 04:22:08 +0000 (14:22 +1000)]
r600g: align the tiling modes with what the DDX and kernel expects.

If we see a MACRO bit on r600g its 2D tiled,
if don't see a MACRO bit and we do see a MICRO bit then its 1D tiled.

Signed-off-by: Dave Airlie <airlied@redhat.com>
13 years agor600g: fix evergreen for depth decompress test
Dave Airlie [Tue, 1 Feb 2011 03:06:35 +0000 (13:06 +1000)]
r600g: fix evergreen for depth decompress test

13 years agor600: only decompress depth when its tile type is wrong.
Dave Airlie [Tue, 1 Feb 2011 03:00:56 +0000 (13:00 +1000)]
r600: only decompress depth when its tile type is wrong.

If the tile type for the buffer is 1 then its been bound to the
DB at some point, we need to decompress it, otherwise its only
been bound as texture/cb so don't do anything.

This fixes 5 piglit tests here on r600g.

13 years agotexture_builtins.py: Fix a warning about mixed tabs/spaces.
Kenneth Graunke [Tue, 1 Feb 2011 00:41:34 +0000 (16:41 -0800)]
texture_builtins.py: Fix a warning about mixed tabs/spaces.

13 years agor600g: start looking at evergreen tiling.
Dave Airlie [Sat, 29 Jan 2011 11:25:37 +0000 (21:25 +1000)]
r600g: start looking at evergreen tiling.

this just adds the ioctl interface and sets the tile type
and array mode in the correct place.

This seems to bring eg 1D tiling to the same level, and issues
as on r600. No idea how to address 2D yet.

13 years agor600g: Actually use the info from the flushed depth texture when creating a sampler...
Henri Verbeet [Tue, 1 Feb 2011 00:17:02 +0000 (01:17 +0100)]
r600g: Actually use the info from the flushed depth texture when creating a sampler view on a depth texture.

R600/R700 was using incorrect tiling information from the (compressed) depth
buffer. Evergreen worked anyway because tiling doesn't work.

13 years agoglsl: Refresh autogenerated lexer and parser files.
Ian Romanick [Mon, 31 Jan 2011 23:04:45 +0000 (15:04 -0800)]
glsl: Refresh autogenerated lexer and parser files.

For the previous commit.

13 years agoglsl: Reject shader versions not supported by the implementation
Ian Romanick [Mon, 31 Jan 2011 23:02:24 +0000 (15:02 -0800)]
glsl: Reject shader versions not supported by the implementation

Previously we'd happily compile GLSL 1.30 shaders on any driver.  We'd
also happily compile GLSL 1.10 and 1.20 shaders in an ES2 context.
This has been a long standing FINISHME in the compiler.

NOTE: This is a candidate for the 7.9 and 7.10 branches

13 years agoglsl: Ensure that all GLSL versions are supported in the stand-alone compiler
Ian Romanick [Mon, 31 Jan 2011 22:52:27 +0000 (14:52 -0800)]
glsl: Ensure that all GLSL versions are supported in the stand-alone compiler

NOTE: This is a candidate for the 7.9 and 7.10 branches

13 years agoglsl: Fix dependencies / linkage for glsl_compiler
Ian Romanick [Fri, 28 Jan 2011 01:51:55 +0000 (17:51 -0800)]
glsl: Fix dependencies / linkage for glsl_compiler

13 years agomesa: Initial size for secondary color array is 3
Ian Romanick [Mon, 31 Jan 2011 21:46:16 +0000 (13:46 -0800)]
mesa: Initial size for secondary color array is 3

See table 6.7 on page 347 of the OpenGL 3.0 specification.

13 years agor600g: fix invalid ref count handling in r600_set_constant_buffer
Christian König [Mon, 31 Jan 2011 22:38:10 +0000 (23:38 +0100)]
r600g: fix invalid ref count handling in r600_set_constant_buffer

Only decrement ref count if r600_upload_const_buffer
really changes the buffer.

13 years agollvmpipe: fix incorrect array index in image dump code
Brian Paul [Mon, 31 Jan 2011 21:09:17 +0000 (14:09 -0700)]
llvmpipe: fix incorrect array index in image dump code

13 years agoglsl: regerated files
Brian Paul [Mon, 31 Jan 2011 21:08:47 +0000 (14:08 -0700)]
glsl: regerated files

13 years agoglsl: make _token_list_is_empty_ignoring_space() static
Brian Paul [Mon, 31 Jan 2011 21:08:22 +0000 (14:08 -0700)]
glsl: make _token_list_is_empty_ignoring_space() static

To silence warning about missing prototype.

13 years agoscons/glsl: add top-level 'include' dir to CPPPATH
Brian Paul [Mon, 31 Jan 2011 21:07:12 +0000 (14:07 -0700)]
scons/glsl: add top-level 'include' dir to CPPPATH

To avoid using the /usr/include/GL/gl.h file which may be lacking
some special #defines.

13 years agoglsl: add cast to silence signed/unsigned comparison warning
Brian Paul [Mon, 31 Jan 2011 21:06:38 +0000 (14:06 -0700)]
glsl: add cast to silence signed/unsigned comparison warning

13 years agoglsl: Define va_copy on MSVC.
José Fonseca [Mon, 31 Jan 2011 20:52:18 +0000 (20:52 +0000)]
glsl: Define va_copy on MSVC.

13 years agoi965: Emit texel offsets in sampler messages.
Kenneth Graunke [Mon, 27 Dec 2010 11:21:23 +0000 (03:21 -0800)]
i965: Emit texel offsets in sampler messages.

13 years agoglsl/builtins: Uncomment prototypes for texture*Offset functions.
Kenneth Graunke [Sun, 9 Jan 2011 07:53:51 +0000 (23:53 -0800)]
glsl/builtins: Uncomment prototypes for texture*Offset functions.

13 years agotexture_builtins.py: Generate texture*Offset functions.
Kenneth Graunke [Sun, 9 Jan 2011 07:53:11 +0000 (23:53 -0800)]
texture_builtins.py: Generate texture*Offset functions.

13 years agotexture_builtins.py: Generalize the "use_proj" field to support offsets.
Kenneth Graunke [Mon, 27 Dec 2010 10:53:43 +0000 (02:53 -0800)]
texture_builtins.py: Generalize the "use_proj" field to support offsets.

Rather than passing "True", pass a bitfield describing the particular
variant's features - either projection or offset.

This should make the code a bit more readable ("Proj" instead of "True")
and make it easier to support offsets in the future.

13 years agotexture_builtins.py: Refactor coordinate dimension calculations.
Kenneth Graunke [Mon, 27 Dec 2010 10:50:42 +0000 (02:50 -0800)]
texture_builtins.py: Refactor coordinate dimension calculations.

For offsets, we'll want the straight sampler dimensionality, without the
+1 for array types.  Create a new function to do that; refactor.

13 years agoglsl: Introduce a new "const_in" variable mode.
Kenneth Graunke [Wed, 12 Jan 2011 23:37:37 +0000 (15:37 -0800)]
glsl: Introduce a new "const_in" variable mode.

This annotation is for an "in" function parameter for which it is only legal
to pass constant expressions.  The only known example of this, currently,
is the textureOffset functions.

This should never be used for globals.

13 years agoglsl: Change texel offsets to a single vector rvalue.
Kenneth Graunke [Sun, 9 Jan 2011 07:49:23 +0000 (23:49 -0800)]
glsl: Change texel offsets to a single vector rvalue.

Having these as actual integer values makes it difficult to implement
the texture*Offset built-in functions, since the offset is actually a
function parameter (which doesn't have a constant value).

The original rationale was that some hardware needs these offset baked
into the instruction opcode.  However, at least i965 should be able to
support non-constant offsets.  Others should be able to rely on inlining
and constant propagation.

13 years agoglsl: Re-synchronize ir_variable_mode and the printer's string array.
Kenneth Graunke [Mon, 31 Jan 2011 19:01:27 +0000 (11:01 -0800)]
glsl: Re-synchronize ir_variable_mode and the printer's string array.

Since the introduction of ir_var_system_value, system variables would be
printed as "temporary" and temporaries would result in out-of-bounds
array access, showing up as garbage in printed IR.

13 years agoscons: Gracefully handle pkg-config errors with libdrm_radeon.
Vinson Lee [Mon, 31 Jan 2011 18:46:30 +0000 (10:46 -0800)]
scons: Gracefully handle pkg-config errors with libdrm_radeon.

Print warnings and continue build.

13 years agoRemove the talloc sources from the Mesa repository.
Kenneth Graunke [Mon, 24 Jan 2011 18:36:15 +0000 (10:36 -0800)]
Remove the talloc sources from the Mesa repository.

13 years agoRemove talloc from the SCons build system.
Kenneth Graunke [Mon, 24 Jan 2011 18:35:48 +0000 (10:35 -0800)]
Remove talloc from the SCons build system.

13 years agoRemove talloc from the make and automake build systems.
Kenneth Graunke [Mon, 17 Jan 2011 00:01:54 +0000 (16:01 -0800)]
Remove talloc from the make and automake build systems.

13 years agoralloc: a new MIT-licensed recursive memory allocator.
Kenneth Graunke [Fri, 21 Jan 2011 23:02:56 +0000 (15:02 -0800)]
ralloc: a new MIT-licensed recursive memory allocator.

13 years agoConvert everything from the talloc API to the ralloc API.
Kenneth Graunke [Fri, 21 Jan 2011 22:32:31 +0000 (14:32 -0800)]
Convert everything from the talloc API to the ralloc API.

13 years agoralloc: Add a fake implementation of ralloc based on talloc.
Kenneth Graunke [Sat, 15 Jan 2011 23:16:10 +0000 (15:16 -0800)]
ralloc: Add a fake implementation of ralloc based on talloc.

13 years agoglx: Properly check for a valid fd in dri2CreateScreen().
Henri Verbeet [Mon, 31 Jan 2011 17:09:19 +0000 (18:09 +0100)]
glx: Properly check for a valid fd in dri2CreateScreen().

Signed-off-by: Brian Paul <brianp@vmware.com>
13 years agosvga: Fix translation of TGSI SSG opcode.
Michel Dänzer [Fri, 28 Jan 2011 15:09:05 +0000 (16:09 +0100)]
svga: Fix translation of TGSI SSG opcode.

SVGA3D only supports SGN for vertex shaders, and this requires two additional
temporary registers for intermediate results.

For fragment shaders, lower to two CMPs and one ADD.

13 years agosvga: TEXLDL opcode dst/src register information is correct.
Michel Dänzer [Fri, 28 Jan 2011 15:09:04 +0000 (16:09 +0100)]
svga: TEXLDL opcode dst/src register information is correct.

13 years agosvga: Print the number and mnemonic of the opcode we're missing information for.
Michel Dänzer [Fri, 28 Jan 2011 15:09:04 +0000 (16:09 +0100)]
svga: Print the number and mnemonic of the opcode we're missing information for.

Makes it easier to figure out which opcode it's about.

13 years agoglx: Fix leaks in DRISW screen creation error paths.
Henri Verbeet [Sat, 29 Jan 2011 23:00:50 +0000 (15:00 -0800)]
glx: Fix leaks in DRISW screen creation error paths.

Signed-off-by: Brian Paul <brianp@vmware.com>
13 years agoglx: Fix leaks in DRI screen creation error paths.
Henri Verbeet [Sat, 29 Jan 2011 23:00:49 +0000 (15:00 -0800)]
glx: Fix leaks in DRI screen creation error paths.

Signed-off-by: Brian Paul <brianp@vmware.com>
13 years agoglx: Fix leaks in DRI2 screen creation error paths.
Henri Verbeet [Sat, 29 Jan 2011 23:00:48 +0000 (15:00 -0800)]
glx: Fix leaks in DRI2 screen creation error paths.

Signed-off-by: Brian Paul <brianp@vmware.com>
13 years agoglx: fix length of GLXGetFBConfigsSGIX
Julien Cristau [Wed, 26 Jan 2011 12:03:17 +0000 (04:03 -0800)]
glx: fix length of GLXGetFBConfigsSGIX

The extra length is the size of the request *minus* the size of the
VendorPrivate header, not the addition.

NOTE: This is a candidate for the 7.9 and 7.10 branches

Signed-off-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Brian Paul <brianp@vmware.com>
13 years agoglx: fix GLXChangeDrawableAttributesSGIX request
Julien Cristau [Wed, 26 Jan 2011 12:03:16 +0000 (04:03 -0800)]
glx: fix GLXChangeDrawableAttributesSGIX request

xGLXChangeDrawableAttributesSGIXReq follows the GLXVendorPrivate header
with a drawable, number of attributes, and list of (type, value)
attribute pairs.  Don't forget to put the number of attributes in there.
I don't think this can ever have worked.

NOTE: This is a candidate for the 7.9 and 7.10 branches

Signed-off-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Brian Paul <brianp@vmware.com>
13 years agor600g: fix eg OQ properly.
Dave Airlie [Mon, 31 Jan 2011 10:44:47 +0000 (20:44 +1000)]
r600g: fix eg OQ properly.

the context init is separate for these gpus.

13 years agor600g: fix OQ on evergreen
Alex Deucher [Mon, 31 Jan 2011 07:47:54 +0000 (02:47 -0500)]
r600g: fix OQ on evergreen

6xx/7xx have a max of 4 DBs, evergreen have a max of 8.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
13 years agor600g: fix occlusion query results.
Dave Airlie [Mon, 31 Jan 2011 06:03:29 +0000 (16:03 +1000)]
r600g: fix occlusion query results.

Like on some r5xx, there are multiple DB backends on the r600,
we need to add up the query results from each of these to get the
final correct value.

So far I'm not 100% sure how to calculate the num_db, value
setting it to 4 should be harmless enough until we do.

This fixes occulsion_query piglit test on my rv740.

Signed-off-by: Dave Airlie <airlied@redhat.com>
13 years agor600g: remove some non-existent evergreen reg fields
Alex Deucher [Mon, 31 Jan 2011 03:41:13 +0000 (22:41 -0500)]
r600g: remove some non-existent evergreen reg fields

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
13 years agor600g: fix regression in cubemap tests since eea1d8199b376f37027c14669e0bdf991a22872d
Dave Airlie [Mon, 31 Jan 2011 03:03:10 +0000 (13:03 +1000)]
r600g: fix regression in cubemap tests since eea1d8199b376f37027c14669e0bdf991a22872d

Although CUBE is a reduction inst, it writes to more than just PV.X
so we need to keep the dst channel.

Signed-off-by: Dave Airlie <airlied@redhat.com>
13 years agor600g: handle the write all cbufs property.
Dave Airlie [Mon, 31 Jan 2011 00:01:06 +0000 (10:01 +1000)]
r600g: handle the write all cbufs property.

This only works on r600/r700 so far, evergreen doesn't appear
to have the multiwrite enable bit in the color control, so we
may have to actually do a shader rewrite on EG hardware.

remove some duplicate code reg defines also.

Signed-off-by: Dave Airlie <airlied@redhat.com>
13 years agoutil: Call tables should be const.
Henri Verbeet [Sun, 30 Jan 2011 17:57:39 +0000 (18:57 +0100)]
util: Call tables should be const.

13 years agor600g: Update the flushed depth texture after drawing to the corresponding texture.
Henri Verbeet [Sun, 30 Jan 2011 17:57:39 +0000 (18:57 +0100)]
r600g: Update the flushed depth texture after drawing to the corresponding texture.

I know Jerome will probably rewrite the way depth textures work sometime
soon. For the time being this should at least make common depth texture usage
for shadowing work properly though.

13 years agost/vega: Disable blending when the paint is opaque.
Chia-I Wu [Sun, 30 Jan 2011 14:54:40 +0000 (22:54 +0800)]
st/vega: Disable blending when the paint is opaque.

When the paint is opaque (currently, solid color with alpha 1.0f), no
blending is needed for VG_BLEND_SRC_OVER.  This eliminates the serious
performance hit introduced by 859106f196ade77f59f8787b071739901cd1a843
for a common scenario.

13 years agost/vega: Remove an invalid sanity check.
Chia-I Wu [Sun, 30 Jan 2011 15:09:42 +0000 (23:09 +0800)]
st/vega: Remove an invalid sanity check.

Before create_handle returns, obj->handle is 0.  Calling
handle_to_object will fail.

13 years agost/vega: s/vg[A-Z]/vega[A-Z]/.
Chia-I Wu [Sun, 30 Jan 2011 08:38:12 +0000 (16:38 +0800)]
st/vega: s/vg[A-Z]/vega[A-Z]/.

13 years agoscons: We have C++ in several libraries, so always link with the C++ compiler
José Fonseca [Sun, 30 Jan 2011 11:17:07 +0000 (11:17 +0000)]
scons: We have C++ in several libraries, so always link with the C++ compiler

Prevents missing symbols in libGL.so when LLVM is disabled.

13 years agor600g: Fix void pointer arithmetic.
Vinson Lee [Sun, 30 Jan 2011 09:08:54 +0000 (01:08 -0800)]
r600g: Fix void pointer arithmetic.

Fixes SCons build.

13 years agor600g: fixes a segfault in the piglit fbo-genmipmap-formats test.
Dave Airlie [Sun, 30 Jan 2011 08:07:10 +0000 (18:07 +1000)]
r600g: fixes a segfault in the piglit fbo-genmipmap-formats test.

should be no need to unset this ptr here and if we don't end up using the
blitter we've just broken the state.

13 years agor300/compiler: Standardize the number of bits used by swizzle fields
Tom Stellard [Sat, 29 Jan 2011 22:37:58 +0000 (14:37 -0800)]
r300/compiler: Standardize the number of bits used by swizzle fields

Swizzles are now defined everywhere as a field with 12 bits that contains
4 channels worth of meaningful information.  Any channel that is unused is
set to RC_SWIZZLE_UNUSED.  This change is necessary because rgb instructions
and alpha instructions were initializing channels that would never be used
(channel 3 for rgb and channels 1-3 for alpha) with 0 (aka RC_SWIZZLE_X).
This made it impossible to use generic helper functions for swizzles,
because sometimes a channel value of 0 meant unused and other times it
meant RC_SWIZZLE_X.

All hacks that tried to guess how many channels were relevant have
also been removed.

13 years agor300g: upload translated indices via the uploader
Marek Olšák [Sat, 29 Jan 2011 15:53:48 +0000 (16:53 +0100)]
r300g: upload translated indices via the uploader

13 years agor300g: rework vertex format fallback
Marek Olšák [Sat, 29 Jan 2011 12:58:02 +0000 (13:58 +0100)]
r300g: rework vertex format fallback

1) Only translate the [min_index, max_index] range.
2) Upload translated vertices via the uploader.
3) Rename valid_vertex_buffer[] to real_vertex_buffer[]

13 years agor600g: upload translated indices via the uploader
Marek Olšák [Sat, 29 Jan 2011 15:39:45 +0000 (16:39 +0100)]
r600g: upload translated indices via the uploader

13 years agor600g: rework vertex format fallback
Marek Olšák [Sat, 29 Jan 2011 15:22:08 +0000 (16:22 +0100)]
r600g: rework vertex format fallback

1) Only translate the [min_index, max_index] range.
2) Upload translated vertices via the uploader.

13 years agor600g: fix vertex format fallback
Marek Olšák [Sat, 29 Jan 2011 12:49:41 +0000 (13:49 +0100)]
r600g: fix vertex format fallback

This fixes:
- piglit/draw-vertices
- piglit/draw-vertices-half-float

13 years agor600g: rework vertex buffer uploads
Marek Olšák [Fri, 28 Jan 2011 21:04:09 +0000 (22:04 +0100)]
r600g: rework vertex buffer uploads

Only upload the [min_index, max_index] range instead of [0, userbuf_size].
This an important optimization.

Framerate in Lightsmark:
Before: 22 fps
After: 75 fps

The same optimization is already in r300g.

13 years agor600g: consolidate set_constant_buffer functions
Marek Olšák [Sat, 29 Jan 2011 02:15:52 +0000 (03:15 +0100)]
r600g: consolidate set_constant_buffer functions

13 years agor600g: consolidate vertex_buffer_update functions
Marek Olšák [Sat, 29 Jan 2011 01:59:44 +0000 (02:59 +0100)]
r600g: consolidate vertex_buffer_update functions

13 years agor600g: consolidate draw_vbo functions (v2)
Marek Olšák [Fri, 28 Jan 2011 21:17:41 +0000 (22:17 +0100)]
r600g: consolidate draw_vbo functions (v2)

Added a conditional to spi_update per Dave's comment.

13 years agor600g: make r600_drawl inherit pipe_draw_info
Marek Olšák [Fri, 28 Jan 2011 20:55:28 +0000 (21:55 +0100)]
r600g: make r600_drawl inherit pipe_draw_info

13 years agor600g: add back u_upload_mgr integration
Marek Olšák [Fri, 28 Jan 2011 02:03:38 +0000 (03:03 +0100)]
r600g: add back u_upload_mgr integration

I can't see a performance difference with this code, which means all
the driver-specific code removed in this commit was unnecessary.

Now we use u_upload_mgr in a slightly different way than we did before it got
dropped. I am not restoring the original code "as is" due to latest
u_upload_mgr changes that r300g performance benefits from.

This also fixes:
- piglit/fp-kil

13 years agonvc0: implement transform feedback state
Christoph Bumiller [Sun, 30 Jan 2011 00:24:56 +0000 (01:24 +0100)]
nvc0: implement transform feedback state

13 years agonvc0: enable PIPE_CAP_ARRAY_TEXTURES and fix them
Christoph Bumiller [Sat, 29 Jan 2011 14:06:22 +0000 (15:06 +0100)]
nvc0: enable PIPE_CAP_ARRAY_TEXTURES and fix them

13 years agoegl_dri2: Export glapi symbols for DRI drivers.
Chia-I Wu [Sat, 29 Jan 2011 21:09:06 +0000 (05:09 +0800)]
egl_dri2: Export glapi symbols for DRI drivers.

When an app loads libEGL.so dynamically with RTLD_LOCAL, loading DRI
drivers would fail because of missing glapi symbols.  This commit makes
egl_dri2 load libglapi.so with RTLD_GLOBAL to export glapi symbols for
future symbol resolutions.

The same trick can be found in GLX.  However, egl_dri2 can only do so
when --enable-shared-glapi is given.  Because, otherwise, both libGL.so
and libglapi.so define glapi symbols and egl_dri2 cannot tell which
library to load.

13 years agoegl: Make the transition to built-in drivers more smooth.
Chia-I Wu [Sat, 29 Jan 2011 20:52:31 +0000 (04:52 +0800)]
egl: Make the transition to built-in drivers more smooth.

When the user sets EGL_DRIVER to egl_dri2 (or egl_glx), make sure the
built-in driver is used.  The user might leave the outdated egl_dri2.so
(or egl_glx.so) on the filesystem and we do not want to load it.

13 years agomapi: Workaround a bug in makedepend.
Chia-I Wu [Sat, 29 Jan 2011 11:06:27 +0000 (19:06 +0800)]
mapi: Workaround a bug in makedepend.

makedepend would crash when a source includes a header indirectly, such
as

  #define HEADER "some-header.h"
  #include HEADER

Do not define HEADER (makedepend would detects this as an incomplete
include) and add the dependency manually in the Makefile.

This should hopefully fix bug #33374.

13 years agou_blitter: use user buffers instead of real buffers
Marek Olšák [Sat, 29 Jan 2011 04:11:01 +0000 (05:11 +0100)]
u_blitter: use user buffers instead of real buffers

User buffers may be the fastest way to upload data.

13 years agogallium/docs: add info about transfer boxes and array textures
Brian Paul [Sat, 29 Jan 2011 03:25:27 +0000 (20:25 -0700)]
gallium/docs: add info about transfer boxes and array textures

13 years agogallium: added comments to pipe_transfer
Brian Paul [Sat, 29 Jan 2011 03:25:27 +0000 (20:25 -0700)]
gallium: added comments to pipe_transfer

13 years agost/mesa: fix texture array dimensions
Brian Paul [Sat, 29 Jan 2011 03:25:27 +0000 (20:25 -0700)]
st/mesa: fix texture array dimensions

For 1D/2D texture arrays use the pipe_resource::array_size field.
In OpenGL 1D arrays texture use the height dimension as the array
size and 2D array textures use the depth dimension as the array size.
Gallium uses a special array_size field instead.  When setting up
gallium textures or comparing Mesa textures to gallium textures we
need to be extra careful that we're comparing the right fields.

The new st_gl_texture_dims_to_pipe_dims() function maps OpenGL
texture dimensions to gallium texture dimensions and simplifies
this quite a bit.

13 years agosoftpipe: fix array textures to use resource array_size
Brian Paul [Sat, 29 Jan 2011 03:25:27 +0000 (20:25 -0700)]
softpipe: fix array textures to use resource array_size

Don't use height for 1D array textures or depth for 2D array textures.

13 years agomesa: fix typo, wrap long line
Brian Paul [Sat, 29 Jan 2011 03:25:26 +0000 (20:25 -0700)]
mesa: fix typo, wrap long line

13 years agost/mesa: pass layers param to st_texture_create()
Brian Paul [Sat, 29 Jan 2011 03:25:26 +0000 (20:25 -0700)]
st/mesa: pass layers param to st_texture_create()

13 years agoRevert "glcpp: Demote "macro redefined" from an error to a warning"
Carl Worth [Fri, 28 Jan 2011 22:19:39 +0000 (08:19 +1000)]
Revert "glcpp: Demote "macro redefined" from an error to a warning"

This reverts commit d3df641f0aba99b0b65ecd4d9b06798bca090a29.

The original commit had sat unpushed on my machine for months. By the
time I found it again, I had forgotten that we had decided not to use
this change after all, (the relevant test was removed long ago).

13 years agoutil: Fix leak of transfers in upload manager
Jakob Bornecrantz [Thu, 27 Jan 2011 13:58:30 +0000 (14:58 +0100)]
util: Fix leak of transfers in upload manager

13 years agodocs: removed VC8 project files
Brian Paul [Fri, 28 Jan 2011 20:30:15 +0000 (13:30 -0700)]
docs: removed VC8 project files

13 years agomesa: omit VC8 project files from tarball
Brian Paul [Fri, 28 Jan 2011 20:29:50 +0000 (13:29 -0700)]
mesa: omit VC8 project files from tarball

13 years agoFix missing files in Mesa tarballs.
Thierry Vignaud [Fri, 28 Jan 2011 20:31:04 +0000 (12:31 -0800)]
Fix missing files in Mesa tarballs.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agomesa: Fix available APIs for AMD_conservative_depth
Chad Versace [Fri, 28 Jan 2011 19:16:31 +0000 (11:16 -0800)]
mesa: Fix available APIs for AMD_conservative_depth

Remove ES2, since AMD_conservative_depth is not listed in the OpenGL ES
extension registry.

13 years agor300/compiler: print stats based on the initial number of instructions
Marek Olšák [Fri, 28 Jan 2011 18:33:59 +0000 (19:33 +0100)]
r300/compiler: print stats based on the initial number of instructions

The same number of shaders is now printed regardless of optimizations being
enabled or not, so that we can compare shader stats side by side easily.

13 years agor300g: fix resource_copy_region for DXT SRGB formats
Marek Olšák [Fri, 28 Jan 2011 16:15:22 +0000 (17:15 +0100)]
r300g: fix resource_copy_region for DXT SRGB formats