mesa.git
13 years agollvmpipe: add some null pointer checks
Brian Paul [Fri, 9 Sep 2011 19:59:20 +0000 (13:59 -0600)]
llvmpipe: add some null pointer checks

It's not clear if these are acceptable cases so issue a one-time warning
in debug builds when we hit them.

Fixes segfault in piglit fbo-mipmap-copypix test.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
13 years agonvprogram: Silence "warning: unused parameter ‘ctx’"
Ian Romanick [Fri, 26 Aug 2011 00:42:16 +0000 (17:42 -0700)]
nvprogram: Silence "warning: unused parameter ‘ctx’"

13 years agoswrast: Silence many "warning: unused parameter ‘ctx’"
Ian Romanick [Thu, 25 Aug 2011 23:59:02 +0000 (16:59 -0700)]
swrast: Silence many "warning: unused parameter ‘ctx’"

Not all drivers use ctx in LOCAL_VARS, so '(void) ctx;' is added to
all the function templates to make GCC happy.

13 years agotnl_dd: Silence "tnl_dd/t_dd_tritmp.h:292:3: warning: suggest braces around empty...
Ian Romanick [Thu, 25 Aug 2011 23:55:18 +0000 (16:55 -0700)]
tnl_dd: Silence "tnl_dd/t_dd_tritmp.h:292:3: warning: suggest braces around empty body in an ‘if’ statement"

13 years agospantmp2: Silence many "warning: unused parameter ‘ctx’"
Ian Romanick [Sun, 21 Aug 2011 23:06:47 +0000 (16:06 -0700)]
spantmp2: Silence many "warning: unused parameter ‘ctx’"

Not all drivers use ctx in LOCAL_VARS, so '(void) ctx;' is added to
all the function templates to make GCC happy.

13 years agomesa: Silence "main/teximage.h:148:72: warning: unused parameter ‘texObj’"
Ian Romanick [Fri, 19 Aug 2011 15:55:19 +0000 (08:55 -0700)]
mesa: Silence "main/teximage.h:148:72: warning: unused parameter ‘texObj’"

13 years agoswrast-dri: Silence several "warning: unused parameter"
Ian Romanick [Fri, 26 Aug 2011 00:04:11 +0000 (17:04 -0700)]
swrast-dri: Silence several "warning: unused parameter"

13 years agodri: Silence several "warning: unused parameter"
Ian Romanick [Fri, 26 Aug 2011 00:51:41 +0000 (17:51 -0700)]
dri: Silence several "warning: unused parameter"

13 years agodri_util: Silence several "warning: unused parameter"
Ian Romanick [Sun, 21 Aug 2011 23:31:35 +0000 (16:31 -0700)]
dri_util: Silence several "warning: unused parameter"

The parameters can't be removed because they are part of the DRI ABI.

13 years agointel: Silence "intel/intel_fbo.h:105:4: warning: comparison of unsigned expression...
Ian Romanick [Fri, 26 Aug 2011 17:53:43 +0000 (10:53 -0700)]
intel: Silence "intel/intel_fbo.h:105:4: warning: comparison of unsigned expression < 0 is always false"

The test was of an enum, attIndex, which should be unsigned.  The
explicit check for < 0 was replaced with a cast to unsigned in an
assertion that attIndex is less than the size of the array it will be
used to index.

Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agointel: Silence several "warning: unused parameter"
Ian Romanick [Fri, 26 Aug 2011 17:24:36 +0000 (10:24 -0700)]
intel: Silence several "warning: unused parameter"

Trivially silence the compiler by adding '(void) foo;' for each unused
parameter.  These parameters could not be removed.  They are part of
interface used elsewhere in Mesa, and some of the other customers
actually use these parameters.

13 years agointel: Silence several "warning: unused parameter"
Ian Romanick [Fri, 26 Aug 2011 17:22:49 +0000 (10:22 -0700)]
intel: Silence several "warning: unused parameter"

The internalFormat, format, and type parameters were not used by
either try_pbo_upload or try_pbo_zcopy, so remove them.  The width
parameter was also not used by try_pbo_zcopy (because it doesn't
actually copy anything), so remove it too.

Eric Anholt notes:

    The current structure of this code is so hateful I can't bring
    myself to say anything about whether changing the current code is
    good or bad.

    I have a dream that one call would try to make a surface
    (miptree/region) out of the PBO, then we'd see about whether it
    matches up nicely and zero-copy/blit using that.  That would be
    reusable for texsubimage, which is currently awful in this
    respect.

At some point we should revisit this code with pitchforks and torches.

13 years agointel: Silence "warning: unused parameter ‘depth0’"
Ian Romanick [Fri, 26 Aug 2011 17:15:47 +0000 (10:15 -0700)]
intel: Silence "warning: unused parameter ‘depth0’"

The depth0 parameter was not used in intel_miptree_create_for_region,
so remove it.  All of the places that call this function, pass 1 for
that parameter, and the place where it looks like it should have been
used (the call to intel_miptree_create_internal) also had 1 hard
coded.

Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agointel: Silence "warning: unused parameter ‘target’"
Ian Romanick [Fri, 26 Aug 2011 17:03:26 +0000 (10:03 -0700)]
intel: Silence "warning: unused parameter ‘target’"

The GLenum target parameter was not used in intel_copy_texsubimage, so
remove it.  Also remove the GLenum internalFormat parameter.  Each
caller just copied this out of the intel_texture_image that is already
passed to intel_copy_texsubimage.

Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agointel: Silence several "warning: unused parameter"
Ian Romanick [Fri, 26 Aug 2011 16:57:51 +0000 (09:57 -0700)]
intel: Silence several "warning: unused parameter"

The intel_context and tiling parameters were not used by any if the
i9[14]5_miptree_layout or the functions they call, and the tiling parameter was
not used by brw_miptree_layout.  Remove the unnecessary parameters.

13 years agointel: Silence "warning: unused parameter ‘fb’"
Ian Romanick [Fri, 26 Aug 2011 16:54:40 +0000 (09:54 -0700)]
intel: Silence "warning: unused parameter ‘fb’"

The gl_framebuffer was not used in intel_draw_buffer, so remove it.

Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agointel: Silence "warning: unused parameter ‘intel’"
Ian Romanick [Fri, 26 Aug 2011 01:11:32 +0000 (18:11 -0700)]
intel: Silence "warning: unused parameter ‘intel’"

The intel_context was not used in any of these functions, so remove it.

13 years agointel: Silence several "warning: unused parameter"
Ian Romanick [Sun, 21 Aug 2011 23:42:21 +0000 (16:42 -0700)]
intel: Silence several "warning: unused parameter"

Also clean-up some of the naming, etc. in
intel_buffer_object_purgeable.  'intel' is usually used as the name of
an intel_context pointer, and intel_obj is usually used as the name of
an intel_*_obj pointer.  These changes were suggested by Eric Anholt.

Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agointel: Silence many "intel_batchbuffer.h:97:39: warning: comparison between signed...
Ian Romanick [Sun, 21 Aug 2011 23:41:22 +0000 (16:41 -0700)]
intel: Silence many "intel_batchbuffer.h:97:39: warning: comparison between signed and unsigned integer expressions"

v2: Remove the assertion in intel_batchbuffer_space:

   assert((intel->batch.state_batch_offset - intel->batch.reserved_space)
  >= intel->batch.used*4);

After reviewing all the places where this is called, I'm (fairly)
comfortable that this assertion was redundant.  Having the assertion
adds ~20KiB to a driver build:

   text    data     bss     dec     hex filename
 903173   26392    1552  931117   e352d i965_dri.so
 924093   26392    1552  952037   e86e5 i965_dri.so

Based on feedback from Eric Anholt.

Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoglsl: Silence "ast_to_hir.cpp:1984:25: warning: comparison of unsigned expression...
Ian Romanick [Sun, 21 Aug 2011 22:44:35 +0000 (15:44 -0700)]
glsl: Silence "ast_to_hir.cpp:1984:25: warning: comparison of unsigned expression >= 0 is always true"

ast_type_qualifier::location should have been a signed integer from
the beginning, and the giant comment in
apply_type_qualifier_to_variable explains why.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=40207
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agoglsl: Silence several "warning: unused parameter"
Ian Romanick [Mon, 29 Aug 2011 21:56:29 +0000 (14:56 -0700)]
glsl: Silence several "warning: unused parameter"

13 years agonouveau: remove target parameter from nouveau_bufferobj_map_range()
Brian Paul [Fri, 9 Sep 2011 18:17:53 +0000 (12:17 -0600)]
nouveau: remove target parameter from nouveau_bufferobj_map_range()

This was missed back when the target parameter was removed from all
the buffer-related driver hooks.

13 years agost/mesa: init program MaxLocalParams, MaxEnvParams limits
Brian Paul [Fri, 9 Sep 2011 14:06:29 +0000 (08:06 -0600)]
st/mesa: init program MaxLocalParams, MaxEnvParams limits

Use the same limit for all parameter classes.

13 years agod3d1x: fix a build error
Chia-I Wu [Fri, 9 Sep 2011 03:59:50 +0000 (11:59 +0800)]
d3d1x: fix a build error

Fix for the st/egl interface change since
08e1076fd2d3f6fb879dd2529e7d035d6a399da2.

13 years agoi965/vs: Allow copy propagation on GRFs.
Eric Anholt [Thu, 1 Sep 2011 23:43:38 +0000 (16:43 -0700)]
i965/vs: Allow copy propagation on GRFs.

Further reduces instruction count by 4.0% in 40.7% of the vertex
shaders.

13 years agoi965/vs: Clear tracked copy propagation values whose source gets overwritten.
Eric Anholt [Thu, 1 Sep 2011 23:40:07 +0000 (16:40 -0700)]
i965/vs: Clear tracked copy propagation values whose source gets overwritten.

This only occurs for GRFs, and hasn't mattered until now because we
only copy propagated non-GRFs.

13 years agoi965/vs: Add support for copy propagation of the UNIFORM and ATTR files.
Eric Anholt [Thu, 1 Sep 2011 23:21:14 +0000 (16:21 -0700)]
i965/vs: Add support for copy propagation of the UNIFORM and ATTR files.

Removes 2.0% of the instructions from 35.7% of vertex shaders in shader-db.

13 years agoi965/vs: Add constant propagation to a few opcodes.
Eric Anholt [Tue, 30 Aug 2011 20:25:15 +0000 (13:25 -0700)]
i965/vs: Add constant propagation to a few opcodes.

This differs from the FS in that we track constants in each
destination channel, and we we have to look at all the swizzled source
channels.  Also, the instruction stream walk is done in an O(n) manner
instead of O(n^2).

Across shader-db, this reduces 8.0% of the instructions from 60.0% of
the vertex shaders, leaving us now behind the old backend by 11.1%
overall.

13 years agoi965/vs: Keep track of indices into a per-register array for virtual GRFs.
Eric Anholt [Thu, 1 Sep 2011 15:34:18 +0000 (08:34 -0700)]
i965/vs: Keep track of indices into a per-register array for virtual GRFs.

Tracking virtual GRFs has tension between using a packed array per
virtual GRF (which is good for register allocation), and sparse arrays
where there's an element per actual register (so the first and second
column of a mat2 can be distinguished inside of an optimization pass).

The FS mostly avoided the need for this second sparse array by doing
virtual GRF splitting, but that meant that instances where virtual GRF
splitting didn't work, instructions using those registers got much
less optimized.

13 years agoi965/vs: Switch to the new VS backend by default.
Eric Anholt [Wed, 7 Sep 2011 01:03:43 +0000 (18:03 -0700)]
i965/vs: Switch to the new VS backend by default.

Now instead of env INTEL_NEW_VS=1 to get it, you need INTEL_OLD_VS=1
to not get it.  While it's not quite to the same codegen efficiency as
the old backend, it is not regressing piglit on G965 and G45, and
actually fixing bugs on gen6, and the remaining codegen quality
regressions all appear tractable.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agoi965/vs: Add support for overflowing the number of available push constants.
Eric Anholt [Wed, 7 Sep 2011 05:32:33 +0000 (22:32 -0700)]
i965/vs: Add support for overflowing the number of available push constants.

Fixes glsl-vs-uniform-array-4.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=33742

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agoi965/vs: Pack uniform registers before optimization
Eric Anholt [Wed, 7 Sep 2011 05:13:20 +0000 (22:13 -0700)]
i965/vs: Pack uniform registers before optimization

We don't expect uniform accesses to generally go away from being dead
code at this point, and we will want to have uniforms packed before
spilling them out to pull constants when we are forced to do that.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agoi965/vs: When failing due to lack of spilling, don't continue on.
Eric Anholt [Wed, 7 Sep 2011 17:32:20 +0000 (10:32 -0700)]
i965/vs: When failing due to lack of spilling, don't continue on.

Fixes assertion failure from double-free in oglc
glsl-arrayobject constructor.declaration.structure

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agoi965/vs: Fix variable indexed array access with more than one array.
Eric Anholt [Wed, 7 Sep 2011 00:46:25 +0000 (17:46 -0700)]
i965/vs: Fix variable indexed array access with more than one array.

The offset to the arrays after the first was mis-scaled, so we'd go
access off the end of the surface and read 0s.  Fixes
glsl-vs-uniform-array-3.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agoi965/vs: Add annotation to more of the URB write.
Eric Anholt [Tue, 6 Sep 2011 20:29:21 +0000 (13:29 -0700)]
i965/vs: Add annotation to more of the URB write.

While we had nice debug output for most of the instruction stream, it
was terminated by a series of anonymous MOVs and a send.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agoegl_dri2: add support for RGBA_8888 android native buffer
Chia-I Wu [Sun, 21 Aug 2011 13:34:10 +0000 (21:34 +0800)]
egl_dri2: add support for RGBA_8888 android native buffer

HAL_PIXEL_FORMAT_RGBA_8888 maps to __DRI_IMAGE_FORMAT_ABGR8888.

13 years agost/dri: add support for __DRI_IMAGE_FORMAT_ABGR8888
Chia-I Wu [Sun, 21 Aug 2011 13:39:34 +0000 (21:39 +0800)]
st/dri: add support for __DRI_IMAGE_FORMAT_ABGR8888

It maps to PIPE_FORMAT_R8G8B8A8_UNORM.

13 years agointel: add support for __DRI_IMAGE_FORMAT_ABGR8888
Chia-I Wu [Sun, 21 Aug 2011 13:36:40 +0000 (21:36 +0800)]
intel: add support for __DRI_IMAGE_FORMAT_ABGR8888

It maps to MESA_FORMAT_RGBA8888_REV.  Surfaces of the format can only be
sampled from but not render to.

Only i915 is tested.

Reviewed-by: Eric Anholt <eric@anholt.net>
[olv: add a check in intel_image_target_renderbuffer_storage]

13 years agodri2: add __DRI_IMAGE_FORMAT_ABGR8888 to __DRI_IMAGE
Chia-I Wu [Sun, 21 Aug 2011 13:22:41 +0000 (21:22 +0800)]
dri2: add __DRI_IMAGE_FORMAT_ABGR8888 to __DRI_IMAGE

Add a new format token, __DRI_IMAGE_FORMAT_ABGR8888, to __DRI_IMAGE.  It
maps to MESA_FORMAT_RGBA8888_REV in core mesa or
PIPE_FORMAT_R8G8B8A8_UNORM in gallium.  The format is used by
translucent surfaces on Android.

13 years agoglsl: Don't do structure splitting until link time.
Eric Anholt [Wed, 7 Sep 2011 19:04:57 +0000 (12:04 -0700)]
glsl: Don't do structure splitting until link time.

We were splitting on each side of an unlinked program, and the two
sides lost track of which variables they referenced, resulting in
assertion failure during validation.  Fixes piglit
link-struct-uniform-usage.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
13 years agoglsl: Clarify error message about whole-array assignment in GLSL 1.10.
Eric Anholt [Wed, 7 Sep 2011 19:03:36 +0000 (12:03 -0700)]
glsl: Clarify error message about whole-array assignment in GLSL 1.10.

Previously, it would produce:

    Failed to compile FS: 0:6(7): error: non-lvalue in assignment

and now it produces:

    Failed to compile FS: 0:5(7): error: whole array assignment is not
    allowed in GLSL 1.10 or GLSL ES 1.00.

Also, add spec quotation to the two places we have code for array
lvalues in GLSL 1.10.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
13 years agoglsl: When assiging from a whole array, mark it as used.
Eric Anholt [Wed, 7 Sep 2011 18:53:20 +0000 (11:53 -0700)]
glsl: When assiging from a whole array, mark it as used.

Fixes piglit link-uniform-array-size.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
13 years agoglsl: Fix setting of OutputsWritten for whole array dereference.
Eric Anholt [Wed, 7 Sep 2011 18:00:03 +0000 (11:00 -0700)]
glsl: Fix setting of OutputsWritten for whole array dereference.

We just want to mark the whole thing used, not mark from each element
the whole size in use.  Fixes undefined URB entry writes on i965,
which blew up with debugging enabled.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
13 years agomesa: remove unneeded #include of texfetch.h
Brian Paul [Fri, 9 Sep 2011 02:54:37 +0000 (20:54 -0600)]
mesa: remove unneeded #include of texfetch.h

13 years agomesa: use _mesa_unpack_float_z_row in get_tex_depth()
Brian Paul [Fri, 9 Sep 2011 02:16:18 +0000 (20:16 -0600)]
mesa: use _mesa_unpack_float_z_row in get_tex_depth()

Removes another use of the gl_texture_image::FetchTexelf() function.

13 years agomesa: use ctx->Driver.GetTexImage() to decompress base texture image
Brian Paul [Fri, 9 Sep 2011 02:16:18 +0000 (20:16 -0600)]
mesa: use ctx->Driver.GetTexImage() to decompress base texture image

This is a simple way to do the job and it removes one more use of
the soon-to-be-removed gl_texture_image::FetchTexelc() function.

13 years agomesa: handle compressed images in get_tex_rgba()
Brian Paul [Fri, 9 Sep 2011 02:16:18 +0000 (20:16 -0600)]
mesa: handle compressed images in get_tex_rgba()

Uses the new _mesa_decompress_image() function.  Unlike the meta path
that uses textured quad rendering to do decompression, this works with
signed formats as well.

13 years agomesa: new _mesa_decompress_image() function
Brian Paul [Fri, 9 Sep 2011 02:16:18 +0000 (20:16 -0600)]
mesa: new _mesa_decompress_image() function

Use the old texture fetch functions to decompress a whole image.
To be used by glGetTexImage().

13 years agomesa: added _mesa_get_uncompressed_format(), _mesa_format_num_components()
Brian Paul [Fri, 9 Sep 2011 02:16:18 +0000 (20:16 -0600)]
mesa: added _mesa_get_uncompressed_format(), _mesa_format_num_components()

13 years agomesa: add new pixel format unpacking code
Brian Paul [Fri, 9 Sep 2011 02:16:18 +0000 (20:16 -0600)]
mesa: add new pixel format unpacking code

This will be used instead of the texel fetch code to unpack images
in various formats.

13 years agometa: added _mesa_meta_GetTexImage()
Brian Paul [Fri, 9 Sep 2011 02:16:18 +0000 (20:16 -0600)]
meta: added _mesa_meta_GetTexImage()

If the texture is compressed, call the meta decompress_texture_image()
function.  Otherwise, call the core _mesa_get_teximage() function.

13 years agometa: move texcoord setup into setup_texture_coords()
Brian Paul [Fri, 9 Sep 2011 02:16:18 +0000 (20:16 -0600)]
meta: move texcoord setup into setup_texture_coords()

13 years agonouveau: fix nouveau_fence leak
Marcin Slusarz [Tue, 6 Sep 2011 14:12:52 +0000 (16:12 +0200)]
nouveau: fix nouveau_fence leak

Note: This is a candidate for the 7.11 branch.

13 years agonv50: fix screen->blitctx memory leak
Marcin Slusarz [Sat, 27 Aug 2011 23:05:22 +0000 (01:05 +0200)]
nv50: fix screen->blitctx memory leak

13 years agogles: Fix glGet(GL_{NUM_,}COMPRESSED_TEXTURE_FORMATS_ARB)
Adam Jackson [Thu, 8 Sep 2011 17:34:53 +0000 (13:34 -0400)]
gles: Fix glGet(GL_{NUM_,}COMPRESSED_TEXTURE_FORMATS_ARB)

We'd still accept the GL_PALETTE[48]_* formats in glCompressedTexImage2D,
but they wouldn't be listed if you queried whether they were supported.

Signed-off-by: Adam Jackson <ajax@redhat.com>
13 years agoglsl: Make sure gl_ClipDistance and gl_ClipVertex are not both written.
Paul Berry [Fri, 12 Aug 2011 01:10:22 +0000 (18:10 -0700)]
glsl: Make sure gl_ClipDistance and gl_ClipVertex are not both written.

From section 7.1 (Vertex Shader Special Variables) of the GLSL 1.30
spec:

  "It is an error for a shader to statically write both
  gl_ClipVertex and gl_ClipDistance."

Fixes piglit test mixing-clip-distance-and-clip-vertex-disallowed.c.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
13 years agoglsl: Check that gl_ClipDistance[] is not sized too large.
Paul Berry [Thu, 11 Aug 2011 22:23:33 +0000 (15:23 -0700)]
glsl: Check that gl_ClipDistance[] is not sized too large.

Fixes piglit tests
clip-distance-explicit-too-large-with-access.{frag,vert} and
clip-distance-explicit-too-large.{frag,vert}.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
13 years agoglsl: Rework oversize array check for gl_TexCoord.
Paul Berry [Tue, 6 Sep 2011 17:01:51 +0000 (10:01 -0700)]
glsl: Rework oversize array check for gl_TexCoord.

The check now applies both when explicitly declaring the size of
gl_TexCoord and when implicitly setting the size of gl_TexCoord by
accessing it using integral constant expressions.

This is prep work for adding similar size checks to gl_ClipDistance.

Fixes piglit tests texcoord/implicit-access-max.{frag,vert}.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
13 years agoglsl: Add constant gl_MaxClipDistances.
Paul Berry [Fri, 12 Aug 2011 00:33:06 +0000 (17:33 -0700)]
glsl: Add constant gl_MaxClipDistances.

Fixes piglit tests {vs,fs}-clip-distance-sizeable-to-max.shader_test.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
13 years agoglsl: Make gl_ClipDistance[] implicitly sized.
Paul Berry [Thu, 11 Aug 2011 22:03:19 +0000 (15:03 -0700)]
glsl: Make gl_ClipDistance[] implicitly sized.

From the GLSL 1.30 spec, section 7.1 (Vertex Shader Special Variables):

  The gl_ClipDistance array is predeclared as unsized and must be
  sized by the shader either redeclaring it with a size or indexing it
  only with integral constant expressions.

Fixes piglit tests clip-distance-implicit-length.vert,
clip-distance-implicit-nonconst-access.vert, and
{vs,fs}-clip-distance-explicitly-sized.shader_test.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
13 years agoscons: Use -g instead of -g3.
José Fonseca [Thu, 8 Sep 2011 08:59:01 +0000 (09:59 +0100)]
scons: Use -g instead of -g3.

-g3 causes binaries to be 3x - 10x bigger, not only on MinGW w/ dwarf
debugging info, but linux as well.

Stick with -g, (which defaults to -g2), like autoconf does.

13 years agost/egl: Fix GDI build.
José Fonseca [Thu, 8 Sep 2011 08:32:10 +0000 (09:32 +0100)]
st/egl: Fix GDI build.

13 years agoDefine INLINE macro in terms of inline.
José Fonseca [Wed, 7 Sep 2011 17:42:07 +0000 (18:42 +0100)]
Define INLINE macro in terms of inline.

13 years agost/egl: add premultiplied alpha support to wayland
Benjamin Franzke [Thu, 8 Sep 2011 06:01:46 +0000 (08:01 +0200)]
st/egl: add premultiplied alpha support to wayland

Return true for NATIVE_PARAM_PREMULTIPLIED_ALPHA when all formats with
alpha support premultiplied alpha.

(Based on Chia-I Wu's patch)

[olv: remove the use of param_premultiplied_alpha from the original
      patch]

13 years agost/egl: correctly return configs under wayland
Benjamin Franzke [Thu, 8 Sep 2011 06:03:34 +0000 (08:03 +0200)]
st/egl: correctly return configs under wayland

Handle "format" events and return configs for the supported formats.

(Based on Chia-I Wu's patch)

[olv: update and explain why PIPE_FORMAT_B8G8R8A8_UNORM should not be
      enabled without HAS_ARGB32]

13 years agoRevert "st/egl: correctly return configs under wayland"
Chia-I Wu [Thu, 8 Sep 2011 08:05:32 +0000 (16:05 +0800)]
Revert "st/egl: correctly return configs under wayland"

This reverts commit 95b445699d7f049116ee0927387a958a9933766b.

13 years agoRevert "st/egl: add premultiplied alpha support to wayland"
Chia-I Wu [Thu, 8 Sep 2011 08:05:22 +0000 (16:05 +0800)]
Revert "st/egl: add premultiplied alpha support to wayland"

This reverts commit 23aa978a9d76a48f4b93e9a8911ec50c0e5d94ab.

13 years agost/egl: add premultiplied alpha support to wayland
Chia-I Wu [Wed, 7 Sep 2011 19:00:31 +0000 (03:00 +0800)]
st/egl: add premultiplied alpha support to wayland

Return true for NATIVE_PARAM_PREMULTIPLIED_ALPHA when all formats with
alpha support premultiplied alpha.  Currently, it means when argb32 and
argb32_pre are both supported.

13 years agost/egl: correctly return configs under wayland
Chia-I Wu [Wed, 7 Sep 2011 18:29:55 +0000 (02:29 +0800)]
st/egl: correctly return configs under wayland

When wl_drm is avaiable and enabled, handle "format" events and return
configs for the supported formats.  Otherwise, assume all formats of
wl_shm are supported.

13 years agost/egl: overload NATIVE_PARAM_PREMULTIPLIED_ALPHA
Chia-I Wu [Wed, 7 Sep 2011 18:39:01 +0000 (02:39 +0800)]
st/egl: overload NATIVE_PARAM_PREMULTIPLIED_ALPHA

EGL does not export this capability of a display server.  But wayland
makes use of EGL_VG_ALPHA_FORMAT to achieve it.

So, when the native display returns true for the parameter, st/egl will
set EGL_VG_ALPHA_FORMAT_PRE_BIT for all EGLConfig's with non-zero
EGL_ALPHA_SIZE.  EGL_VG_ALPHA_FORMAT attribute of a surface will affect
how the surface is presented.

Because st/vega does not support EGL_VG_ALPHA_FORMAT_PRE_BIT,
EGL_OPENVG_BIT will be cleared.

13 years agost/egl: add NATIVE_PARAM_PREMULTIPLIED_ALPHA
Chia-I Wu [Wed, 7 Sep 2011 17:39:27 +0000 (01:39 +0800)]
st/egl: add NATIVE_PARAM_PREMULTIPLIED_ALPHA

Return TRUE if the display supports premultiplied alpha.

13 years agost/egl: add native_present_control
Chia-I Wu [Fri, 2 Sep 2011 13:26:24 +0000 (21:26 +0800)]
st/egl: add native_present_control

Replace the parameters of native_surface::present by a struct,
native_present_control.  Using a struct allows us to add more control
options without having to update each backend every time.

13 years agoglsl: s/int/unsigned/ to silence warning
Brian Paul [Wed, 7 Sep 2011 17:44:35 +0000 (11:44 -0600)]
glsl: s/int/unsigned/ to silence warning

13 years agost/mesa: Remove unused renderbuffer fields and functions.
Stéphane Marchesin [Wed, 7 Sep 2011 19:06:30 +0000 (12:06 -0700)]
st/mesa: Remove unused renderbuffer fields and functions.

Reviewed-by: Brian Paul <brianp@vmware.com>
13 years agoi965/fs: Implement ir_u2f opcode.
Kenneth Graunke [Fri, 2 Sep 2011 17:50:40 +0000 (10:50 -0700)]
i965/fs: Implement ir_u2f opcode.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: Fix disassembly for intdiv/intmod math functions.
Kenneth Graunke [Sat, 3 Sep 2011 19:39:16 +0000 (12:39 -0700)]
i965: Fix disassembly for intdiv/intmod math functions.

The opcodes and strings were reversed.  Quotient means division, and
modulus means remainder.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agost/egl: track changes to drop wl_visual in wayland
Chia-I Wu [Wed, 7 Sep 2011 13:41:30 +0000 (21:41 +0800)]
st/egl: track changes to drop wl_visual in wayland

Follow a subset of changes in 7b1d94e5d1f53ac5f59000176aea1d02fc9a1181.
There are known issues, but it works to a certain degree.  Non-working
demos also fail gracefully.  More importantly, it fixes the build.

13 years agost/egl: track server side wayland changes
Chia-I Wu [Wed, 7 Sep 2011 13:42:56 +0000 (21:42 +0800)]
st/egl: track server side wayland changes

Follow changes in c661ecce1089000c3fca9a543713f8264221be50.

13 years agost/egl: use new wl_callback mechanism in wayland
Chia-I Wu [Wed, 7 Sep 2011 13:40:41 +0000 (21:40 +0800)]
st/egl: use new wl_callback mechanism in wayland

Follow the changes in 6602bda23ba6c4351eb7f04d34803103a68ac2db.

13 years agoi965: Use proper texture alignment units for cubemaps on Gen5+.
Kenneth Graunke [Mon, 15 Aug 2011 19:04:37 +0000 (12:04 -0700)]
i965: Use proper texture alignment units for cubemaps on Gen5+.

In particular, S3TC compressed textures need align_h == 4.

Fixes skybox errors in Quake 4 and FEAR.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=34628
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agoglsl/ir_reader: Make sure constants have the right number of components.
Kenneth Graunke [Mon, 5 Sep 2011 19:03:29 +0000 (12:03 -0700)]
glsl/ir_reader: Make sure constants have the right number of components.

The list of numbers in (constant type (<numbers>)) needs to contain
exactly type->components() numbers (16 for a mat4, 3 for a vec3, etc.)

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
13 years agoglsl/builtins: Fix invalid float constant in noise4 built-in.
Kenneth Graunke [Mon, 5 Sep 2011 19:12:10 +0000 (12:12 -0700)]
glsl/builtins: Fix invalid float constant in noise4 built-in.

Throwing away the extra numbers ought to match the existing behavior.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
13 years agoglsl/builtins: Fix invalid vecN constants in hyperbolic functions.
Kenneth Graunke [Mon, 5 Sep 2011 19:20:18 +0000 (12:20 -0700)]
glsl/builtins: Fix invalid vecN constants in hyperbolic functions.

Each of these vecN constants only provided one component, which is
illegal.  The printed IR is meant to contain exactly as many components
as are necessary; the IR reader does not splat single values.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
13 years agovarray.c: fix logic around BGRA with ARB_vertex_type_2_10_10_10_rev.
Dave Airlie [Wed, 7 Sep 2011 09:19:14 +0000 (10:19 +0100)]
varray.c: fix logic around BGRA with ARB_vertex_type_2_10_10_10_rev.

I introduced a regression in here, I've just split the logic ot now, so
its easier to read/understand.

Should fix: https://bugs.freedesktop.org/show_bug.cgi?id=40664

Signed-off-by: Dave Airlie <airlied@redhat.com>
13 years agomesa/vbo: s/inline/INLINE/
Vinson Lee [Wed, 7 Sep 2011 04:43:51 +0000 (21:43 -0700)]
mesa/vbo: s/inline/INLINE/

MSVC does not support inline keyword.

13 years agoi965/vs: Fix point size handling on gen4.
Eric Anholt [Tue, 30 Aug 2011 22:34:43 +0000 (15:34 -0700)]
i965/vs: Fix point size handling on gen4.

Fixes glsl-vs-point-size.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agoi965/vs: Use write commits on scratch writes in pre-gen6.
Eric Anholt [Wed, 31 Aug 2011 00:56:33 +0000 (17:56 -0700)]
i965/vs: Use write commits on scratch writes in pre-gen6.

This is required to ensure ordering between reads and writes within a
thread.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agoi965/vs: Fix setup of scratch space pointer on pre-gen6.
Eric Anholt [Tue, 30 Aug 2011 23:58:03 +0000 (16:58 -0700)]
i965/vs: Fix setup of scratch space pointer on pre-gen6.

We were failing to relocate, so on the first draw run our scratch
would tend to get written to 0x0.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agoi965/vs: Fix message setup for array read/writes on pre-gen6.
Eric Anholt [Tue, 30 Aug 2011 23:47:43 +0000 (16:47 -0700)]
i965/vs: Fix message setup for array read/writes on pre-gen6.

We were passing an MRF as the source argument, instead of using the
implied move and putting the MRF number in the proper place in the
instruction encoding.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agoi965/vs: Fix constant-indexed array read/write addresses on pre-gen6.
Eric Anholt [Tue, 30 Aug 2011 23:40:06 +0000 (16:40 -0700)]
i965/vs: Fix constant-indexed array read/write addresses on pre-gen6.

The second vertex was getting a garbage index.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agoi965/vs: Add support for vector comparison ops resulting in bool cond codes.
Eric Anholt [Tue, 30 Aug 2011 23:23:44 +0000 (16:23 -0700)]
i965/vs: Add support for vector comparison ops resulting in bool cond codes.

Fixes a giant pile of VS tests on gen4.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agoi965/vs: Make pre-gen6 math operate in vector mode instead of scalar.
Eric Anholt [Tue, 30 Aug 2011 22:59:26 +0000 (15:59 -0700)]
i965/vs: Make pre-gen6 math operate in vector mode instead of scalar.

On the old backend, we used scalar mode because Mesa IR math is
result.xyzw = math(op0.xxxx), which matched up well.  However, in GLSL
IR we do things like result.xy = math(op0.xy), so we want vector mode.
For the common case of result.x = math(op0.x), performance will be the
same (no cost for un-executed channels), though result.xyzw =
math(op0.xxxx) would be worse.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agoi965/vs: Fix copy-and-paste disaster in pre-gen6 POW support.
Eric Anholt [Fri, 2 Sep 2011 23:58:30 +0000 (16:58 -0700)]
i965/vs: Fix copy-and-paste disaster in pre-gen6 POW support.

Fixes vs-pow-float-float and friends.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agoi965/vs: Fix gen4 comparisons used for predication.
Eric Anholt [Fri, 2 Sep 2011 23:46:46 +0000 (16:46 -0700)]
i965/vs: Fix gen4 comparisons used for predication.

When we tried to retype a brw_null_reg() in CMP(), the retyping didn't
take effect because HW_REG just ignores the type field.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agoi965/vs: Fix GPU hangs in shaders with large virtual GRFs pre-gen6.
Eric Anholt [Tue, 30 Aug 2011 22:50:17 +0000 (15:50 -0700)]
i965/vs: Fix GPU hangs in shaders with large virtual GRFs pre-gen6.

If you get your total GRF count wrong, you write over some other
shader's g0, and the GPU fails shortly thereafter.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agoi965: add casts to silence int/enum conversion warnings
Brian Paul [Tue, 6 Sep 2011 22:50:27 +0000 (16:50 -0600)]
i965: add casts to silence int/enum conversion warnings

13 years agostate_trackers/dri/sw: Implement texture_from_pixmap.
Stéphane Marchesin [Tue, 30 Aug 2011 00:22:03 +0000 (17:22 -0700)]
state_trackers/dri/sw: Implement texture_from_pixmap.

Signed-off-by: Stuart Abercrombie <sabercrombie@chromium.org>
Signed-off-by: Stéphane Marchesin <marcheu@chromium.org>
13 years agoDuplicate state_tracker/dri/sw/dri_drawable.c
Stéphane Marchesin [Tue, 30 Aug 2011 00:19:29 +0000 (17:19 -0700)]
Duplicate state_tracker/dri/sw/dri_drawable.c

We need this for the upcoming fix for sw texture_from_pixmap.

Signed-off-by: Stuart Abercrombie <sabercrombie@chromium.org>
Signed-off-by: Stéphane Marchesin <marcheu@chromium.org>
13 years agoEnable GLX_EXT_texture_from_pixmap in software.
nobled [Mon, 29 Aug 2011 23:24:59 +0000 (16:24 -0700)]
Enable GLX_EXT_texture_from_pixmap in software.

Signed-off-by: nobled <nobled@dreamwidth.org>
Signed-off-by: Stuart Abercrombie <sabercrombie@chromium.org>
Signed-off-by: Stéphane Marchesin <marcheu@chromium.org>
13 years agost/mesa: remove unneeded #include
Brian Paul [Tue, 6 Sep 2011 21:44:44 +0000 (15:44 -0600)]
st/mesa: remove unneeded #include