mesa.git
12 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

12 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".

12 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>
12 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.

12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 years agoglsl: fix comment typo
Brian Paul [Tue, 26 Jun 2012 15:45:29 +0000 (09:45 -0600)]
glsl: fix comment typo

12 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>
12 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>
12 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>
12 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>
12 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.

12 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

12 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

12 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>
12 years agost/wgl: 80-column wrapping
Brian Paul [Mon, 25 Jun 2012 20:57:41 +0000 (14:57 -0600)]
st/wgl: 80-column wrapping

12 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>
12 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>
12 years agodocs/sourcetree: update some info
Andreas Boll [Mon, 25 Jun 2012 19:54:03 +0000 (21:54 +0200)]
docs/sourcetree: update some info

Signed-off-by: Brian Paul <brianp@vmware.com>
12 years agodocs/devinfo: update release info
Andreas Boll [Mon, 25 Jun 2012 19:53:06 +0000 (21:53 +0200)]
docs/devinfo: update release info

Signed-off-by: Brian Paul <brianp@vmware.com>
12 years agodocs/systems: add some useful driver links
Andreas Boll [Mon, 25 Jun 2012 19:53:01 +0000 (21:53 +0200)]
docs/systems: add some useful driver links

Signed-off-by: Brian Paul <brianp@vmware.com>
12 years agodocs: update some broken/old links
Andreas Boll [Mon, 25 Jun 2012 19:52:51 +0000 (21:52 +0200)]
docs: update some broken/old links

Signed-off-by: Brian Paul <brianp@vmware.com>
12 years agodocs: whitespace cleanup
Andreas Boll [Mon, 25 Jun 2012 19:52:47 +0000 (21:52 +0200)]
docs: whitespace cleanup

Signed-off-by: Brian Paul <brianp@vmware.com>
12 years agodocs: escape html special char
Andreas Boll [Mon, 25 Jun 2012 19:52:10 +0000 (21:52 +0200)]
docs: escape html special char

Signed-off-by: Brian Paul <brianp@vmware.com>
12 years agodocs: add missing target attribute
Andreas Boll [Mon, 25 Jun 2012 19:51:53 +0000 (21:51 +0200)]
docs: add missing target attribute

target is needed for the frame based layout

Signed-off-by: Brian Paul <brianp@vmware.com>
12 years agodocs/shading: use proper markup
Andreas Boll [Mon, 25 Jun 2012 19:51:28 +0000 (21:51 +0200)]
docs/shading: use proper markup

use dl instead of ul

Signed-off-by: Brian Paul <brianp@vmware.com>
12 years agodocs: document the GALLIUM_LOG_FILE env var
Brian Paul [Mon, 25 Jun 2012 17:44:44 +0000 (11:44 -0600)]
docs: document the GALLIUM_LOG_FILE env var

12 years agomesa: new MESA_LOG_FILE env var to log errors, warnings, etc., to a file
Brian Paul [Mon, 25 Jun 2012 17:43:03 +0000 (11:43 -0600)]
mesa: new MESA_LOG_FILE env var to log errors, warnings, etc., to a file

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
12 years agodocs: update GL3.3 status
Marek Olšák [Mon, 25 Jun 2012 21:48:33 +0000 (23:48 +0200)]
docs: update GL3.3 status

12 years agor600g: inline r600_blit_push_depth and use resource_copy_region
Marek Olšák [Mon, 25 Jun 2012 20:53:21 +0000 (22:53 +0200)]
r600g: inline r600_blit_push_depth and use resource_copy_region

We are going to have a separate resource for depth texturing and transfers
and this is just a transfer thing.

12 years agor600g: split flushed depth texture creation and flushing
Marek Olšák [Mon, 25 Jun 2012 10:45:32 +0000 (12:45 +0200)]
r600g: split flushed depth texture creation and flushing

12 years agoi965/msaa: Add backend support for centroid interpolation.
Paul Berry [Mon, 18 Jun 2012 20:52:02 +0000 (13:52 -0700)]
i965/msaa: Add backend support for centroid interpolation.

This patch causes the fragment shader to be configured correctly (and
the correct code to be generated) for centroid interpolation.  This
required two changes: brw_compute_barycentric_interp_modes() needs to
determine when centroid barycentric coordinates need to be included in
the pixel shader thread payload, and
fs_visitor::emit_general_interpolation() needs to interpolate using
the correct set of barycentric coordinates.

Fixes piglit tests "EXT_framebuffer_multisample/interpolation {2,4}
centroid-edges" on i965.

Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965/fs: Refactor interpolation code to prepare for adding centroid support.
Paul Berry [Thu, 21 Jun 2012 18:33:22 +0000 (11:33 -0700)]
i965/fs: Refactor interpolation code to prepare for adding centroid support.

Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965/msaa: Adapt clip setup for centroid noperspective interpolation.
Paul Berry [Mon, 18 Jun 2012 18:23:01 +0000 (11:23 -0700)]
i965/msaa: Adapt clip setup for centroid noperspective interpolation.

To save time, we only instruct the clip stage of the pipeline to
compute noperspective barycentric coordinates if those coordinates are
needed by the fragment shader.  Previously, we would determine whether
the coordinates were needed by seeing whether the fragment shader used
the BRW_WM_NONPERSPECTIVE_PIXEL_BARYCENTRIC interpolation mode.

However, with MSAA, it's possible that the fragment shader might use
BRW_WM_NONPERSPECTIVE_CENTROID_BARYCENTRIC instead.  In the future,
when we support ARB_sample_shading, it might use
BRW_WM_NONPERSPECTIVE_SAMPLE_BARYCENTRIC.

This patch modifies the upload_clip_state() functions to check for all
three possible noperspective interpolation modes.

Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoglsl: Add IsCentroid bitfield to gl_fragment_program.
Paul Berry [Mon, 18 Jun 2012 19:10:13 +0000 (12:10 -0700)]
glsl: Add IsCentroid bitfield to gl_fragment_program.

This bitfield tells the back-ends which of a fragment shader's inputs
require centroid interpolation.  It is only set for GLSL fragment
shaders, since assembly fragment shaders don't support centroid
interpolation.

Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agost/mesa: added some simple fbo debugging/helper code
Brian Paul [Mon, 25 Jun 2012 17:28:03 +0000 (11:28 -0600)]
st/mesa: added some simple fbo debugging/helper code

12 years agollvmpipe: fix the LP_NO_RAST debug option
Brian Paul [Fri, 22 Jun 2012 19:06:40 +0000 (13:06 -0600)]
llvmpipe: fix the LP_NO_RAST debug option

It was only no-oping the clear() function, not actual triangle
rasterization.  Move the no_rast field from lp_context down into
lp_rasterizer so it's accessible where it's needed.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
12 years agoscons: Add glsl/glcpp to the include path.
Vinson Lee [Tue, 19 Jun 2012 07:02:53 +0000 (00:02 -0700)]
scons: Add glsl/glcpp to the include path.

Fixes this build failure on Solaris.

  Compiling build/sunos-debug/glsl/glcpp/glcpp-lex.c ...
"src/glsl/glcpp/glcpp-lex.l", line 30: cannot find include file: "glcpp-parse.h"

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agoautomake: add missing inclusion of GL headers
Laurent Carlier [Fri, 22 Jun 2012 13:03:49 +0000 (15:03 +0200)]
automake: add missing inclusion of GL headers

Building fail when GL headers are not installed in the system,
so add inclusion of these headers.

Signed-off-by: Brian Paul <brianp@vmware.com>
12 years agomesa: #define fprintf to be __mingw_fprintf() on Mingw32
Brian Paul [Fri, 22 Jun 2012 16:16:25 +0000 (10:16 -0600)]
mesa: #define fprintf to be __mingw_fprintf() on Mingw32

So that formats such as "%llx" are understood.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agosvga: init pointer to NULL to silence MSVC warning
Brian Paul [Fri, 22 Jun 2012 15:43:18 +0000 (09:43 -0600)]
svga: init pointer to NULL to silence MSVC warning

12 years agoclover: Add --with-clang-libdir option and verify CLANG_RESOURCE_DIR
Tom Stellard [Fri, 15 Jun 2012 20:52:16 +0000 (16:52 -0400)]
clover: Add --with-clang-libdir option and verify CLANG_RESOURCE_DIR

$CLANG_RESOURCE_DIR is the directory that contains all resources
needed by clang to compile programs.  When clover uses clang to
compile kernels it needs to specify a resource dir, so that clang
can find its internal headers (e.g. stddef.h).

clang defines $CLANG_RESOURCE_DIR as $CLANG_LIBDIR/clang/$CLANG_VERSION

This patch adds the --with-clang-libdir option in order to accommodate
clang intalls to non-standard locations, and it also adds a check
to the configure script to verify that $CLANG_RESOURCE_DIR/include
contains the necessary header files.

12 years agoi965: Compute dFdy() correctly for FBOs.
Paul Berry [Wed, 20 Jun 2012 20:40:45 +0000 (13:40 -0700)]
i965: Compute dFdy() correctly for FBOs.

On i965, dFdx() and dFdy() are computed by taking advantage of the
fact that each consecutive set of 4 pixels dispatched to the fragment
shader always constitutes a contiguous 2x2 block of pixels in a fixed
arrangement known as a "sub-span".  So we calculate dFdx() by taking
the difference between the values computed for the left and right
halves of the sub-span, and we calculate dFdy() by taking the
difference between the values computed for the top and bottom halves
of the sub-span.

However, there's a subtlety when FBOs are in use: since FBOs use a
coordinate system where the origin is at the upper left, and window
system framebuffers use a coordinate system where the origin is at the
lower left, the computation of dFdy() needs to be negated for FBOs.

This patch modifies the fragment shader back-ends to negate the value
of dFdy() when an FBO is in use.  It also modifies the code that
populates the program key (brw_wm_populate_key() and
brw_fs_precompile()) so that they always record in the program key
whether we are rendering to an FBO or to a window system framebuffer;
this ensures that the fragment shader will get recompiled when
switching between FBO and non-FBO use.

This will result in unnecessary recompiles of fragment shaders that
don't use dFdy().  To fix that, we will need to adapt the GLSL and
NV_fragment_program front-ends to record whether or not a given shader
uses dFdy().  I plan to implement this in a future patch series; I've
left FIXME comments in the code as a reminder.

Fixes Piglit test "fbo-deriv".

NOTE: This is a candidate for stable release branches.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agomesa: minor transform feedback comments
Brian Paul [Fri, 22 Jun 2012 14:48:45 +0000 (08:48 -0600)]
mesa: minor transform feedback comments

12 years agomesa: fix comments on UBO buffer binding functions
Brian Paul [Fri, 22 Jun 2012 14:43:58 +0000 (08:43 -0600)]
mesa: fix comments on UBO buffer binding functions

The old comments were for transform feedback.

12 years agodraw: Handle the case when there isn't a fragment shader.
Olivier Galibert [Thu, 21 Jun 2012 17:39:20 +0000 (19:39 +0200)]
draw: Handle the case when there isn't a fragment shader.

Signed-off-by: Olivier Galibert <galibert@pobox.com>
Signed-off-by: José Fonseca <jfonseca@vmware.com>
12 years agomesa: update the emacs indent files
Zack Rusin [Thu, 21 Jun 2012 21:25:09 +0000 (17:25 -0400)]
mesa: update the emacs indent files

dirvars package has been replaced by built-in functionality of
dir-locals. preserve the settings in the new infrastructure

12 years agor600g: Unify SURFACE_SYNC packet emission for 3D and compute
Tom Stellard [Thu, 7 Jun 2012 19:22:47 +0000 (15:22 -0400)]
r600g: Unify SURFACE_SYNC packet emission for 3D and compute

Drop the compute specific evergreen_set_buffer_sync() function and
instead use the r600_surface_sync_command atom for emitting SURFACE_SYNC
packets.

12 years agor600g: Enable reusing of compute state
Tom Stellard [Wed, 6 Jun 2012 23:44:09 +0000 (19:44 -0400)]
r600g: Enable reusing of compute state

12 years agor600g: Fix reading vtx instruction offset from bytestream
Tom Stellard [Wed, 6 Jun 2012 22:31:00 +0000 (18:31 -0400)]
r600g: Fix reading vtx instruction offset from bytestream

12 years agoradeon/llvm: Turn on the BitExtract peephole optimization
Tom Stellard [Wed, 20 Jun 2012 21:43:11 +0000 (17:43 -0400)]
radeon/llvm: Turn on the BitExtract peephole optimization

Thie BitExtract optimization folds a mask and shift operation together
into a single instruction (BFE_UINT).

12 years agoradeon/llvm: Lower ROTL to BIT_ALIGN
Tom Stellard [Wed, 20 Jun 2012 20:28:01 +0000 (16:28 -0400)]
radeon/llvm: Lower ROTL to BIT_ALIGN

12 years agoradeon/llvm: Use the VLIW Scheduler for R600->NI
Tom Stellard [Tue, 19 Jun 2012 22:47:18 +0000 (18:47 -0400)]
radeon/llvm: Use the VLIW Scheduler for R600->NI

It's not optimal, but it's better than the register pressure scheduler
that was previously being used.  The VLIW scheduler currently ignores
all the complicated instruction groups restrictions and just tries to
fill the instruction groups with as many instructions as possible.
Though, it does know enough not to put two trans only instructions in
the same group.

We are able to ignore the instruction group restrictions in the LLVM
backend, because the finalizer in r600_asm.c will fix any illegal
instruction groups the backend generates.

Enabling the VLIW scheduler improved the run time for a sha1 compute
shader by about 50%.  I'm not sure what the impact will be for graphics
shaders.  I tested Lightsmark with the VLIW scheduler enabled and the
framerate was about the same, but it might help apps that use really
big shaders.

12 years agomesa: set GL_ARB_uniform_buffer_object extension year to 2009
Brian Paul [Thu, 21 Jun 2012 19:08:34 +0000 (13:08 -0600)]
mesa: set GL_ARB_uniform_buffer_object extension year to 2009

12 years agomesa: Add a comment explaining my thoughts on glBindBufferBase().
Eric Anholt [Mon, 18 Jun 2012 23:20:11 +0000 (16:20 -0700)]
mesa: Add a comment explaining my thoughts on glBindBufferBase().

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agomesa: Add support for glGetIntegeri_v from GL_ARB_uniform_buffer_object.
Eric Anholt [Mon, 18 Jun 2012 22:59:13 +0000 (15:59 -0700)]
mesa: Add support for glGetIntegeri_v from GL_ARB_uniform_buffer_object.

Fixes piglit ARB_uniform_buffer_object/getintegeri_v.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agomesa: Add support for glBindBufferBase/Range on GL_UNIFORM_BUFFER.
Eric Anholt [Fri, 15 Jun 2012 02:48:02 +0000 (19:48 -0700)]
mesa: Add support for glBindBufferBase/Range on GL_UNIFORM_BUFFER.

Fixes piglits:
GL_ARB_uniform_buffer_object/bindbuffer-general-point.
GL_ARB_uniform_buffer_object/negative-bindbuffer-buffer
GL_ARB_uniform_buffer_object/negative-bindbuffer-index
GL_ARB_uniform_buffer_object/negative-bindbuffer-target
GL_ARB_uniform_buffer_object/negative-bindbufferrange-range

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agomesa: Move glBindBufferBase and glBindBufferRange() to bufferobj.
Eric Anholt [Thu, 14 Jun 2012 23:55:56 +0000 (16:55 -0700)]
mesa: Move glBindBufferBase and glBindBufferRange() to bufferobj.

The rest of the TFB implementation remains in transformfeedback.c, and
this will be shared with UBOs.

v2: Move the size/offset checks shared with UBOs to common code as
    well. (Kenneth's review)

Reviewed-by: Brian Paul <brianp@vmware.com> (v1)
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agomesa: Move buffer object dispatch setup to bufferobj.c.
Eric Anholt [Thu, 14 Jun 2012 23:47:39 +0000 (16:47 -0700)]
mesa: Move buffer object dispatch setup to bufferobj.c.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agomesa: Add indexed binding points for uniform buffer objects.
Eric Anholt [Thu, 14 Jun 2012 23:37:22 +0000 (16:37 -0700)]
mesa: Add indexed binding points for uniform buffer objects.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agomesa: Add support for the GL_UNIFORM_BUFFER general binding point.
Eric Anholt [Mon, 18 Jun 2012 18:17:04 +0000 (11:17 -0700)]
mesa: Add support for the GL_UNIFORM_BUFFER general binding point.

Fixes piglit ARB_uniform_buffer_object/buffer-targets.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agomesa: Add state and getters for the GL_ARB_uniform_buffer_object maximums.
Eric Anholt [Thu, 14 Jun 2012 16:55:26 +0000 (09:55 -0700)]
mesa: Add state and getters for the GL_ARB_uniform_buffer_object maximums.

Fixes piglit GL_ARB_uniform_buffer_object/minmax.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoglapi: Add uniform buffer object API
Vincent Lejeune [Sun, 25 Dec 2011 18:17:01 +0000 (19:17 +0100)]
glapi: Add uniform buffer object API

v2: Fix a typo spotted by Eric Anholt.
v3: Fix missing "GL" on types, fix style, fix Studly_Caps extension name,
    drop commented code duplicated with GL3x.xml [anholt]

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agodricore: Turn it into a normal library.
Eric Anholt [Tue, 12 Jun 2012 20:37:58 +0000 (13:37 -0700)]
dricore: Turn it into a normal library.

Our intention is still that it's not abi stable, so make the package
version number get included in the library name.  Now you can parallel
install dricore-using drivers from multiple mesa versions.  We can put
it into lib now that we're following library versioning rules
(assuming that ABIs don't change within a single Mesa point release).

LD_LIBRARY_PATH still doesn't work with a non-/, non-/usr prefix
because libtool uses rpath instead of runpath for nonstandard
prefixes.

12 years agoautomake: Convert Mesa built sources generation to automake.
Eric Anholt [Tue, 12 Jun 2012 20:10:08 +0000 (13:10 -0700)]
automake: Convert Mesa built sources generation to automake.

12 years agomesa: Move GL header installation to automake.
Eric Anholt [Tue, 12 Jun 2012 19:51:32 +0000 (12:51 -0700)]
mesa: Move GL header installation to automake.

This cuts some cruft related to osmesa where we were being careful to
not install headers twice.

12 years agoautomake: Move mesa subdirs processing to automake.
Eric Anholt [Tue, 12 Jun 2012 19:29:44 +0000 (12:29 -0700)]
automake: Move mesa subdirs processing to automake.

12 years agoautomake: Move .pc installation to automake.
Eric Anholt [Tue, 12 Jun 2012 19:13:32 +0000 (12:13 -0700)]
automake: Move .pc installation to automake.

12 years agoautomake: Move the master Mesa makefile to Makefile.old.
Eric Anholt [Tue, 12 Jun 2012 19:10:58 +0000 (12:10 -0700)]
automake: Move the master Mesa makefile to Makefile.old.

This will let me incrementally move stuff to automake without
converting libmesa.a all at once.

12 years agoautomake: Convert osmesa.pc to be generated by configure.
Eric Anholt [Tue, 15 May 2012 19:47:58 +0000 (12:47 -0700)]
automake: Convert osmesa.pc to be generated by configure.

12 years agomesa: Convert gl.pc to be generated by configure.
Eric Anholt [Tue, 15 May 2012 19:23:00 +0000 (12:23 -0700)]
mesa: Convert gl.pc to be generated by configure.

This saves a step of mashing variables around in our Makefile.

12 years agoautomake: Convert src/mesa/drivers/x11/Makefile to automake.
Eric Anholt [Tue, 12 Jun 2012 18:38:19 +0000 (11:38 -0700)]
automake: Convert src/mesa/drivers/x11/Makefile to automake.

The weird versioning of the libGL where the package version was sort
of expressed as a big integer is dropped.  libtool didn't like the 0
prefix, and it didn't really make sense anyway -- if you interpret it
as an integer version number, old Mesa 071200 was bigger than current
Mesa 08100.  Instead, just bump the minor version and drop the
patchlevel.

12 years agoautomake: Convert src/gallium/Makefile to automake.
Eric Anholt [Mon, 11 Jun 2012 20:07:03 +0000 (13:07 -0700)]
automake: Convert src/gallium/Makefile to automake.

12 years agoautomake: Convert src/mapi/glapi/gen to silent build.
Eric Anholt [Mon, 11 Jun 2012 20:04:56 +0000 (13:04 -0700)]
automake: Convert src/mapi/glapi/gen to silent build.

12 years agoautomake: Convert src/mapi/glapi/gen/Makefile to automake.
Eric Anholt [Mon, 11 Jun 2012 19:59:21 +0000 (12:59 -0700)]
automake: Convert src/mapi/glapi/gen/Makefile to automake.

12 years agoautomake: Convert src/mesa/drivers/Makefile to automake.
Eric Anholt [Mon, 11 Jun 2012 17:53:09 +0000 (10:53 -0700)]
automake: Convert src/mesa/drivers/Makefile to automake.

12 years agoautomake: Directly generate configs/current instead of symlinking from it.
Eric Anholt [Mon, 11 Jun 2012 17:49:38 +0000 (10:49 -0700)]
automake: Directly generate configs/current instead of symlinking from it.

12 years agoautomake: Convert gen_matypes building to automake.
Eric Anholt [Mon, 11 Jun 2012 17:19:36 +0000 (10:19 -0700)]
automake: Convert gen_matypes building to automake.

12 years agomake: Drop HOST_CC and HOST_CFLAGS.
Eric Anholt [Mon, 11 Jun 2012 16:46:02 +0000 (09:46 -0700)]
make: Drop HOST_CC and HOST_CFLAGS.

Except for the deleted linux-cell target, these were just the target
cc/cflags.  The only usage was for gen_matypes, which wants the
target's structure packing, not the host, anyway.

12 years agomake: Fold ASM_CFLAGS into DEFINES.
Eric Anholt [Mon, 11 Jun 2012 17:25:05 +0000 (10:25 -0700)]
make: Fold ASM_CFLAGS into DEFINES.

Every place that uses ASM_FLAGS already uses DEFINES.  Not including
it in DEFINES is just a way to screw up potential users, as I've done
several times while working on the build system.

12 years agoautomake: Convert src/egl/Makefile to automake.
Eric Anholt [Mon, 11 Jun 2012 16:34:22 +0000 (09:34 -0700)]
automake: Convert src/egl/Makefile to automake.

12 years agoautomake: Don't warn on gmake portability issues.
Eric Anholt [Mon, 11 Jun 2012 19:59:48 +0000 (12:59 -0700)]
automake: Don't warn on gmake portability issues.

Even pre-automake, we rely on gmake features for pattern
substitutions, and replacing those with reams more make code is not
interesting.  This will let us turn the old Makefiles using pattern
substitutions into automake without spewing warnings.

Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
12 years agonv50: fix buffer reuse issues
Marcin Slusarz [Tue, 19 Jun 2012 21:38:34 +0000 (23:38 +0200)]
nv50: fix buffer reuse issues

1) We need to insert a barrier between consecutive transform feedback calls.
2) VBO cache needs to be flushed when TFB output is used as VBO draw input.

Fixes Piglit test EXT_transform_feedback/immediate-reuse.

Thanks to Christoph Bumiller for pointing out bugs in previous versions
of this patch.

12 years agost/mesa: fix transform feedback of unsubscripted gl_ClipDistance array
Marcin Slusarz [Sat, 16 Jun 2012 18:30:14 +0000 (20:30 +0200)]
st/mesa: fix transform feedback of unsubscripted gl_ClipDistance array

gl_ClipDistance needs special treatment in form of lowering pass
which transforms gl_ClipDistance representation from float[] to
vec4[]. There are 2 implementations - at glsl linker level (enabled
by LowerClipDistance option) and at glsl_to_tgsi level (enabled
unconditionally for gallium drivers). Second implementation is
incomplete - it does not take into account transform feedback (see
commit 642e5b413e0890b2070ba78fde42db381eaf02e5 "mesa: Fix transform
feedback of unsubscripted gl_ClipDistance array" for details).

There are 2 possible fixes:
- adding transform feedback support into glsl_to_tgsi version
- ripping gl_ClipDistance support from glsl_to_tgsi and enabling
  gl_ClipDistance lowering on glsl linker side

This patch implements 2nd option. All it does is:
- reverts most of the commit 59be691638200797583bce39a83f641d30d97492
  "st/mesa: add support for gl_ClipDistance"
- changes LowerClipDistance to true

Fixes Piglit tests "EXT_transform_feedback/builtin-varyings
gl_ClipDistance[{2,3,4,5,6,7,8}]-no-subscript" at least on nv50
and evergreen cards.

12 years agoglx/tests: Fix signed/unsigned comparison warnings.
Paul Berry [Wed, 20 Jun 2012 18:38:22 +0000 (11:38 -0700)]
glx/tests: Fix signed/unsigned comparison warnings.

12 years agoi965/msaa: Only do multisample rasterization if GL_MULTISAMPLE enabled.
Paul Berry [Sat, 16 Jun 2012 18:32:04 +0000 (11:32 -0700)]
i965/msaa: Only do multisample rasterization if GL_MULTISAMPLE enabled.

From the GL 3.0 spec (p.116):

    "Multisample rasterization is enabled or disabled by calling
    Enable or Disable with the symbolic constant MULTISAMPLE."

Elsewhere in the spec, where multisample rasterization is described
(sections 3.4.3, 3.5.4, and 3.6.6), the following text is consistently
used:

    "If MULTISAMPLE is enabled, and the value of SAMPLE_BUFFERS is
    one, then..."

So, in other words, disabling GL_MULTISAMPLE should prevent
multisample rasterization from occurring, even if the draw framebuffer
is multisampled.  This patch implements that behaviour by setting the
WM and SF stage's "multisample rasterization mode" to
MSRAST_ON_PATTERN only when the draw framebuffer is multisampled *and*
GL_MULTISAMPLE is enabled.

Fixes piglit test spec/EXT_framebuffer_multisample/enable-flag.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoi965/msaa: Disable unsupported formats.
Paul Berry [Fri, 15 Jun 2012 17:49:58 +0000 (10:49 -0700)]
i965/msaa: Disable unsupported formats.

Due to hardware limitations, MSAA is unsupported on Gen6 for formats
containing >64 bits of data per pixel.  From the Sandy Bridge PRM,
vol4 part1, p72 ("Surface Format"):

    If Number of Multisamples is set to a value other than
    MULTISAMPLECOUNT_1, this field cannot be set to the following
    formats:
    - any format with greater than 64 bits per element
    - any compressed texture format (BC*)
    - any YCRCB* format

Gen7 has a similar, but less stringent limitation: formats with >64
bits of data per pixel only support 4x MSAA.

This patch causes the unsupported formats to report
GL_FRAMEBUFFER_UNSUPPORTED.

Fixes piglit "multisample-formats" tests on Gen6.

Acked-by: Kenneth Graunke <kenneth@whitecape.org>