mesa.git
11 years agost/mesa: add option to enable GLSL 1.40
Dave Airlie [Thu, 6 Dec 2012 06:13:15 +0000 (16:13 +1000)]
st/mesa: add option to enable GLSL 1.40

Allow GLSL 1.40 to be enabled if the driver advertises it.

Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agost/mesa: add texture buffer object support to state tracker (v1.1)
Dave Airlie [Thu, 6 Dec 2012 06:12:11 +0000 (16:12 +1000)]
st/mesa: add texture buffer object support to state tracker (v1.1)

This adds the necessary changes to the st to allow texture buffer object
support if the driver advertises it.

v1.1: remove extra blank line and whitespace

Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agogallium: add new texture buffer object capability
Dave Airlie [Thu, 6 Dec 2012 06:10:40 +0000 (16:10 +1000)]
gallium: add new texture buffer object capability

this just adds the define to the header.

Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agomesa/meta: Move declaration before statements.
José Fonseca [Sat, 8 Dec 2012 01:05:52 +0000 (01:05 +0000)]
mesa/meta: Move declaration before statements.

11 years agomesa: Move declaration before statement.
José Fonseca [Sat, 8 Dec 2012 01:02:30 +0000 (01:02 +0000)]
mesa: Move declaration before statement.

For MSVC's sake.

11 years agointel: Enable ETC2 support on intel hardware
Anuj Phogat [Mon, 17 Sep 2012 21:52:10 +0000 (14:52 -0700)]
intel: Enable ETC2 support on intel hardware

This patch enables support for ETC2 compressed textures on
all intel hardware. At present, ETC2 texture decoding is not
available on intel hardware. So, compressed ETC2 texture data
is decoded in software and stored in a suitable uncompressed
MESA_FORMAT at the time of glCompressedTexImage2D. Currently,
ETC2 formats are only exposed in OpenGL ES 3.0.

V2: Use single etc_wraps variable for both etc1 and etc2.
V3: Remove redundant code and use just one intel_miptree_map_etc()
    and intel_miptree_unmap_etc() function.
    Choose MESA_FORMAT_SIGNED_{R16, GR1616} for ETC2 signed-{r11, rg11}
    formats

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Tested-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agomesa: Add decoding functions for GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2
Anuj Phogat [Tue, 23 Oct 2012 19:22:20 +0000 (12:22 -0700)]
mesa: Add decoding functions for GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2

Data in GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 format is decoded and stored
in MESA_FORMAT_SARGB.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agomesa: Add decoding functions for GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2
Anuj Phogat [Mon, 22 Oct 2012 20:34:30 +0000 (13:34 -0700)]
mesa: Add decoding functions for GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2

Data in GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 format is decoded and stored
in MESA_FORMAT_RGBA8888_REV.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agomesa: Add decoding functions for GL_COMPRESSED_SIGNED_RG11_EAC
Anuj Phogat [Wed, 10 Oct 2012 20:46:20 +0000 (13:46 -0700)]
mesa: Add decoding functions for GL_COMPRESSED_SIGNED_RG11_EAC

Data in GL_COMPRESSED_SIGNED_RG11_EAC format is decoded and stored in
MESA_FORMAT_SIGNED_GR1616.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agomesa: Add decoding functions for GL_COMPRESSED_SIGNED_R11_EAC
Anuj Phogat [Wed, 10 Oct 2012 00:02:37 +0000 (17:02 -0700)]
mesa: Add decoding functions for GL_COMPRESSED_SIGNED_R11_EAC

Data in GL_COMPRESSED_SIGNED_R11_EAC format is decoded and stored in
MESA_FORMAT_SIGNED_R16.

v2:
16 bit signed data is converted to 16 bit unsigned data by
adding 2 ^ 15 and stored in an unsigned texture format.

v3:
1. Handle a corner case when base code word value is -128. As per
OpenGL ES 3.0 specification -128 is not an allowed value and should
be truncated to -127.
2. Converting a decoded 16 bit signed data to 16 bit unsigned data by
adding 2 ^ 15 gives us an output which matches the decompressed image
(.ppm) generated by ericsson's etcpack tool. ericsson is also doing this
conversion in their tool because .ppm image files don't support signed
data. But gles 3.0 specification doesn't suggest this conversion. We
need to keep the decoded data in signed format. Both signed format
tests in gles3 conformance pass with these changes.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Tested-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agomesa: Add decoding functions for GL_COMPRESSED_RG11_EAC
Anuj Phogat [Tue, 13 Nov 2012 00:32:08 +0000 (16:32 -0800)]
mesa: Add decoding functions for GL_COMPRESSED_RG11_EAC

Data in GL_COMPRESSED_RG11_EAC format is decoded and stored in
MESA_FORMAT_RG1616.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agomesa: Add decoding functions for GL_COMPRESSED_R11_EAC
Anuj Phogat [Tue, 13 Nov 2012 00:28:07 +0000 (16:28 -0800)]
mesa: Add decoding functions for GL_COMPRESSED_R11_EAC

Data in GL_COMPRESSED_R11_EAC format is decoded and stored in
MESA_FORMAT_R16.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agomesa: Add decoding functions for GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC
Anuj Phogat [Tue, 13 Nov 2012 00:13:25 +0000 (16:13 -0800)]
mesa: Add decoding functions for GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC

Data in GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC format is decoded and stored
in MESA_FORMAT_SARGB8.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agomesa: Add decoding functions for GL_COMPRESSED_RGBA8_ETC2_EAC
Anuj Phogat [Mon, 12 Nov 2012 23:58:25 +0000 (15:58 -0800)]
mesa: Add decoding functions for GL_COMPRESSED_RGBA8_ETC2_EAC

Data in GL_COMPRESSED_RGBA8_ETC2_EAC format is decoded and stored
in MESA_FORMAT_RGBA8888_REV.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agomesa: Add decoding functions for GL_COMPRESSED_SRGB8_ETC2
Anuj Phogat [Fri, 28 Sep 2012 00:05:24 +0000 (17:05 -0700)]
mesa: Add decoding functions for GL_COMPRESSED_SRGB8_ETC2

Data in GL_COMPRESSED_SRGB8_ETC2 format is decoded and stored
in MESA_FORMAT_SARGB8.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agomesa: Add decoding functions for GL_COMPRESSED_RGB8_ETC2
Anuj Phogat [Mon, 17 Sep 2012 21:47:56 +0000 (14:47 -0700)]
mesa: Add decoding functions for GL_COMPRESSED_RGB8_ETC2

Data in GL_COMPRESSED_RGB8_ETC2 format is decoded and stored in
MESA_FORMAT_RGBX8888_REV.

v2: Use CLAMP macro and stdbool.h
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agomesa: Make nonlinear_to_linear() function available outside file
Anuj Phogat [Tue, 13 Nov 2012 01:58:46 +0000 (17:58 -0800)]
mesa: Make nonlinear_to_linear() function available outside file

This patch changes nonlinear_to_linear() function to non static inline
and makes it available outside format_unpack.c. Also, removes the
duplicate copies in other files.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agomesa: Add new MESA_FORMATs for ETC2 compressed textures
Anuj Phogat [Tue, 6 Nov 2012 01:45:18 +0000 (17:45 -0800)]
mesa: Add new MESA_FORMATs for ETC2 compressed textures

It is required by OpenGL ES 3.0 to support ETC2 textures.
This patch adds new MESA_FORMATs for following etc2 texture
formats:
 GL_COMPRESSED_RGB8_ETC2
 GL_COMPRESSED_SRGB8_ETC2
 GL_COMPRESSED_RGBA8_ETC2_EAC
 GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC
 GL_COMPRESSED_R11_EAC
 GL_COMPRESSED_RG11_EAC
 GL_COMPRESSED_SIGNED_R11_EAC
 GL_COMPRESSED_SIGNED_RG11_EAC
 MESA_FORMAT_ETC2_RGB8_PUNCHTHROUGH_ALPHA1
 MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1

Above formats are currently available in only gles 3.0.

v2: Add entries in texfetch_funcs[] array.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
v3 (Paul Berry <stereotype441@gmail.com>): comment out symbols that
are not implemented yet, so that this commit compiles on its own;
future commits will uncomment the symbols as they become available.

11 years agometa: Use #version 300 es for _mesa_glsl_Clear's integer shaders on ES3.
Kenneth Graunke [Tue, 20 Nov 2012 05:59:59 +0000 (21:59 -0800)]
meta: Use #version 300 es for _mesa_glsl_Clear's integer shaders on ES3.

Fixes es3conform's color_buffer_float_clamp_(fixed|on|off) tests.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agometa: Use #version 300 es in GenerateMipmap shaders on ES3.
Kenneth Graunke [Tue, 20 Nov 2012 05:51:25 +0000 (21:51 -0800)]
meta: Use #version 300 es in GenerateMipmap shaders on ES3.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoSet es_version to false when using FF fragment shading in meta ops
Paul Berry [Wed, 8 Aug 2012 18:30:42 +0000 (11:30 -0700)]
Set es_version to false when using FF fragment shading in meta ops

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agomesa: Use the new hash table for the variable refcount visitor.
Eric Anholt [Wed, 17 Oct 2012 22:20:09 +0000 (15:20 -0700)]
mesa: Use the new hash table for the variable refcount visitor.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
[jordan.l.justen@intel.com: open_hash_table => hash_table]
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoprogram/hash_table.c: rename to program/prog_hash_table.c
Jordan Justen [Sat, 1 Dec 2012 00:32:11 +0000 (16:32 -0800)]
program/hash_table.c: rename to program/prog_hash_table.c

Removes a collision of the object file name for main/hash_table
and program/hash_table.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agomesa: Ignore size and offset parameters for BindBufferRange when buffer is 0
Matt Turner [Wed, 5 Dec 2012 01:52:00 +0000 (17:52 -0800)]
mesa: Ignore size and offset parameters for BindBufferRange when buffer is 0

The ES 3 conformance suite unbinds buffers (by binding buffer 0) and
passes zero for the size and offset, which the spec explicitly
disallows. Otherwise, this seems like a reasonable thing to do.

Khronos will be changing the spec to allow this (bug 9765). Fixes
es3conform's transform_feedback_init_defaults test.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agonv50,nvc0: fix shader eviction
Christoph Bumiller [Fri, 7 Dec 2012 21:43:10 +0000 (22:43 +0100)]
nv50,nvc0: fix shader eviction

11 years agonv50,nvc0: add support for cube map arrays
Christoph Bumiller [Fri, 7 Dec 2012 21:47:40 +0000 (22:47 +0100)]
nv50,nvc0: add support for cube map arrays

NOTE: nv50 support not enabled, someone with nva3/8 please fix.

11 years agor300: Don't disable destination read if the src blend factor needs it
Stefan Dösinger [Fri, 7 Dec 2012 16:38:35 +0000 (17:38 +0100)]
r300: Don't disable destination read if the src blend factor needs it

The read can remain disabled if the src alpha factor needs it because
the result would still be zero.

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

NOTE: This is a candidate for stable release branches.

Signed-off-by: Marek Olšák <maraeo@gmail.com>
11 years agogallium/egl-static: Fix unresolved symbol 'clock_gettime'.
Michel Dänzer [Fri, 7 Dec 2012 11:20:57 +0000 (12:20 +0100)]
gallium/egl-static: Fix unresolved symbol 'clock_gettime'.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
11 years agogallivm: Rudimentary native integer support.
José Fonseca [Tue, 4 Dec 2012 19:06:54 +0000 (19:06 +0000)]
gallivm: Rudimentary native integer support.

Just enough for draw module to work ok.

This improves "piglit attribs GL3", though something fishy is still
happening with certain unsigned integer values.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agodraw: Dump LLVM shader key.
José Fonseca [Tue, 4 Dec 2012 16:55:32 +0000 (16:55 +0000)]
draw: Dump LLVM shader key.

Just like we do in llvmpipe for the fragment shader compilation key.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agogallivm: Allow indirection from TEMP registers too.
José Fonseca [Tue, 4 Dec 2012 16:54:41 +0000 (16:54 +0000)]
gallivm: Allow indirection from TEMP registers too.

The ADDR file is cumbersome for native integer capable drivers.  We
should consider deprecating it eventually, but this just adds support
for indirection from TEMP registers.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agogallivm,llvmpipe,draw: Support multiple constant buffers.
José Fonseca [Tue, 4 Dec 2012 14:52:44 +0000 (14:52 +0000)]
gallivm,llvmpipe,draw: Support multiple constant buffers.

Support 16 (defined in LP_MAX_TGSI_CONST_BUFFERS) as opposed to 32 (as
defined by PIPE_MAX_CONSTANT_BUFFERS) because that would make the jit
context become unnecessarily large.

v2: Bump limit from 4 to 16 to cover ARB_uniform_buffer_object needs,
per Dave Airlie.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agost/dri: implement MSAA for GLX/DRI2 framebuffers
Marek Olšák [Mon, 3 Dec 2012 04:36:08 +0000 (05:36 +0100)]
st/dri: implement MSAA for GLX/DRI2 framebuffers

All MSAA buffers are allocated privately and resolved into the DRI-provided
back and front buffers.

If an MSAA visual is chosen, the buffers st/mesa receives are all
multi-sample. st/mesa doesn't have access to the single-sample buffers
in that case.

This makes MSAA work in games like Nexuiz.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agogallium: pass the current context to the flush_front state tracker function
Marek Olšák [Mon, 3 Dec 2012 15:24:59 +0000 (16:24 +0100)]
gallium: pass the current context to the flush_front state tracker function

I will later use the context to resolve an MSAA front buffer.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agost/dri: don't expose MSAA configs with accumulation buffer
Marek Olšák [Mon, 3 Dec 2012 02:40:43 +0000 (03:40 +0100)]
st/dri: don't expose MSAA configs with accumulation buffer

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agost/dri: refactor dri_fill_in_modes
Marek Olšák [Mon, 3 Dec 2012 02:21:04 +0000 (03:21 +0100)]
st/dri: refactor dri_fill_in_modes

- We can use a single loop for adding new configs.
- The useless parameter depth_bits is removed.
- The maximum number of samples is bumped to 32.
- We can support Z16_UNORM and Z32_UNORM unconditionally since the zbuffers
  are private.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agost/dri: always allocate private depth-stencil buffers
Marek Olšák [Mon, 3 Dec 2012 00:26:22 +0000 (01:26 +0100)]
st/dri: always allocate private depth-stencil buffers

This disables DRI2 sharing of zbuffers. The window zbuffer is allocated just
like any other texture - through resource_create.

The idea of allocating a zbuffer through DRI2 isn't very useful with MSAA,
where a single-sample zbuffer is useless.

IIRC, the Intel driver does the same thing.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agost/mesa: implement CopyTexSubImage for MSAA framebuffers
Marek Olšák [Mon, 3 Dec 2012 16:34:58 +0000 (17:34 +0100)]
st/mesa: implement CopyTexSubImage for MSAA framebuffers

Reviewed-by: Brian Paul <brianp@vmware.com>
Just use pipe->blit, which can do resolve, flipping, and format conversions.
The util_blit_pixels codepath is still there for the cases where we have to
force alpha to 1.

This also turns on acceleration for copying GL_DEPTH_STENCIL.

11 years agogallium/u_blitter: fix conflict with u_memory.h
Marek Olšák [Mon, 3 Dec 2012 20:31:04 +0000 (21:31 +0100)]
gallium/u_blitter: fix conflict with u_memory.h

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agor600g: transfers of MSAA color textures should do the resolve
Marek Olšák [Mon, 3 Dec 2012 21:21:39 +0000 (22:21 +0100)]
r600g: transfers of MSAA color textures should do the resolve

so that ReadPixels and various fallbacks work.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agotrace: dump pipe_resource::nr_samples
Marek Olšák [Mon, 3 Dec 2012 04:35:30 +0000 (05:35 +0100)]
trace: dump pipe_resource::nr_samples

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agoglx/dri2: set the __DRI2_FLUSH_DRAWABLE flag where it should be set
Marek Olšák [Mon, 3 Dec 2012 04:15:11 +0000 (05:15 +0100)]
glx/dri2: set the __DRI2_FLUSH_DRAWABLE flag where it should be set

Sorry, I accidentally omitted this.

It only broke MLAA.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agobuild: Fix GLES linkage without libglapi
Andreas Boll [Thu, 6 Dec 2012 17:36:25 +0000 (18:36 +0100)]
build: Fix GLES linkage without libglapi

fixes a regression introduced with
fc9ea7c74dc5cb996c3d9fe6663fd6da080e8360

NOTE: This is a candidate for the 9.0 branch.

Reported-by: Brian Paul <brianp@vmware.com>
Acked-by: Matt Turner <mattst88@gmail.com>
11 years agollvmpipe: fix regression in gears speed.
Dave Airlie [Thu, 6 Dec 2012 22:31:57 +0000 (08:31 +1000)]
llvmpipe: fix regression in gears speed.

This fixes the gears regression since transform feedback.

Reported-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agoglsl: Add missing semicolon in the grammar
Kenneth Graunke [Tue, 20 Nov 2012 06:36:28 +0000 (22:36 -0800)]
glsl: Add missing semicolon in the grammar

This may not be strictly necessary, but every other rule in the grammar ends
with a semicolon.  It also appears that this was supposed to be commited with
the original patch that changed this rule, but the wrong version of the patch
was accidentally pushed.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoglsl: Allow layout qualifiers in GLSL 3.00 ES
Ian Romanick [Fri, 9 Nov 2012 20:26:42 +0000 (12:26 -0800)]
glsl: Allow layout qualifiers in GLSL 3.00 ES

Note that while 'packed' is a reserved word in GLSL ES, row_major is not.
This means that we have to use the string-based matching for that.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Acked-by: Carl Worth <cworth@cworth.org>
11 years agoglsl: Create builtin function profiles for GLSL 3.00 ES.
Paul Berry [Sat, 4 Aug 2012 22:42:33 +0000 (15:42 -0700)]
glsl: Create builtin function profiles for GLSL 3.00 ES.

Nearly all of the builtin functions in GLSL 3.00 ES are already
implemented in Mesa; this patch enables them.

A few functions are not implemented yet; those have been commented
out, with a FIXME comment to act as a reminder of what still needs to
be implemented.  Here is the complete list: packSnorm2x16,
unpackSnorm2x16, packUnorm2x16, unpackUnorm2x16, packHalf2x16,
unpackHalf2x16.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Acked-by: Carl Worth <cworth@cworth.org>
11 years agoglsl: add determinant() functions.
Paul Berry [Mon, 6 Aug 2012 21:36:31 +0000 (14:36 -0700)]
glsl: add determinant() functions.

These functions are defined in GLSL 1.50 and GLES 3.00 ES.

The formulas have been extracted from the existing implementation of
inverse().

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Acked-by: Carl Worth <cworth@cworth.org>
11 years agoglsl: Make builtin function profiles for GLSL ES use "es" in the filename.
Paul Berry [Sat, 4 Aug 2012 17:43:53 +0000 (10:43 -0700)]
glsl: Make builtin function profiles for GLSL ES use "es" in the filename.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Acked-by: Carl Worth <cworth@cworth.org>
11 years agoglsl: Add builtin variables for GLSL 3.00 ES.
Paul Berry [Sat, 4 Aug 2012 17:29:49 +0000 (10:29 -0700)]
glsl: Add builtin variables for GLSL 3.00 ES.

This patch also adds assertions so that when we add new GLSL versions,
we'll notice that we need to update the builtin variables.

[v2, idr]: s/Frab/Frag/  Noticed by Eric.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> [v1]
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Acked-by: Carl Worth <cworth@cworth.org>
11 years agoglsl: Populate built-in types correctly for GLSL 3.00 ES.
Paul Berry [Thu, 2 Aug 2012 20:38:57 +0000 (13:38 -0700)]
glsl: Populate built-in types correctly for GLSL 3.00 ES.

This patch implements all of the built-in types for GLSL 3.00 ES.
This is almost exactly the same as the set of built-in types for GLSL
1.30, except ate 1D samplers are skipped, and samplerCubeShadow is
added.

This patch also addes an assertion so that when we add new GLSL
versions, we'll notice that we need to update the types.

In review, Eric noted:

    "This change looks correct.  The overall interaction of profiles is
    getting ugly, though.  I'm imagining a restructure of the symbol
    table population so that there's a big list of types, and each
    #version has a nice list of strings of type names copy and pasted
    out of its spec."

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Acked-by: Carl Worth <cworth@cworth.org>
11 years agoglsl: Make {Min,Max}ProgramTexelOffset available to compiler.
Paul Berry [Sat, 4 Aug 2012 17:00:20 +0000 (10:00 -0700)]
glsl: Make {Min,Max}ProgramTexelOffset available to compiler.

These constants need to be made available to shaders in GLSL 3.00 ES.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Acked-by: Carl Worth <cworth@cworth.org>
11 years agoglsl: Fix linker checks for GLSL ES 3.00.
Paul Berry [Fri, 3 Aug 2012 00:51:02 +0000 (17:51 -0700)]
glsl: Fix linker checks for GLSL ES 3.00.

This patch updates the following linker checks to do the right thing
in GLSL 3.00 ES:

- Failing to write to gl_Position is allowed in GLSL 1.40+ as well as
  GLSL 3.00 ES.

- It is an error to write to both gl_ClipVertex and gl_ClipDistance in
  GLSL 1.30+.  This does not apply to GLSL 3.00 ES.

- GLSL 3.00 ES uses the same varying counting rules as GLSL 1.00 ES.

- In GLSL 1.30 and GLSL 3.00 ES, "discard" terminates the shader.

- In GLSL 1.00 ES and GLSL 3.00 ES, both a fragment and a vertex
  shader must be present.

[v2, idr]: Fix minro typo in a comment.  Noticed by Ken.

[v3, idr]: s/IsEs(Shader|Prog)/IsES/  Suggested by Ken and Eric.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Carl Worth <cworth@cworth.org>
11 years agoglsl: Record in gl_shader_program whether the program uses GLSL ES.
Paul Berry [Fri, 3 Aug 2012 00:50:43 +0000 (17:50 -0700)]
glsl: Record in gl_shader_program whether the program uses GLSL ES.

Previously we recorded just the GLSL version (or the max version, if
GLSL 1.10 and GLSL 1.20 programs were linked together).

[v2, idr]: s/IsEs(Shader|Prog)/IsES/  Suggested by Ken and Eric.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Acked-by: Carl Worth <cworth@cworth.org>
11 years agoglsl: Clean up shading language mixing check for GLSL 3.00 ES.
Paul Berry [Fri, 3 Aug 2012 00:49:44 +0000 (17:49 -0700)]
glsl: Clean up shading language mixing check for GLSL 3.00 ES.

Previously, we prohibited mixing of shading language versions if
min_version == 100 or max_version >= 130.  This was technically
correct (since desktop GLSL 1.30 and beyond prohibit mixing of shading
language versions, as does GLSL 1.00 ES), but it was confusing.  Also,
we asserted that all shading language versions were between 1.00 and
1.40, which was unnecessary (since the parser already checks shading
language versions) and doesn't work for GLSL 3.00 ES.

This patch changes the code to explicitly check that (a) ES shaders
aren't mixed with desktop shaders, (b) shaders aren't mixed between ES
versions, and (c) shaders aren't mixed between desktop GLSL versions
when at least one shader is GLSL 1.30 or greater.  Also, it removes
the unnecessary assertion.

[v2, idr]: Slightly tweak the is_es_prog detection to occur outside the loop
instead of doing something special on the first loop iteration.  Suggested by
Ken.

[v3, idr]: s/IsEs(Shader|Prog)/IsES/  Suggested by Ken and Eric.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> [v1]
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Carl Worth <cworth@cworth.org>
11 years agoglsl: Record in gl_shader whether the shader uses GLSL ES.
Paul Berry [Fri, 3 Aug 2012 00:47:49 +0000 (17:47 -0700)]
glsl: Record in gl_shader whether the shader uses GLSL ES.

Previously we recorded just the GLSL version, with the knowledge that
100 means GLSL 1.00 ES.  With the advent of GLSL 3.00 ES, this is
going to get more complex, and eventually will probably become
ambiguous (GLSL 4.00 already exists, and GLSL 4.00 ES is likely to be
created some day).

To reduce confusion, this patch simply records whether the shader is
GLSL ES as an explicit boolean.

[v2, idr]: s/IsEs(Shader|Prog)/IsES/  Suggested by Ken and Eric.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> [v1]
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Acked-by: Carl Worth <cworth@cworth.org>
11 years agoglsl/parser: Handle "#version 300 es" directive.
Paul Berry [Thu, 2 Aug 2012 18:17:30 +0000 (11:17 -0700)]
glsl/parser: Handle "#version 300 es" directive.

Note that GLSL 1.00 is selected using "#version 100", so "#version 100
es" is prohibited.

v2: Check for GLES3 before allowing '#version 300 es'

v3: Make sure a correct language_version is set in
_mesa_glsl_parse_state::process_version_directive.

Signed-off-by: Paul Berry <stereotype441@gmail.com>
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Carl Worth <cworth@cworth.org>
11 years agoglsl/parser: Extract version directive processing into a function.
Paul Berry [Thu, 2 Aug 2012 18:02:55 +0000 (11:02 -0700)]
glsl/parser: Extract version directive processing into a function.

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

No functional change.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Carl Worth <cworth@cworth.org>
11 years agoglsl/preprocessor: Handle "#version 300 es" directive.
Paul Berry [Thu, 2 Aug 2012 20:21:54 +0000 (13:21 -0700)]
glsl/preprocessor: Handle "#version 300 es" directive.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Carl Worth <cworth@cworth.org>
11 years agoglsl/preprocessor: Extract version directive processing into a function.
Paul Berry [Thu, 2 Aug 2012 20:06:45 +0000 (13:06 -0700)]
glsl/preprocessor: Extract version directive processing into a function.

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

No functional change.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

[v2, idr]: Rename ctx parameter to mem_ctx

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

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

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

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

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

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

8 more piglits.

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

To be used by radeonsi.

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

As Vinson Lee did in commit bb284669f85a32900bfec648d68ba4c4300772f4
in hash_table.c

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

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

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

Note: This fixes several crashing gles3conform tests.

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

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

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

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

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

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

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

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

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

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

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

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

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

Prevents undetermined sleeps.

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

Fixes clears in Wine on r200.

NOTE: This is a candidate for stable release branches.

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

NOTE: This is a candidate for stable release branches.

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

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

NOTE: This is a candidate for stable release branches.

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

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

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

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

Several issues actually:

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Note: This is a candidate for the stable branches.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>