mesa.git
11 years agomesa: add GL_EXT_texture_rg extension for OpenGL ES 2.x.
Gwenole Beauchesne [Wed, 18 Apr 2012 14:38:47 +0000 (16:38 +0200)]
mesa: add GL_EXT_texture_rg extension for OpenGL ES 2.x.

11 years agoGLES2: upgrade gl2ext.h to version 18099
Kristian Høgsberg [Wed, 4 Jul 2012 00:47:04 +0000 (20:47 -0400)]
GLES2: upgrade gl2ext.h to version 18099

Redo this commit, and remove the inclusion of gl2ext.h
from src/mapi/glapi/glapi_priv.h.  The include was added in
8f3be339850ead96f9c6200db4e0db1f74e39d13 to fix a missing prototype for
glDrawBuffersNV and others, but it's not possible to include both
glext.h and gl2ext.h from the same file.

I don't see the missing prototype here (with or without shared glapi)
so I'm just removing the offending #include.

Also, since we're redoing this, update to the most recent gl2ext.2.

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
11 years agomesa/st: gl_ClipDistance must be interpolated in 3d space.
Olivier Galibert [Sun, 24 Jun 2012 09:18:18 +0000 (11:18 +0200)]
mesa/st: gl_ClipDistance must be interpolated in 3d space.

That old bug was hidden but the clipper always interpolating in 3d space
no matter what it should have been doing.  Now that the interpolation
has been fixed, the bug shows up.

Fixes fdo 51364.

Signed-off-by: Olivier Galibert <galibert@pobox.com>
Signed-off-by: José Fonseca <jfonseca@vmware.com>
11 years agogallium/util: Save and restore vertex buffer state in util_gen_mipmap.
Stuart Abercrombie [Fri, 29 Jun 2012 23:31:24 +0000 (16:31 -0700)]
gallium/util: Save and restore vertex buffer state in util_gen_mipmap.

Calling glGenerateMipmap could overwrite vertex buffer state, leading
 to incorrect rendering or crashes depending on the Gallium driver.

This was happening on WebGL Conformance test texture-size.

Before 784dd51198433e5c299da4a7742c68d21d68d1c1 this was covered up
by redundant vertex buffer validation.

Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Signed-off-by: Marek Olšák <maraeo@gmail.com>
11 years agoRevert "GLES2: upgrade gl2ext.h to version 16994."
Marek Olšák [Tue, 3 Jul 2012 22:25:08 +0000 (00:25 +0200)]
Revert "GLES2: upgrade gl2ext.h to version 16994."

This reverts commit 8818b88748bde6de5a4a98ad237c85151b44c774.

I get a lot of errors like this one:

In file included from ../../../src/mapi/glapi/glapi_priv.h:49:0,
                 from glapi_dispatch.c:40:
../../../include/GLES2/gl2ext.h:1074:28: error: redefinition of typedef ‘PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC’
../../../include/GL/glext.h:10237:25: note: previous declaration of ‘PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC’ was here

This with a clean build (with git clean -fdX).

I don't get the errors on my other machine. I didn't investigate why,
a wild guess is that this depends on the version of gcc.

11 years agoRevert "mesa: add GL_EXT_texture_rg extension for OpenGL ES 2.x."
Marek Olšák [Tue, 3 Jul 2012 22:25:00 +0000 (00:25 +0200)]
Revert "mesa: add GL_EXT_texture_rg extension for OpenGL ES 2.x."

This reverts commit d1665388ce53d23ee7853e5083ce6f7192061109.

11 years agomesa: add GL_EXT_texture_rg extension for OpenGL ES 2.x.
Gwenole Beauchesne [Wed, 18 Apr 2012 14:38:47 +0000 (16:38 +0200)]
mesa: add GL_EXT_texture_rg extension for OpenGL ES 2.x.

11 years agoGLES2: upgrade gl2ext.h to version 16994.
Gwenole Beauchesne [Mon, 23 Apr 2012 08:55:28 +0000 (10:55 +0200)]
GLES2: upgrade gl2ext.h to version 16994.

11 years agoi965/fs: Allow copy propagation on uniforms.
Eric Anholt [Thu, 7 Jun 2012 15:48:50 +0000 (08:48 -0700)]
i965/fs: Allow copy propagation on uniforms.

This is a big win for savage2, hon and yofrankie.  62 new programs for
savage2/hon get 16-wide mode, along with one for humus demos and two
for tropics.  Even a few shaders from tropics see reductions of 15% or
more.

total instructions in shared programs: 216536 -> 207353 (-4.24%)
instructions in affected programs:     123941 -> 114758 (-7.41%)

In benchmarking Tropics, only a .040% +/- 034% performance improvement
was observed (n=90).  Rather disappointing, but I was primarily
motivated to do this patch by a regression in the number of 16-wide
shaders compiled after a GRF texturing on IVB patch I'm working on.
Hopefully this helps avoid that regression.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965/fs: Allow copy propagation with source modifiers.
Eric Anholt [Wed, 6 Jun 2012 18:06:51 +0000 (11:06 -0700)]
i965/fs: Allow copy propagation with source modifiers.

This shaves a few instructions off of a ton of programs.  For 12
shaders from tropics and sanctuary, it's enough reduction in register
pressure to get 16-wide mode.  7 shaders from heroes of newerth and
savage2 are hurt by about 1.1%, where copy propagation of negates ends
up preventing coalescing, but we could regain that by doing dataflow
analysis in our copy propagation.

No significant performance difference in tropics (n=11)

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965/fs: Move copy propagation test out to a separate function.
Eric Anholt [Wed, 6 Jun 2012 17:57:54 +0000 (10:57 -0700)]
i965/fs: Move copy propagation test out to a separate function.

It's going to get more complicated in a moment.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglx/tests: Fix off-by-one error in allocating extension string buffer
Ian Romanick [Mon, 4 Jun 2012 20:28:16 +0000 (13:28 -0700)]
glx/tests: Fix off-by-one error in allocating extension string buffer

NOTE: This is a candidate for the 8.0 release branch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=50621
Bugzilla: https://bugs.gentoo.org/show_bug.cgi?id=418161
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: Markus Oehme <oehme.markus@gmx.de>
11 years agoglsl: fix unop/binop errors in comments
Brian Paul [Mon, 2 Jul 2012 17:09:22 +0000 (11:09 -0600)]
glsl: fix unop/binop errors in comments

11 years agomsaa: Make meta-ops save and restore state of GL_MULTISAMPLE.
Paul Berry [Wed, 27 Jun 2012 23:16:26 +0000 (16:16 -0700)]
msaa: Make meta-ops save and restore state of GL_MULTISAMPLE.

The meta-ops _mesa_meta_Clear() and _mesa_meta_glsl_Clear() need to
ignore the state of GL_SAMPLE_ALPHA_TO_COVERAGE,
GL_SAMPLE_ALPHA_TO_ONE, GL_SAMPLE_COVERAGE, GL_SAMPLE_COVERAGE_VALUE,
and GL_SAMPLE_COVERAGE_INVERT when clearing multisampled buffers.  The
easiest way to accomplish this is to disable GL_MULTISAMPLE during the
clear meta-ops.

Note: this patch also causes GL_MULTISAMPLE to be disabled during
_mesa_meta_GenerateMipmap() and _mesa_meta_GetTexImage() (since those
two meta-ops use MESA_META_ALL).  Arguably this isn't strictly
necessary, since those meta-ops use their own non-MSAA fbo's, but it
shouldn't do any harm.

Fixes Piglit tests "EXT_framebuffer_multisample/clear {2,4}
{color,stencil}" on i965.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
11 years agoi965/msaa: Fix centroid interpolation of unlit pixels.
Paul Berry [Thu, 21 Jun 2012 18:21:22 +0000 (11:21 -0700)]
i965/msaa: Fix centroid interpolation of unlit pixels.

From the Ivy Bridge PRM, Vol 2 Part 1 p280-281 (3DSTATE_WM:
Barycentric Interpolation Mode):

    "Errata: When Centroid Barycentric mode is required, HW may
    produce incorrect interpolation results when a 2X2 pixels have
    unlit pixels."

To work around this problem, after doing centroid interpolation, we
replace the centroid-interpolated values for unlit pixels with
non-centroid-interpolated values (which are interpolated at pixel
centers).  This produces correct rendering at the expense of a slight
increase in shader execution time.

I've conditioned the workaround with a runtime flag
(brw->needs_unlit_centroid_workaround) in the hopes that we won't need
it in future chip generations.

Fixes piglit tests "EXT_framebuffer_multisample/interpolation {2,4}
{centroid-deriv,centroid-deriv-disabled}".  All MSAA interpolation
tests pass now.

Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965/fs: Add FS_OPCODE_MOV_DISPATCH_TO_FLAGS to fragment shader backend.
Paul Berry [Mon, 18 Jun 2012 21:50:04 +0000 (14:50 -0700)]
i965/fs: Add FS_OPCODE_MOV_DISPATCH_TO_FLAGS to fragment shader backend.

In order to compute centroid varyings correctly, the fragment shader
needs to be able to load the current pixel/sample mask into a flag
register.  This patch adds an opcode to the fragment shader back-end
to do this; the opcode gets translated into the instruction

mov(1)  f0<1>UW  g1.14<0,1,0>UW  { align1 WE_all }

Since this instruction clobbers f0, instruction scheduling has to
treat it the same as instructions that have a conditional modifier.

Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965: fix transform feedback with primitive restart
Jordan Justen [Thu, 28 Jun 2012 17:32:09 +0000 (10:32 -0700)]
i965: fix transform feedback with primitive restart

When querying GL_PRIMITIVES_GENERATED, if primitive restart
is also used, then take the software primitive restart
path so GL_PRIMITIVES_GENERATED is returned correctly.

GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN is also updated
since it will also affected by the same issue.

As noted in brw_primitive_restart.c, with further work we
should be able to move this situation back to a hardware
handled path.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Re-enable rendering to SNORM formats.
Kenneth Graunke [Sat, 9 Jun 2012 09:33:21 +0000 (02:33 -0700)]
i965: Re-enable rendering to SNORM formats.

Commit d73f6375f50b fixed the cause of the Piglit failure with
ARB_color_buffer_float fragment clamp modes.  Now that it's fixed,
there's no reason to leave snorm format rendering disabled.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Remove unused ir_loop_jump::loop pointer.
Kenneth Graunke [Sun, 1 Jul 2012 23:21:32 +0000 (16:21 -0700)]
glsl: Remove unused ir_loop_jump::loop pointer.

Commit 0c005bd7 intended to make ir_loop_jump::mode public, but also
accidentally added a new pointer to the enclosing loop.  Furthermore, it
tried to initialize the new field by adding "this->loop = loop;" to the
constructor, but since there is no loop parameter, this only initialized
the field to itself---so it will likely be a garbage pointer.

A lot of code, such as lower_jumps, allocates new loop jumps without
setting this field appropriately, so any uses would probably just crash.

Thankfully, there were none, so we can just delete the field.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=51574
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agometa: Don't alter fragment color clamp in DrawPixels().
Kenneth Graunke [Sat, 9 Jun 2012 09:33:20 +0000 (02:33 -0700)]
meta: Don't alter fragment color clamp in DrawPixels().

DrawPixels uses the MESA_META_CLAMP_FRAGMENT_COLOR flag to save/restore
the fragment color clamp mode.  This is unnecessary since it never
alters it.  It's also harmful: when the clamp mode is GL_FIXED_ONLY,
setting this flag causes _mesa_meta_begin to force it to GL_FALSE,
breaking clamping on SNORM formats.

DrawPixels should use the user-specified clamp mode and not change it.

Fixes Piglit's spec/ARB_color_buffer_float/GL_RGBA8_SNORM-drawpixels
test on i965/Sandybridge (with SNORM render targets re-enabled).

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agomesa: use FLUSH_CURRENT and not FLUSH_VERTICES in _mesa_validate_*
Marek Olšák [Mon, 2 Jul 2012 15:10:09 +0000 (17:10 +0200)]
mesa: use FLUSH_CURRENT and not FLUSH_VERTICES in _mesa_validate_*

ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL calls FLUSH_VERTICES, which
is not what we want.

This fixes a breakage in classic drivers, introduced in:

  62b971673950148eb949ba23d7fdc47debea16f0
  vbo: first ASSERT_OUTSIDE_BEGIN_END then FLUSH, not the other way around

It should fix:
  https://bugs.freedesktop.org/show_bug.cgi?id=51629
  https://bugs.freedesktop.org/show_bug.cgi?id=51642

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agomesa: point to Makefile.old in the srcdir
Dylan Noblesmith [Thu, 28 Jun 2012 20:29:25 +0000 (20:29 +0000)]
mesa: point to Makefile.old in the srcdir

Gets out-of-tree builds slightly closer to working.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agomesa: fix parser source gen for out-of-tree builds
Dylan Noblesmith [Thu, 28 Jun 2012 20:28:13 +0000 (20:28 +0000)]
mesa: fix parser source gen for out-of-tree builds

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agomesa: fix api source gen for out-of-tree builds
Dylan Noblesmith [Thu, 28 Jun 2012 20:27:15 +0000 (20:27 +0000)]
mesa: fix api source gen for out-of-tree builds

Add $(srcdir) where needed.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglapi/gen: fix out of tree build
Dylan Noblesmith [Thu, 28 Jun 2012 20:03:33 +0000 (20:03 +0000)]
glapi/gen: fix out of tree build

Add "-f $(srcdir)/gl_API.xml" to the arguments of all
the scripts that by default look for gl_API.xml in the
working directory when run with no arguments, and prepend
$(srcdir) to those scripts that are already using an
explicit -f argument.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agogallium/tgsi: Don't declare temps individually when they are all similar.
José Fonseca [Fri, 29 Jun 2012 20:18:24 +0000 (21:18 +0100)]
gallium/tgsi: Don't declare temps individually when they are all similar.

tgsi_ureg was recently enhanced to support local temporaries, and as result
temps are declared individually.

This change avoids many TEMP register declarations on common shaders.

(And fixes performance regression due to mismatches against performance
sensitive shaders.)

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agogallivm: Cleanup the 4 x float -> 16 ub special path in lp_build_conv.
José Fonseca [Fri, 29 Jun 2012 20:31:59 +0000 (21:31 +0100)]
gallivm: Cleanup the 4 x float -> 16 ub special path in lp_build_conv.

No behaviour change intended.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agogallium/util: Add ULL suffix to large constants.
José Fonseca [Mon, 2 Jul 2012 11:08:01 +0000 (12:08 +0100)]
gallium/util: Add ULL suffix to large constants.

As suggested by Andy Furniss: it looks like some old gcc versions
require it.

11 years agoclover: Handle NULL devs argument in clBuildProgram
Tom Stellard [Thu, 28 Jun 2012 20:05:21 +0000 (20:05 +0000)]
clover: Handle NULL devs argument in clBuildProgram

If devs is NULL, then the kernel should be compiled for all devices
associated with the program.

11 years agoclover: Define non-templated copy constructor for clover::ref_ptr.
Francisco Jerez [Wed, 27 Jun 2012 23:16:23 +0000 (01:16 +0200)]
clover: Define non-templated copy constructor for clover::ref_ptr.

The templated copy constructor doesn't prevent the compiler from
emitting a default copy constructor, which leads to inconsistent
memory handling and was reported to cause segfaults when doing event
manipulation.

Reported-by: Tom Stellard <thomas.stellard@amd.com>
11 years agollvmpipe: fix comment typo
Brian Paul [Thu, 28 Jun 2012 22:26:21 +0000 (16:26 -0600)]
llvmpipe: fix comment typo

11 years agost/mesa: use DEBUG_INCOMPLETE_FBO debug flag
Brian Paul [Thu, 28 Jun 2012 22:07:35 +0000 (16:07 -0600)]
st/mesa: use DEBUG_INCOMPLETE_FBO debug flag

11 years agomesa: remove some unused gl_dlist_state fields
Brian Paul [Thu, 28 Jun 2012 22:07:19 +0000 (16:07 -0600)]
mesa: remove some unused gl_dlist_state fields

11 years agoclover: Add a function internalizer pass before LTO v2
Tom Stellard [Thu, 21 Jun 2012 17:55:15 +0000 (13:55 -0400)]
clover: Add a function internalizer pass before LTO v2

The function internalizer pass marks non-kernel functions as internal,
which enables optimizations like function inlining and global dead-code
elimination.

v2:
  - Pass vector arguments by const reference

11 years agoradeon/llvm: Enable vec4 loads on R600
Tom Stellard [Thu, 28 Jun 2012 20:27:55 +0000 (20:27 +0000)]
radeon/llvm: Enable vec4 loads on R600

11 years agoradeon/llvm: Enable floating point stores on R600
Tom Stellard [Thu, 28 Jun 2012 20:27:32 +0000 (20:27 +0000)]
radeon/llvm: Enable floating point stores on R600

11 years agoradeon/llvm: Handle floating point loads on R600
Tom Stellard [Wed, 27 Jun 2012 21:10:42 +0000 (21:10 +0000)]
radeon/llvm: Handle floating point loads on R600

11 years agoradeon/llvm: Expand UDIV and UREM nodes
Tom Stellard [Wed, 27 Jun 2012 21:09:51 +0000 (21:09 +0000)]
radeon/llvm: Expand UDIV and UREM nodes

11 years agoradeon/llvm: Emit raw ISA for vertex fetch instructions
Tom Stellard [Fri, 29 Jun 2012 16:41:32 +0000 (16:41 +0000)]
radeon/llvm: Emit raw ISA for vertex fetch instructions

11 years agogallium/util: Truly disable INF/NAN tests on MSVC.
José Fonseca [Fri, 29 Jun 2012 12:39:07 +0000 (13:39 +0100)]
gallium/util: Truly disable INF/NAN tests on MSVC.

Thanks to Brian for spotting this.

11 years agogallium/util: Disable INF/NAN tests on MSVC.
José Fonseca [Fri, 29 Jun 2012 12:39:07 +0000 (13:39 +0100)]
gallium/util: Disable INF/NAN tests on MSVC.

Somehow they are not recognized as constants.

11 years agotranslate: Free elt8_func/elt16_func too.
José Fonseca [Wed, 20 Jun 2012 10:51:57 +0000 (11:51 +0100)]
translate: Free elt8_func/elt16_func too.

These were leaking.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agoutil: Reimplement half <-> float conversions.
James Benton [Tue, 12 Jun 2012 11:11:14 +0000 (12:11 +0100)]
util: Reimplement half <-> float conversions.

Removed u_half.py used to generate the table for previous method.

Previous implementation of float to half conversion was faulty for
denormalised and NaNs and would require extra logic to fix,
thus making the speedup of using tables irrelevant.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agotests: Updated tests to properly handle NaN for half floats.
James Benton [Tue, 12 Jun 2012 11:12:16 +0000 (12:12 +0100)]
tests: Updated tests to properly handle NaN for half floats.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agoutil: Updated u_format_tests to rigidly test half-float boundary values.
James Benton [Tue, 22 May 2012 13:55:18 +0000 (14:55 +0100)]
util: Updated u_format_tests to rigidly test half-float boundary values.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agoutil: Added functions for checking NaN / Inf for double and half-floats.
James Benton [Tue, 22 May 2012 13:53:30 +0000 (14:53 +0100)]
util: Added functions for checking NaN / Inf for double and half-floats.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agoutil: Added util_format_is_array.
James Benton [Fri, 18 May 2012 16:27:19 +0000 (17:27 +0100)]
util: Added util_format_is_array.

This function checks whether a format description is in a simple array format.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agovbo: optimize validation for glMultiDrawElements
Marek Olšák [Wed, 27 Jun 2012 04:29:42 +0000 (06:29 +0200)]
vbo: optimize validation for glMultiDrawElements

Some parameters need to be checked only once.
check_valid_to_render needs to be called only once.

The validate function is based on the one for DrawElements.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agovbo: first ASSERT_OUTSIDE_BEGIN_END then FLUSH, not the other way around
Marek Olšák [Wed, 27 Jun 2012 04:10:30 +0000 (06:10 +0200)]
vbo: first ASSERT_OUTSIDE_BEGIN_END then FLUSH, not the other way around

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agovbo: don't call twice _mesa_valid_to_render in DrawArraysInstancedBaseInstance
Marek Olšák [Wed, 27 Jun 2012 03:45:47 +0000 (05:45 +0200)]
vbo: don't call twice _mesa_valid_to_render in DrawArraysInstancedBaseInstance

It's called in _mesa_validate_DrawArraysInstanced already.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agomesa: rename MaxTransformFeedbackSeparateAttribs to MaxTransformFeedbackBuffers
Marek Olšák [Sun, 18 Dec 2011 01:13:17 +0000 (02:13 +0100)]
mesa: rename MaxTransformFeedbackSeparateAttribs to MaxTransformFeedbackBuffers

This is a cleanup for ARB_transform_feedback3, where
GL_MAX_TRANSFORM_FEEDBACK_BUFFERS is introduced for interleaved attribs and
has the same meaning as GL_MAX_.._SEPARATE_ATTRIBS for separate attribs.

Also, the maximum number of TFB buffers is reduced from 32 to 4, which makes
this patch useful even without the extension.
I don't know of any hardware which can do more than 4.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agogallivm: Refactor lp_build_broadcast(_scalar) to share code.
José Fonseca [Thu, 28 Jun 2012 17:07:10 +0000 (18:07 +0100)]
gallivm: Refactor lp_build_broadcast(_scalar) to share code.

Doesn't really change the generated assembly, but produces more compact IR,
and of course, makes code more consistent.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agogallivm: Fix potential buffer overflowing in strncat.
Johannes Obermayr [Thu, 28 Jun 2012 08:16:47 +0000 (10:16 +0200)]
gallivm: Fix potential buffer overflowing in strncat.

Signed-off-by: José Fonseca <jfonseca@vmware.com>
11 years agonv50: dynamically allocate space for shader local storage
Marcin Slusarz [Wed, 27 Jun 2012 12:45:17 +0000 (14:45 +0200)]
nv50: dynamically allocate space for shader local storage

Fixes 21 piglit tests:
spec/glsl-1.10/execution/variable-indexing/
fs-temp-array-mat4-index-col-row-wr
vs-temp-array-mat4-index-col-row-wr
vs-temp-array-mat4-index-row-wr

spec/glsl-1.20/execution/variable-indexing/
fs-temp-array-mat3-index-col-row-rd
fs-temp-array-mat3-index-row-rd
fs-temp-array-mat4-col-row-wr
fs-temp-array-mat4-index-col-row-rd
fs-temp-array-mat4-index-col-row-wr
fs-temp-array-mat4-index-row-rd
fs-temp-array-mat4-index-row-wr
vs-temp-array-mat3-index-col-row-rd
vs-temp-array-mat3-index-col-row-wr
vs-temp-array-mat3-index-row-rd
vs-temp-array-mat3-index-row-wr
vs-temp-array-mat4-col-row-wr
vs-temp-array-mat4-index-col-row-rd
vs-temp-array-mat4-index-col-row-wr
vs-temp-array-mat4-index-col-wr
vs-temp-array-mat4-index-row-rd
vs-temp-array-mat4-index-row-wr
vs-temp-array-mat4-index-wr

... and prevents a lot of GPU lockups

11 years agonv50: streamline screen_create error handling
Marcin Slusarz [Tue, 26 Jun 2012 14:22:43 +0000 (16:22 +0200)]
nv50: streamline screen_create error handling

Remove macro which changes control flow (it's evil).
Make all fail paths print (correct) error message.

11 years agonv50/ir: make colorful ir dump output optional
Marcin Slusarz [Tue, 26 Jun 2012 13:02:55 +0000 (15:02 +0200)]
nv50/ir: make colorful ir dump output optional

11 years agomesa: more const qualifiers to match the latest glext.h
Brian Paul [Wed, 27 Jun 2012 16:52:55 +0000 (10:52 -0600)]
mesa: more const qualifiers to match the latest glext.h

For some reason regular gcc on Linux didn't catch these but the mingw
compiler did (generated errors, not warnings).

v2: include the changes in src/mapi/ too

11 years agoglapi: add const qualifier to glShaderSourceARB() parameter
Brian Paul [Wed, 27 Jun 2012 16:23:54 +0000 (10:23 -0600)]
glapi: add const qualifier to glShaderSourceARB() parameter

Fixes the es2 build with gcc.

Note: in glext.h the prototypes for glShaderSource() and glShaderSourceARB()
disagree:  only the former has the extra const qualifier.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
11 years agoi965: enable ARB_instanced_arrays extension
Jordan Justen [Sun, 27 May 2012 17:48:47 +0000 (10:48 -0700)]
i965: enable ARB_instanced_arrays extension

Set the step_rate value when drawing to implement
ARB_instanced_arrays for gen >= 4.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoglsl: be more careful about counting varying vars in the linker
Brian Paul [Tue, 26 Jun 2012 19:06:47 +0000 (13:06 -0600)]
glsl: be more careful about counting varying vars in the linker

Previously, we were counting gl_FrontFacing, gl_FragCoord and gl_PointCoord
against the limit of varying variables.  This prevented some valid shaders
from linking.

The other potential solution to this is to have the driver advertise
more varying vars or set the GLSLSkipStrictMaxVaryingLimitCheck flag.
But the above-mentioned variables aren't conventional varying attributes
so it doesn't seem right to count them.

Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agodocs/helpwanted: add some useful todo lists
Andreas Boll [Tue, 26 Jun 2012 18:47:05 +0000 (20:47 +0200)]
docs/helpwanted: add some useful todo lists

Signed-off-by: Brian Paul <brianp@vmware.com>
11 years agosoftpipe: fix numFragsEmitted debug code
Brian Paul [Tue, 26 Jun 2012 20:47:19 +0000 (14:47 -0600)]
softpipe: fix numFragsEmitted debug code

11 years agogallium: minor whitespace, comment changes
Brian Paul [Tue, 26 Jun 2012 20:47:19 +0000 (14:47 -0600)]
gallium: minor whitespace, comment changes

11 years agomesa: update glext.h to version 81
Brian Paul [Tue, 26 Jun 2012 20:47:19 +0000 (14:47 -0600)]
mesa: update glext.h to version 81

11 years agomesa: update glxext.h to version 33
Brian Paul [Tue, 26 Jun 2012 20:47:19 +0000 (14:47 -0600)]
mesa: update glxext.h to version 33

11 years agomesa: make _mesa_reference_array_object() an inline function
Brian Paul [Tue, 26 Jun 2012 20:47:19 +0000 (14:47 -0600)]
mesa: make _mesa_reference_array_object() an inline function

As we do for texture objects, buffer objects, etc.

11 years agomesa: look up enum name for glEnable/Disable errors
Brian Paul [Tue, 26 Jun 2012 20:47:19 +0000 (14:47 -0600)]
mesa: look up enum name for glEnable/Disable errors

11 years agomesa: move TEXGEN defines closer to gl_texgen struct
Brian Paul [Tue, 26 Jun 2012 20:47:19 +0000 (14:47 -0600)]
mesa: move TEXGEN defines closer to gl_texgen struct

11 years agomesa: rename ColorMaterialBitmask to _ColorMaterialBitmask
Brian Paul [Tue, 26 Jun 2012 20:47:19 +0000 (14:47 -0600)]
mesa: rename ColorMaterialBitmask to _ColorMaterialBitmask

Since it's a derived field.

11 years agomesa: re-order, update comments on lighting-related structs
Brian Paul [Tue, 26 Jun 2012 20:47:19 +0000 (14:47 -0600)]
mesa: re-order, update comments on lighting-related structs

11 years agogallium/util: Fix parsing of options with underscore.
José Fonseca [Wed, 27 Jun 2012 10:15:53 +0000 (11:15 +0100)]
gallium/util: Fix parsing of options with underscore.

For example

  GALLIVM_DEBUG=no_brilinear

which was being parsed as two options, "no" and "brilinear".

11 years agogallivm: Added a generic lp_build_print_value which prints a LLVMValueRef.
James Benton [Tue, 26 Jun 2012 14:00:14 +0000 (15:00 +0100)]
gallivm: Added a generic lp_build_print_value which prints a LLVMValueRef.

Updated lp_build_printf to share common code.
Removed specific lp_build_print_vecX.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agoi915g: Implement sRGB textures
Stéphane Marchesin [Tue, 26 Jun 2012 02:45:56 +0000 (19:45 -0700)]
i915g: Implement sRGB textures

Since we don't have them in hw we emulate them in the shader. Although not
recommended by the spec it is legit.

As a side effect we also get GL 2.1. I think this is as far as we can take
the i915.

11 years agosvga: return 120 for PIPE_CAP_GLSL_FEATURE_LEVEL
Brian Paul [Tue, 26 Jun 2012 22:37:33 +0000 (16:37 -0600)]
svga: return 120 for PIPE_CAP_GLSL_FEATURE_LEVEL

Reviewed-by: Marek Olšák <maraeo@gmail.com>
11 years agollvmpipe: return 120 for PIPE_CAP_GLSL_FEATURE_LEVEL
Brian Paul [Tue, 26 Jun 2012 22:37:22 +0000 (16:37 -0600)]
llvmpipe: return 120 for PIPE_CAP_GLSL_FEATURE_LEVEL

Reviewed-by: Marek Olšák <maraeo@gmail.com>
11 years agoglsl: glcpp: Extend testing of #line directives
Carl Worth [Sat, 9 Jun 2012 23:37:08 +0000 (16:37 -0700)]
glsl: glcpp: Extend testing of #line directives

The most recent commit adds support for comments and macro expansion
on #line directives. Add testing to verify the new features.

Signed-off-by: Carl Worth <cworth@cworth.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: glcpp: Move handling of #line directives from lexer to parser.
Carl Worth [Sat, 9 Jun 2012 23:31:06 +0000 (16:31 -0700)]
glsl: glcpp: Move handling of #line directives from lexer to parser.

The GLSL specification requires that #line directives be interpreted
after macro expansion. Our existing implementation of #line macros in
the lexer prevents conformance on this point.

Moving the handling of #line from the lexer to the parser gives us the
macro expansion we need. An additional benefit is that the
preprocessor also now supports comments on the same line as #line
directives.

Finally, the preprocessor now emits the (fully-macro-expanded) #line
directives into the output. This allows the full GLSL compiler to also
see and interpret these directives so it can also generate correct
line numbers in error messages.

Signed-off-by: Carl Worth <cworth@cworth.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: glcpp: Rename and document _glcpp_parser_expand_if
Carl Worth [Sat, 9 Jun 2012 23:29:38 +0000 (16:29 -0700)]
glsl: glcpp: Rename and document _glcpp_parser_expand_if

This function is currently used only in the expansion of #if lines,
but we will soon be using it more generally (for the expansion of
(_glcpp_parser_expand_and_lex_from) and some more documentation.

Signed-off-by: Carl Worth <cworth@cworth.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Consistently use length-based ralloc string functions for info_log.
Carl Worth [Sat, 9 Jun 2012 16:45:56 +0000 (09:45 -0700)]
glsl: Consistently use length-based ralloc string functions for info_log.

Commit b823b99ec0f13af257dcd885f436a4d294c6222a switched from using
functions such as ralloc_asprintf and ralloc_strcat to
ralloc_asprintf_rewrite_tail. This change maintains the string's
length as a aparamter that is updated by the ralloc functions (rather
than recomputing it with strlen over and over).

However, the change failed to updated two locations (glcpp_error and
glcpp_warning), with the result that the string's length wasn't
updated by these calls. Then, subsequent calls to other
ralloc_asprintf_rewrite_tail would overwrite the text appended by
glcpp_error.

This commit fixes the two missing updates, and restores line numbers
to the output of glcpp error messages, (as noticed by a glcpp unit
test case that has been failing since the above-mentioned commit).

Signed-off-by: Carl Worth <cworth@cworth.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: glcpp: Allow "#if undefined-macro' to evaluate to false.
Carl Worth [Fri, 8 Jun 2012 22:00:49 +0000 (15:00 -0700)]
glsl: glcpp: Allow "#if undefined-macro' to evaluate to false.

A strict reading of the GLSL specification would have this be an
error, but we've received reports from users who expect the
preprocessor to interepret undefined macros as 0. This is the standard
behavior of the rpeprocessor for C, and according to these user
reports is also the behavior of other OpenGL implementations.

So here's one of those cases where we can make our users happier by
ignoring the specification. And it's hard to imagine users who really,
really want to see an error for this case.

The two affected tests cases are updated to reflect the new behavior.

Signed-off-by: Carl Worth <cworth@cworth.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agor600g: enable DUAL_EXPORT mode when possible on r6xx/r7xx
Jerome Glisse [Tue, 26 Jun 2012 16:24:08 +0000 (12:24 -0400)]
r600g: enable DUAL_EXPORT mode when possible on r6xx/r7xx

DUAL_EXPORT can be enabled on r6xx/r7xx when all CBs use 16-bit export
and there is no depth/stencil export.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
11 years agor600g: enable DUAL_EXPORT mode when possible
Vadim Girlin [Tue, 26 Jun 2012 16:23:31 +0000 (12:23 -0400)]
r600g: enable DUAL_EXPORT mode when possible

It seems DUAL_EXPORT on evergreen may be enabled when all CBs use 16-bit export
mode (EXPORT_4C_16BPC), also there should be at least one CB, and the PS
shouldn't export depth/stencil.

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
11 years agor600g: avoid unnecessary shader exports v2
Vadim Girlin [Tue, 26 Jun 2012 18:47:27 +0000 (22:47 +0400)]
r600g: avoid unnecessary shader exports v2

In some cases TGSI shader has more color outputs than the number of CBs,
so it seems we need to limit the number of color exports. This requires
different shader variants depending on the nr_cbufs, but on the other hand
we are doing less exports, which are very costly.

v2: fix various piglit regressions

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
Signed-off-by: Jerome Glisse <jglisse@redhat.com>
11 years agor600g: cache shader variants instead of rebuilding v3
Vadim Girlin [Mon, 11 Jun 2012 09:11:47 +0000 (13:11 +0400)]
r600g: cache shader variants instead of rebuilding v3

Shader variants are stored in the list, the key for lookup is based on the
states that require different hw shaders - currently it's rctx->two_side (all
gpus) and rctx->nr_cbufs (evergreen/cayman, when writes_all property is set).

v2:
 - use simple list instead of keymap as suggested by Marek on irc
 - call r600_adjust_gprs from r600_bind_vs_shader for r6xx/r7xx
   (r600_shader_select isn't used for vertex shaders currently)

v3:
 - fix call to r600_adjust_gprs - do it after updating current shader

Improves performance for some apps, e.g. FlightGear -
see https://bugs.freedesktop.org/show_bug.cgi?id=50360

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
11 years agosvga: handle missing PIPE_CAP_x queries
Brian Paul [Tue, 26 Jun 2012 20:41:46 +0000 (14:41 -0600)]
svga: handle missing PIPE_CAP_x queries

And fix incorrect error message for a bad shader type/number.

Reviewed-by: Marek Olšák <maraeo@gmail.com>
11 years agollvmpipe: handle more PIPE_CAP_x queries
Brian Paul [Tue, 26 Jun 2012 20:11:00 +0000 (14:11 -0600)]
llvmpipe: handle more PIPE_CAP_x queries

As with the previous commit for softpipe.

v2: remove 'default' case to get compile-time warning

Reviewed-by: Marek Olšák <maraeo@gmail.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
11 years agosoftpipe: handle more PIPE_CAP_x queries
Brian Paul [Tue, 26 Jun 2012 20:02:43 +0000 (14:02 -0600)]
softpipe: handle more PIPE_CAP_x queries

These all return zero.  Add a debug_printf() to catch the default case so
we don't accidently mishandle something important in the future.

v2: remove 'default' case to get compile-time warning

Reviewed-by: Marek Olšák <maraeo@gmail.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
11 years agosvga: return 1 for PIPE_CAP_MIXED_COLORBUFFER_FORMATS
Brian Paul [Tue, 26 Jun 2012 18:59:30 +0000 (12:59 -0600)]
svga: return 1 for PIPE_CAP_MIXED_COLORBUFFER_FORMATS

This is actually required for GL_ARB_framebuffer_object, but the state
tracker doesn't currently check it.
Direct3D 9 allows mixed format color buffers with some restrictions.
Setting this allows Unigine Heaven 2.5 and 3.0 to run.  Tested both on
GL and D3D hosts.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
11 years agoglsl: fix comment typo
Brian Paul [Tue, 26 Jun 2012 15:45:29 +0000 (09:45 -0600)]
glsl: fix comment typo

11 years agou2f_emit: Fix type parameter in LLVM call.
Olivier Galibert [Mon, 25 Jun 2012 16:50:13 +0000 (18:50 +0200)]
u2f_emit: Fix type parameter in LLVM call.

The type is the destination type (i.e. float vector) and not the
source type.  Fixes piglit fs-{in,de}crement-uint.

Signed-off-by: Olivier Galibert <galibert@pobox.com>
Signed-off-by: José Fonseca <jfonseca@vmware.com>
11 years agoi965/msaa: Set KILL_ENABLE when GL_ALPHA_TO_COVERAGE enabled.
Paul Berry [Mon, 25 Jun 2012 23:57:10 +0000 (16:57 -0700)]
i965/msaa: Set KILL_ENABLE when GL_ALPHA_TO_COVERAGE enabled.

i965 hardware needs to be informed of situations in which it's
possible for pixels (or samples) to be discarded for reasons other
than depth/stencil testing (e.g. due to an explicit "discard" in the
fragment shader).  One of these situations is when
GL_ALPHA_TO_COVERAGE is enabled, since that can cause samples to be
discarded by the color calculator when the pixel's alpha value is less
than 1.0.

Without this patch, GL_ALPHA_TO_COVERAGE does not take effect on depth
buffers.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
11 years agoi965/msaa: Implement GL_SAMPLE_ALPHA_TO_{COVERAGE,ONE}.
Paul Berry [Sat, 23 Jun 2012 03:27:18 +0000 (20:27 -0700)]
i965/msaa: Implement GL_SAMPLE_ALPHA_TO_{COVERAGE,ONE}.

This patch enables the multisampling parameters
GL_SAMPLE_ALPHA_TO_COVERAGE and GL_SAMPLE_ALPHA_TO_ONE, which allow
the fragment shader's alpha output to be converted into a sample
coverage mask and ignored for blending.  i965 supports these
parameters through the BLEND_STATE structure.

The GL spec allows, but does not require, the implementation to dither
the conversion from alpha to a sample coverage mask, so that alpha
values that aren't a multiple of 1/num_samples result in the correct
proportion of samples being lit.  A bit exists in the BLEND_STATE
structure to enable this functionality, but according to the hardware
docs it must be disabled on Sandy Bridge (see the Sandy Bridge PRM,
Vol2, Part1, p379: AlphaToCoverage Dither Enable).  So it is enabled
for Gen7 only.

Fixes piglit tests
"EXT_framebuffer_multisample/sample-alpha-to-{coverage,one} {2,4}".

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
11 years agoi965/msaa: Implement glSampleCoverage.
Paul Berry [Sat, 23 Jun 2012 03:45:49 +0000 (20:45 -0700)]
i965/msaa: Implement glSampleCoverage.

This patch enables glSampleCoverage() functionality, which allows the
client program to specify that only a portion of the samples be lit up
when performing multisampled rendering.  i965 supports
glSampleCoverage() through the 3DSTATE_SAMPLE_MASK command packet,
which allows the driver to specify a bitfield indicating which samples
to light up.

Fixes piglit tests "EXT_framebuffer_multisample/sample-coverage {2,4}
{inverted,non-inverted}".

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
11 years agost/wgl: Add a few more comments.
José Fonseca [Tue, 26 Jun 2012 09:13:28 +0000 (10:13 +0100)]
st/wgl: Add a few more comments.

11 years agor600g: don't disable streamout if it hasn't been started
Marek Olšák [Tue, 26 Jun 2012 01:35:25 +0000 (03:35 +0200)]
r600g: don't disable streamout if it hasn't been started

11 years agou_blitter: disable streamout before rendering
Marek Olšák [Tue, 26 Jun 2012 01:33:16 +0000 (03:33 +0200)]
u_blitter: disable streamout before rendering

This fixes piglit EXT_transform_feedback tests:
- intervening-read output
- intervening-read prims_written

11 years agoi965/fs: Fix conversions float->bool, int->bool
Chad Versace [Thu, 21 Jun 2012 18:35:03 +0000 (11:35 -0700)]
i965/fs: Fix conversions float->bool, int->bool

Fixes gles2conform GL.equal.equal_bvec2_frag.

This fixes brw_fs_visitor's translation of ir_unop_f2b.  It used CMP to
convert the float to one of 0 or ~0. However, the convention in the
compiler is that true is represented by 1, not ~0. This patch adds an AND
to convert ~0 to 1.

By inspection, a similar problem existed with ir_unop_i2b, with a similar
fix.

[v2 kayden]: eliminate extra temporary register.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=49621
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
11 years agost/wgl: 80-column wrapping
Brian Paul [Mon, 25 Jun 2012 20:57:41 +0000 (14:57 -0600)]
st/wgl: 80-column wrapping

11 years agodocs/lists: add piglit mailing list
Andreas Boll [Mon, 25 Jun 2012 19:54:13 +0000 (21:54 +0200)]
docs/lists: add piglit mailing list

Signed-off-by: Brian Paul <brianp@vmware.com>
11 years agodocs/helpwanted: update some info
Andreas Boll [Mon, 25 Jun 2012 19:54:08 +0000 (21:54 +0200)]
docs/helpwanted: update some info

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