platform/upstream/mesa.git
11 years agogles: Update glext.h to revision 20798. 64/7664/1
Matt Turner [Fri, 26 Jul 2013 23:33:08 +0000 (16:33 -0700)]
gles: Update glext.h to revision 20798.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
11 years agogallivm: (trivial) git rid of assertion in float->uint conversion code 63/7663/1
Roland Scheidegger [Mon, 29 Jul 2013 11:23:56 +0000 (13:23 +0200)]
gallivm: (trivial) git rid of assertion in float->uint conversion code

Commit 8c3d3622d9ce2fd2a8f46084ab8153d708fa5b09 introduced a new assertion,
but since it causes lp_test_conv failures remove it again and let's hope
we don't really hit bugs caused by the potentially bogus code (it is possible
the assert() caught some cases which work correctly too).

11 years agonvc0: force use of correct firmware file 62/7662/1
Maarten Lankhorst [Sun, 28 Jul 2013 10:06:57 +0000 (12:06 +0200)]
nvc0: force use of correct firmware file

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
11 years agoglsl: Less const for glsl_type convenience accessors 61/7661/1
Ian Romanick [Fri, 26 Jul 2013 20:37:29 +0000 (13:37 -0700)]
glsl: Less const for glsl_type convenience accessors

The second 'const' says that the pointer itself is constant.  This in
unenforcible in C++, so GCC emits a warning (see) below for each of
these functions in every file that includes glsl_types.h.  It's a lot of
warning spam.

../../../src/glsl/glsl_types.h:176:58: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: mesa-stable@lists.freedesktop.org
11 years agoglsl: Disallow auxiliary storage qualifiers on FS outputs. 60/7660/1
Kenneth Graunke [Sat, 27 Jul 2013 04:18:56 +0000 (21:18 -0700)]
glsl: Disallow auxiliary storage qualifiers on FS outputs.

This has always been an error; we just forgot to check for it.

Fixes Piglit's no-aux-qual-on-fs-output.frag.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67333
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Cc: mesa-stable@lists.freedesktop.org
11 years agoglsl: Classify "layout" like other identifiers. 59/7659/1
Kenneth Graunke [Fri, 26 Jul 2013 19:31:06 +0000 (12:31 -0700)]
glsl: Classify "layout" like other identifiers.

When "layout" isn't being lexed as LAYOUT_TOK, we should treat it like
an ordinary identifier.  This means we need to classify it to determine
whether we should return IDENTIFIER, TYPE_IDENTIFIER, or NEW_IDENTIFIER.

Fixes the WebGL conformance test "shader-with-non-reserved-words."

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=64087
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Cc: mesa-stable@lists.freedesktop.org
11 years agoglsl: Be consistent about '\n', '.', and capitalization in errors/warnings. 58/7658/1
Paul Berry [Fri, 26 Jul 2013 02:56:43 +0000 (19:56 -0700)]
glsl: Be consistent about '\n', '.', and capitalization in errors/warnings.

The majority of calls to _mesa_glsl_error(), _mesa_glsl_warning(), and
_mesa_glsl_parse_state::check_version() use a message that begins with
a lower case letter and ends without a period.  This patch makes all
messages follow that convention.

Also, error/warning messages shouldn't end in '\n', since
_mesa_glsl_msg() automatically adds '\n' at the end of the message.

Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agogallivm: fix float->SNORM conversion 57/7657/1
Roland Scheidegger [Sat, 27 Jul 2013 01:53:00 +0000 (03:53 +0200)]
gallivm: fix float->SNORM conversion

Just like the UNORM case we need to use round to nearest, not trunc.
(There's also another problem, we're using the formula for SNORM->float
which will produce a value below -1.0 for the most negative value which
according to both OpenGL and d3d10 would need clamping. However, no actual
failures have been observed due to that hence keep cheating on that.)

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agoutil: don't flush overflowing values to infinity in half-float conversion 56/7656/1
Roland Scheidegger [Sat, 27 Jul 2013 01:45:30 +0000 (03:45 +0200)]
util: don't flush overflowing values to infinity in half-float conversion

I am not able to find _any_ rounding behavior specified for OpenGL for
float to half-float conversions. However, it is specified for fp11/fp10
which suggests round to next finite value but round-to-zero would also
be allowed, but finite values must not be flushed to infinity in either
case.
Hence I believe it makes sense to do the same for half-floats too.
We could probably also use round-to-zero consistently, which is in fact
required by d3d10 (but it doesn't seem to matter much).
Does not match the mesa core function doing the same though (which is
saying it was built to match intel gpus which I don't believe for a
second as it would cause failures in d3d10, moreover the PRM (for
ivy bridge, not listed in older manuals) while not specifying rounding
behavior clearly states finite numbers are never flushed to infinity).

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agotgsi: handle texel swizzles correctly for d3d10-style sample opcodes 55/7655/1
Roland Scheidegger [Fri, 26 Jul 2013 19:39:27 +0000 (21:39 +0200)]
tgsi: handle texel swizzles correctly for d3d10-style sample opcodes

Same as for gallivm (though these don't quite work correctly in softpipe,
so untested).

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agogallivm: handle texel swizzles correctly for d3d10-style sample opcodes 54/7654/1
Roland Scheidegger [Sat, 27 Jul 2013 14:36:25 +0000 (16:36 +0200)]
gallivm: handle texel swizzles correctly for d3d10-style sample opcodes

unlike OpenGL, the texel swizzle is embedded in the instruction, so honor
that.
(Technically we now execute both the sampler_view swizzle and the
per-instruction swizzle but this should be quite ok.)

v2: add documentation note as it's not obvious.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agodocs: Mark ARB_vertex_attrib_binding as started. 53/7653/1
Kenneth Graunke [Sat, 27 Jul 2013 06:46:55 +0000 (23:46 -0700)]
docs: Mark ARB_vertex_attrib_binding as started.

Fredrik Höglund has a partial implementation in his git tree.

11 years agomesa: Disable GL_EXT_framebuffer_object in core profiles and OpenGL 3.1 52/7652/1
Ian Romanick [Thu, 18 Jul 2013 23:48:49 +0000 (16:48 -0700)]
mesa: Disable GL_EXT_framebuffer_object in core profiles and OpenGL 3.1

GL_EXT_framebuffer_object differs from GL_ARB_framebuffer_object in ways
that we can't and don't implement in core profiles.  Exposing it is a
lie, so we shouldn't do that.

It's possible the some other GL_EXT_framebuffer_* extensions should be
disabled, but it's not quite so clear cut.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agodocs: Mark GL_ARB_shading_language_420pack as done. 51/7651/1
Matt Turner [Sat, 27 Jul 2013 05:17:02 +0000 (22:17 -0700)]
docs: Mark GL_ARB_shading_language_420pack as done.

11 years agodocs: Mark off 420pack 50/7650/1
Chris Forbes [Sat, 27 Jul 2013 09:29:01 +0000 (21:29 +1200)]
docs: Mark off 420pack

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
11 years agoglsl: disable ARB_texture_cube_map_array_enable keywords for glsl es 49/7649/1
Tapani Pälli [Fri, 26 Jul 2013 07:21:56 +0000 (10:21 +0300)]
glsl: disable ARB_texture_cube_map_array_enable keywords for glsl es

Patch fixes a crash with Webgl 'shader-with-non-reserved-words'
conformance test by ignoring desktop extension keywords on GLSL ES.

v2: fix reserved and allowed desktop glsl versions (Chris)

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=64087
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965/vs: Fix flaky texture swizzling 48/7648/1
Chris Forbes [Tue, 23 Jul 2013 19:21:22 +0000 (07:21 +1200)]
i965/vs: Fix flaky texture swizzling

If any component used the ZERO or ONE swizzle, its corresponding member
in the `swizzle` array would never be initialized. We *mostly* got away
with this, except when that memory happened to contain a value that
clobbered another channel when combined using BRW_SWIZZLE4().

NOTE: This is a candidate for stable branches.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agost/clover: Allow double precision operations 47/7647/1
Niels Ole Salscheider [Tue, 2 Jul 2013 08:44:37 +0000 (10:44 +0200)]
st/clover: Allow double precision operations

Pass "cl_khr_fp64" preprocessor definition to clang

Signed-off-by: Niels Ole Salscheider <niels_ole@salscheider-online.de>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
11 years agogallium/vl: add prime support 46/7646/1
Dave Airlie [Thu, 25 Jul 2013 03:31:26 +0000 (13:31 +1000)]
gallium/vl: add prime support

This fixes the dri2 opening to check if DRI_PRIME is set,
and picks the correct drm device path to open, this along
with a change to libvdpau allows vdpauinfo to work at least,

Martin Peres tested with nouveau, and there seems to be a
further issue with final displaying, it only works sometimes,
but this patch is at least necessary to help debug further.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Christian König <christian.koenig@amd.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67283
Tested-by: Armin K. <krejzi@email.com>
11 years agoRevert "i965: Delete pre-DRI2.3 viewport hacks." 45/7645/1
Kenneth Graunke [Thu, 25 Jul 2013 22:11:13 +0000 (15:11 -0700)]
Revert "i965: Delete pre-DRI2.3 viewport hacks."

This reverts commit c9db037dc999eadbcaa8816c814e6ec1776d1a40.

Eric believes that the viewport hacks are still necessary for EGL;
invalidate events aren't hooked up properly.

This commit caused a regression where EFL applications wouldn't show
anything other than window decorations; GLBenchmark also showed issues.

The revert had conflicts due to the intel_context/brw_context merge.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=66606
Cc: mesa-stable@lists.freedesktop.org
11 years agomesa: Bump version to 9.3.0-devel. 44/7644/1
Kenneth Graunke [Thu, 25 Jul 2013 20:33:02 +0000 (13:33 -0700)]
mesa: Bump version to 9.3.0-devel.

This should have been done when making the 9.2 branch, but was missed.

11 years agodocs: Remove <em> obfuscation on public mailing list addresses. 43/7643/1
Kenneth Graunke [Thu, 25 Jul 2013 18:42:38 +0000 (11:42 -0700)]
docs: Remove <em> obfuscation on public mailing list addresses.

Wrapping every character of an email address in <em> looks bizarre, and
makes it impossible to read the text.  Apparently Brian did this in 2003
to try and obfuscate email addresses and avoid spam.

Of course, mesa-*@lists.freedesktop.org are public mailing lists and
trivial to find on the internet.  So obfuscation buys us nothing
(assuming the <em> technique even works at all, which I doubt).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
LOLed-at-by: Matt Turner :)
11 years agoxa: bump major version 42/7642/1
Rob Clark [Wed, 5 Jun 2013 20:16:27 +0000 (16:16 -0400)]
xa: bump major version

Bump major version, as the change to require explicit
xa_context_flush(), the addition of the handle-type parameter to
xa_surface_handle(), and change of surface to ref/unref will require a
minor change in DDX.

11 years agoxa: move surface to ref/unref api 41/7641/1
Jerome Glisse [Thu, 7 Mar 2013 22:03:04 +0000 (17:03 -0500)]
xa: move surface to ref/unref api

This make ddx life easier.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Rob Clark <robclark@freedesktop.org>
11 years agoxa: let ddx handle flush 40/7640/1
Jerome Glisse [Wed, 6 Mar 2013 22:39:29 +0000 (17:39 -0500)]
xa: let ddx handle flush

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
11 years agoxa: export a common context flush function 39/7639/1
Jerome Glisse [Mon, 4 Mar 2013 17:26:18 +0000 (12:26 -0500)]
xa: export a common context flush function

First step before moving flushing inside the ddx.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
11 years agoxa: add handle type parameter to get handle 38/7638/1
Jerome Glisse [Wed, 27 Feb 2013 15:49:35 +0000 (10:49 -0500)]
xa: add handle type parameter to get handle

Allow to retrieve non shared handle.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
11 years agoxa: add xa_surface_from_handle() 37/7637/1
Rob Clark [Sun, 12 May 2013 20:00:35 +0000 (16:00 -0400)]
xa: add xa_surface_from_handle()

For freedreno DDX, we have to create the scanout GEM bo in a special way
(until we have our own KMS/DRM kernel driver.. and even then for
phones/tablets you probably need to use the android drivers if you don't
want to port the lcd panel driver support).  The easiest way to handle
this is let the DDX create the scanout bo, and then create the xa
surface from that.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
11 years agogallivm: Remove NoFramePointerElimNonLeaf for LLVM >= 3.4. 36/7636/1
Vinson Lee [Thu, 25 Jul 2013 06:28:27 +0000 (23:28 -0700)]
gallivm: Remove NoFramePointerElimNonLeaf for LLVM >= 3.4.

TargetOptions::NoFramePointerElimNonLeaf was removed in LLVM 3.4
r187093.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
11 years agoglsl: Handle empty if statement encountered during loop analysis. 35/7635/1
Paul Berry [Wed, 24 Jul 2013 15:04:44 +0000 (08:04 -0700)]
glsl: Handle empty if statement encountered during loop analysis.

The is_loop_terminator() function was asserting that the following
kind of if statement could never occur:

    if (...) { } else { }

(presumably based on the assumption that such an if statement would be
eliminated by previous optimization stages).  But that isn't the
case--it's possible that previous optimization stages might simplify
more complex code down to this empty if statement, in which case it
won't be eliminated until the next time through the optimization loop.

So is_loop_terminator() needs to handle it.  Fortunately it's easy to
handle--it's not a loop terminator because it does nothing.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=64330
CC: mesa-stable@lists.freedesktop.org
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Initialize inout_offset parameter to brw_search_cache(). 34/7634/1
Paul Berry [Wed, 24 Jul 2013 16:24:51 +0000 (09:24 -0700)]
i965: Initialize inout_offset parameter to brw_search_cache().

Two callers of brw_search_cache() weren't initializing that function's
inout_offset parameter: brw_blorp_const_color_params::get_wm_prog()
and brw_blorp_const_color_params::get_wm_prog().

That's a benign problem, since the only effect of not initializing
inout_offset prior to calling brw_search_cache() is that the bit
corresponding to cache_id in brw->state.dirty.cache may not be set
reliably.  This is ok, since the cache_id's used by
brw_blorp_const_color_params::get_wm_prog() and
brw_blorp_blit_params::get_wm_prog() (BRW_BLORP_CONST_COLOR_PROG and
BRW_BLORP_BLIT_PROG, respectively) correspond to dirty bits that are
not used.

However, failing to initialize this parameter causes valgrind to
complain.  So let's go ahead and fix it to reduce valgrind noise.

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

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: don't rename variables in interface block arrays. 33/7633/1
Paul Berry [Mon, 22 Jul 2013 22:49:48 +0000 (15:49 -0700)]
glsl: don't rename variables in interface block arrays.

The linker matches up variables in interface blocks according to their
block name and variable name.  When support for interface block arrays
was added in commit d6863acb, we renamed variables appearing in
interface blocks so that their name included the array size.  For
example, in a block like this:

out foo {
   float bar
} baz[3];

The variable "bar" would get renamed to "bar[3]".

This is unnecessary, and leads to problems in supporting geometry
shaders, since geometry shaders require vertex shader outputs which
are non-arrays to be linked up to geometry shader inputs which are
arrays.

This patch makes the behaviour of interface block arrays the same as
simple non-array interface blocks; in both cases, the variables
contained within them are not renamed.

Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agodraw: fix vertex id computation 32/7632/1
Zack Rusin [Tue, 23 Jul 2013 05:29:30 +0000 (01:29 -0400)]
draw: fix vertex id computation

vertex id has to be unaffected by the start index (i.e. when calling
draw arrays with start_index = 5, the first vertex_id has to still
be 0, not 5) and it has to be equal to the index when performing
indexed rendering (in which case it has to be unaffected by the
index bias). This fixes our behavior.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agodraw: cleanup and fix instance id computation 31/7631/1
Zack Rusin [Tue, 23 Jul 2013 05:16:55 +0000 (01:16 -0400)]
draw: cleanup and fix instance id computation

The instance id system value always starts at 0, even if the
specified start instance is larger than 0. Instead of implicitly
setting instance id to instance id plus start instance and then
having to subtract instance id when computing the buffer offsets
lets just set instance id to the proper instance id. This fixes
instance id computation and cleansup buffer offset computation.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agogallivm: Remove dead code in lp_build_compare_ext. 30/7630/1
Vinson Lee [Sun, 21 Jul 2013 07:04:36 +0000 (00:04 -0700)]
gallivm: Remove dead code in lp_build_compare_ext.

There are earlier returns for PIPE_FUNC_NEVER and PIPE_FUNC_ALWAYS. The
switch value of 'func' cannot be either of those values.

Fixes "Logically dead code" defects reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
11 years agomesa: implement mipmap generation for compressed 2D array textures 29/7629/1
Brian Paul [Tue, 16 Jul 2013 12:04:32 +0000 (06:04 -0600)]
mesa: implement mipmap generation for compressed 2D array textures

We weren't looping over all the slices in the array.  The updated
code should also correctly handle 3D compressed textures too, whenever
we have that feature.

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

NOTE: This is a candidate for the 9.x branches
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: José Fonseca <jfonseca@vmware.com>
11 years agometa: handle 2D texture arrays in decompress_texture_image() 28/7628/1
Brian Paul [Tue, 16 Jul 2013 12:27:33 +0000 (06:27 -0600)]
meta: handle 2D texture arrays in decompress_texture_image()

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

NOTE: This is a candidate for the 9.x branches.
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: José Fonseca <jfonseca@vmware.com>
11 years agomesa: handle 2D texture arrays in get_tex_rgba_compressed() 27/7627/1
Brian Paul [Mon, 15 Jul 2013 16:23:49 +0000 (10:23 -0600)]
mesa: handle 2D texture arrays in get_tex_rgba_compressed()

If we call glGetTexImage() for a compressed 2D texture array we need
to loop over all the slices.

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

NOTE: This is a candidate for the 9.x branches.
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: José Fonseca <jfonseca@vmware.com>
11 years agonv50,nvc0: s/uint16/uint32 for constant buffer offset 26/7626/1
Christoph Bumiller [Wed, 24 Jul 2013 18:41:31 +0000 (20:41 +0200)]
nv50,nvc0: s/uint16/uint32 for constant buffer offset

Looks like a thinko, "Hey, constant buffers can be at most 64 KiB
in size, offset can't be larger." But it can, of course.

I think piglit lacks a test for UBO and BindBufferRange that
tests if it actually works.

11 years agodraw: always call util_cpu_detect() in draw context creation. 25/7625/1
Roland Scheidegger [Tue, 23 Jul 2013 23:38:50 +0000 (01:38 +0200)]
draw: always call util_cpu_detect() in draw context creation.

Since disabling denorms in draw_vbo() we require the util_cpu_caps to be
initialized there. Hence add another util_cpu_detect() call in
draw_create_context() which should ensure this.
(There is another call in draw_get_option_use_llvm() which only gets called
with x86 (not x86_64) but calling it always there wouldn't help since it most
likely wouldn't get called when compiling without llvm, so leave it alone
there.)
This fixes https://bugs.freedesktop.org/show_bug.cgi?id=66806.
(Because util_cpu_caps wasn't initialized when first calling util_fpstate_get()
hence it returning zero, but it would later get initialized by rtasm translate
code hence when draw call returned it unmasked all exceptions by calling
util_fpstate_set(). This was happening only with DRAW_USE_LLVM=0 or not
compiling with llvm, otherwise the llvm init code was calling it on time too.)

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Zack Rusin <zackr@vmware.com>
Tested-by: Vinson Lee <vlee@freedesktop.org>
11 years agomesa: fix rgtc snorm decoding 24/7624/1
Roland Scheidegger [Mon, 22 Jul 2013 19:02:56 +0000 (21:02 +0200)]
mesa: fix rgtc snorm decoding

The codeword must be unsigned (otherwise will shift in 1's from above when
merging low/high parts so some texels decode wrong).
This also affects gallium's util/u_format_rgtc.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Zack Rusin <zackr@vmware.com>
11 years agogallium/util: Fix detection of AVX cpu caps 23/7623/1
Andre Heider [Tue, 23 Jul 2013 17:08:45 +0000 (19:08 +0200)]
gallium/util: Fix detection of AVX cpu caps

For AVX it's not sufficient to only rely on the cpuid flags. If the CPU
supports these extensions, but the OS doesn't, issuing these insns will
trigger an undefined opcode exception.

In addition to the AVX cpuid bit we also need to:
* test cpuid for OSXSAVE support
* XGETBV to check if the OS saves/restores AVX regs on context switches

See "Detecting Availability and Support" at
http://software.intel.com/en-us/articles/introduction-to-intel-advanced-vector-extensions

Signed-off-by: Andre Heider <a.heider@gmail.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
11 years agodocs: Add items for GL4.4 22/7622/1
Chris Forbes [Mon, 22 Jul 2013 21:17:47 +0000 (09:17 +1200)]
docs: Add items for GL4.4

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoclover: Respect kernel argument alignment restrictions. 21/7621/1
Francisco Jerez [Sat, 20 Jul 2013 23:14:54 +0000 (01:14 +0200)]
clover: Respect kernel argument alignment restrictions.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
11 years agoclover: Extend kernel arguments for differing host and device data types. 20/7620/1
Francisco Jerez [Mon, 22 Jul 2013 21:08:46 +0000 (23:08 +0200)]
clover: Extend kernel arguments for differing host and device data types.

Loosely based on a similar patch by Tom Stellard.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
11 years agoclover: Byte-swap kernel arguments when host and device endianness differ. 19/7619/1
Francisco Jerez [Sat, 20 Jul 2013 23:06:13 +0000 (01:06 +0200)]
clover: Byte-swap kernel arguments when host and device endianness differ.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
11 years agoclover: Add kernel argument fields to allow differing host/target data types. 18/7618/1
Francisco Jerez [Sat, 20 Jul 2013 22:49:54 +0000 (00:49 +0200)]
clover: Add kernel argument fields to allow differing host/target data types.

Loosely based on a similar patch by Tom Stellard.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
11 years agoclover: Pass corresponding module::argument to kernel::argument::bind(). 17/7617/1
Francisco Jerez [Sat, 20 Jul 2013 22:43:18 +0000 (00:43 +0200)]
clover: Pass corresponding module::argument to kernel::argument::bind().

And remove size information from most kernel::argument derived
classes, it's no longer going to be necessary.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
11 years agoclover: Return correct value for CL_DEVICE_ENDIAN_LITTLE 16/7616/1
Tom Stellard [Wed, 10 Jul 2013 04:21:40 +0000 (21:21 -0700)]
clover: Return correct value for CL_DEVICE_ENDIAN_LITTLE

Query the driver using PIPE_CAP_ENDIANNESS rather than always returning
true.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
11 years agogallium: Add PIPE_CAP_ENDIANNESS 15/7615/1
Tom Stellard [Wed, 10 Jul 2013 04:21:39 +0000 (21:21 -0700)]
gallium: Add PIPE_CAP_ENDIANNESS

Cc: mesa-stable@lists.freedesktop.org
[ Francisco Jerez: Fix "PIPE_ENDIAN_SMALL" in the documentation,
  define PIPE_ENDIAN_NATIVE. ]

11 years agoconfigure.ac: Use correct options names in AC_ARG_ENABLE. 14/7614/1
Matt Turner [Sun, 10 Mar 2013 01:35:12 +0000 (17:35 -0800)]
configure.ac: Use correct options names in AC_ARG_ENABLE.

11 years agoegl/build: Remove unused GLAPI_LIB. 13/7613/1
Matt Turner [Sun, 10 Mar 2013 01:29:19 +0000 (17:29 -0800)]
egl/build: Remove unused GLAPI_LIB.

11 years agobuild: Remove unused EGL_PLATFORMS. 12/7612/1
Matt Turner [Sun, 10 Mar 2013 01:26:43 +0000 (17:26 -0800)]
build: Remove unused EGL_PLATFORMS.

11 years agobuild: Add tests directories to SUBDIRS 11/7611/1
Matt Turner [Mon, 21 Jan 2013 02:00:14 +0000 (18:00 -0800)]
build: Add tests directories to SUBDIRS

Fixes a problem with distcheck.

11 years agollvmpipe: Ensure FTZ/DAZ flags are set on deferred draw flushes. 10/7610/1
Zack Rusin [Mon, 22 Jul 2013 17:08:48 +0000 (18:08 +0100)]
llvmpipe: Ensure FTZ/DAZ flags are set on deferred draw flushes.

Tested-by: José Fonseca <jfonseca@vmware.com>
11 years agollvmpipe: Remove lp_rast_get_num_threads(). 09/7609/1
José Fonseca [Mon, 22 Jul 2013 17:08:39 +0000 (18:08 +0100)]
llvmpipe: Remove lp_rast_get_num_threads().

Never called.

Trivial.

11 years agoscons: Don't use -z defs ld option on Mac. 08/7608/1
José Fonseca [Sun, 21 Jul 2013 08:55:04 +0000 (09:55 +0100)]
scons: Don't use -z defs ld option on Mac.

Should fix fdo bug 67098.

11 years agoglsl: Initialize ast_function member variables. 07/7607/1
Vinson Lee [Sun, 10 Feb 2013 00:38:53 +0000 (01:38 +0100)]
glsl: Initialize ast_function member variables.

Fixes "Uninitialized pointer field" defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
11 years agoApple: glFlush() is not needed with CGLFlushDrawable() 06/7606/1
Jeremy Huddleston Sequoia [Sat, 20 Jul 2013 17:25:28 +0000 (10:25 -0700)]
Apple: glFlush() is not needed with CGLFlushDrawable()

<rdar://problem/14496373>

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
11 years agoutil/u_math: Define NAN/INFINITY macros for MSVC. 05/7605/1
José Fonseca [Fri, 19 Jul 2013 23:31:18 +0000 (00:31 +0100)]
util/u_math: Define NAN/INFINITY macros for MSVC.

Untested. But should hopefully fix the build.

11 years agollvmpipe/tests: update arith test to check for edge cases 04/7604/1
Zack Rusin [Thu, 18 Jul 2013 07:33:22 +0000 (03:33 -0400)]
llvmpipe/tests: update arith test to check for edge cases

Test infs, zeros and nans with our arith functions to assure
correct/defined behavior with those values.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agogallivm: add a log function that handles edge cases 03/7603/1
Zack Rusin [Thu, 18 Jul 2013 07:32:02 +0000 (03:32 -0400)]
gallivm: add a log function that handles edge cases

Same as log2_safe, which means that it can handle infs, 0s and
nans.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agogallivm: export unordered/ordered cmp to a common function 02/7602/1
Zack Rusin [Thu, 18 Jul 2013 07:05:01 +0000 (03:05 -0400)]
gallivm: export unordered/ordered cmp to a common function

Only the floating point operarators change everything else
is the same so it makes sense to share the code.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agogallivm: handle -inf, inf and nan's in sin/cos instructions 01/7601/1
Zack Rusin [Wed, 17 Jul 2013 20:55:52 +0000 (16:55 -0400)]
gallivm: handle -inf, inf and nan's in sin/cos instructions

sin/cos for anything not finite is nan and everything else has
to be between [-1, 1].

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agogallivm: add a version of log2 which handles edge cases 00/7600/1
Zack Rusin [Tue, 16 Jul 2013 19:57:11 +0000 (15:57 -0400)]
gallivm: add a version of log2 which handles edge cases

That means that if input is:
 * - less than zero (to and including -inf) then NaN will be returned
 * - equal to zero (-denorm, -0, +0 or +denorm), then -inf will be returned
 * - +infinity, then +infinity will be returned
 * - NaN, then NaN will be returned
It's a separate function because the checks are a little bit costly
and in most cases are likely unnecessary.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agogallivm: fix edge cases in exp2 99/7599/1
Zack Rusin [Thu, 18 Jul 2013 06:38:54 +0000 (02:38 -0400)]
gallivm: fix edge cases in exp2

exp(0) has to be exactly 1, exp(-inf) has to be 0, exp(inf) has
to be inf and exp(nan) has to be nan, this fixes all of those
cases.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agogallivm: handle nan's in min/max 98/7598/1
Zack Rusin [Tue, 16 Jul 2013 17:06:24 +0000 (13:06 -0400)]
gallivm: handle nan's in min/max

Both D3D10 and OpenCL say that if one the inputs is nan then
the other should be returned. To preserve that behavior
the patch fixes both the sse and the non-sse paths in both
functions and adds helper code for handling nans.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agoscons: Disallow undefined symbols in Xlib libGL.so. 97/7597/1
José Fonseca [Fri, 19 Jul 2013 12:08:07 +0000 (13:08 +0100)]
scons: Disallow undefined symbols in Xlib libGL.so.

It's not the first time that, due to missing build dependencies or
incomplete commits, we end up with a broken libGL.so that's missing
symbols, causing all tests to fail catastrophically.

Instead try to catch this sort of issues earlier.

11 years agomesa: Dispatch ARB_framebuffer_object and EXT_framebuffer_object differently 96/7596/1
Tomasz Lis [Tue, 16 Jul 2013 18:57:26 +0000 (20:57 +0200)]
mesa: Dispatch ARB_framebuffer_object and EXT_framebuffer_object differently

Almost all of the functions between the ARB and the EXT share the same
GLX protocol because the functionality is, essentially, identical.
However, there are some differences between the extensions:

- In the ARB extension, names must come from glGenBuffers.

- In the ARB extension, framebuffer objects are not shared (but they are
  in the EXT).

For these reasons, glBindFramebuffer and glBindRenderbuffer have
different GLX protocol opcodes than their EXT counterparts.  Currently
these functions alias each other in the dispatch table.  This makes it
impossible to be truly spec conformant.

This patch enables fixing the conformance issue by splitting
glBindFramebuffer / glBindFramebufferEXT and glBindRenderbuffer /
glBindRenderbufferEXT into separate dispatch table entries.

Patches will be available shortly to:

- Fix the conformance issue.

- Stop advertising the EXT in OpenGL 3.1 (or core profiles).

HOWEVER, this does represent a compatibility break between the loader
(libGL or the Xserver GLX module) and the driver.  Mesa drivers compiled
without this change will request a single dispatch table entry for
glBindFramebuffer and glBindFramebufferEXT.  Since the updated loader
has different entries for each, the request will fail, and the driver
will die in a fire.

Drivers built with the change should continue to load fine on loaders
without the change.  In this case, the driver will separately ask for
entries for glBindFramebuffer and glBindFramebufferEXT, and the loader
will tell it the same location.  Since the loader in the server's GLX
module is not (yet) updated, this should not be a problem.  We also do
not advertise the ARB extension from the server, so, again, this should
not be a problem for the server.

HOWEVER, this means that DRI1 drivers (remember mga_dri.so?) will no
longer load with libGL build hereafter.  That means this patch will need
to be back ported to the 8.0 branch.

v2 (idr): Added missing GLX protocol opcodes for the EXT functions and
corrected the opcodes for the ARB functions.  Updated GLX indirect_api
unit test and dispatch sanity unit test.

Signed-off-by: Tomasz Lis <tomasz.lis@intel.com>
Signed-off-by: Bartosz Zawistowski <bartosz.l.zawistowski@intel.com>
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> [v1]
11 years agost/mesa: Enable the ARB_shading_language_420pack extension for 1.30+. 95/7595/1
Kenneth Graunke [Thu, 18 Jul 2013 18:49:44 +0000 (11:49 -0700)]
st/mesa: Enable the ARB_shading_language_420pack extension for 1.30+.

Any driver that supports GLSL 1.30 should be able to handle this
extension, as it's entirely implemented in the GLSL compiler.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
11 years agoi965: Enable the GL_ARB_shading_language_420pack extension on Gen6+. 94/7594/1
Kenneth Graunke [Thu, 18 Jul 2013 01:18:00 +0000 (18:18 -0700)]
i965: Enable the GL_ARB_shading_language_420pack extension on Gen6+.

While all the work is in the shared GLSL compiler, this extension
requires GLSL 1.30, which is currently only supported on Gen6+.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoglsl: Handle the binding qualifier for UBO variables. 93/7593/1
Kenneth Graunke [Thu, 18 Jul 2013 01:11:55 +0000 (18:11 -0700)]
glsl: Handle the binding qualifier for UBO variables.

layout(binding = N) is equivalent to calling glUniformBlockBinding(_,N).

This currently only handles the GLSL 1.40 case - no interface names, no
arrays of uniform blocks.  This is okay since we don't yet support GLSL
1.50, and don't expose ARB_shading_language_420pack in ES 3.0.

v2: Move into the other function; use binding, not constant_value.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
11 years agoglsl: Propagate UBO binding qualifier into UBO member variables. 92/7592/1
Kenneth Graunke [Thu, 18 Jul 2013 01:06:57 +0000 (18:06 -0700)]
glsl: Propagate UBO binding qualifier into UBO member variables.

Without an instance name, there is no ir_variable representing the
actual uniform block declaration.  When the linker goes to set uniform
initializers, it only sees the members as ir_variables; never the block.

So, unfortunately, the members need to know about the binding.

There has to be a better way to do this.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoglsl: Handle the binding qualifier for arrays of samplers. 91/7591/1
Kenneth Graunke [Wed, 17 Jul 2013 18:24:11 +0000 (11:24 -0700)]
glsl: Handle the binding qualifier for arrays of samplers.

Normally, uniform array variables are initialized by array literals.
That is, val->type->array_elements >= storage->array_elements.

However, samplers are different.  Consider a declaration such as:

   layout(binding = 5) uniform sampler2D[3];

The initializer value is a single integer (5), while the storage has 3
array elements.  The proper behavior here is to increment one for each
element; they should be initialized to 5, 6, and 7.

This patch introduces new code for sampler types which handles both
arrays of samplers and single samplers correctly.

v2: Move into the other function; use binding, not constant_value.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
11 years agoglsl: Add plumbing for handling uniform binding qualifiers. 90/7590/1
Kenneth Graunke [Thu, 18 Jul 2013 21:28:05 +0000 (14:28 -0700)]
glsl: Add plumbing for handling uniform binding qualifiers.

Sampler uniforms and uniform blocks do not have a var->constant_value.
Instead, they have an integer var->binding value.

This makes extending set_uniform_initializer() somewhat problematic: it
assumes that there is an ir_constant * which represents the initializer,
and that it's safe to dereference that without any NULL checks.

Instead, this patch creates an analogous function for binding
qualifiers, and calls one or the other as appropriate.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoglsl: Delete unused code for handling samplers in array-initializers. 89/7589/1
Kenneth Graunke [Wed, 17 Jul 2013 18:45:57 +0000 (11:45 -0700)]
glsl: Delete unused code for handling samplers in array-initializers.

There is existing code to handle sampler uniform initializers.  Prior to
GLSL 4.20's "binding" keyword, sampler uniforms don't have initializers
at all, so this is somewhat surprising.

The existing code is broken into two cases: one where both the variable and
initializer are arrays, and a second where the variable and initializer are
scalars.

The first case should never occur, since array-typed initializers do not
exist for sampler uniforms.  Even with the binding keyword, the
initializer is a single integer which represents the texture unit to use
for the first array element.

The second is apparently used for some fixed-function code.

v2: Rewrite the commit message - suggested by Paul.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoglsl: Cross-validate explicit binding points. 88/7588/1
Kenneth Graunke [Tue, 16 Jul 2013 19:18:57 +0000 (12:18 -0700)]
glsl: Cross-validate explicit binding points.

All compilation units need to agree on the binding point, if they
specify one at all.

v2: Use binding, not constant_value.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoglsl: Propagate explicit binding information from AST to IR. 87/7587/1
Kenneth Graunke [Thu, 18 Jul 2013 22:11:57 +0000 (15:11 -0700)]
glsl: Propagate explicit binding information from AST to IR.

Rather than creating a new "binding" field in ir_variable, we reuse
constant_value since the linker code for handling uniform initializers
uses that.

Since UBOs and samplers can't otherwise have initializers/constant
values, there shouldn't be a conflict.

v2: Propagate the new binding variable around too.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoglsl: Add ir_variable fields for explicit bindings. 86/7586/1
Kenneth Graunke [Thu, 18 Jul 2013 22:10:49 +0000 (15:10 -0700)]
glsl: Add ir_variable fields for explicit bindings.

These are not used yet, but they exist and are copied appropriately.

v2: Add an explicit "int binding" variable rather than reusing
    constant_value, as suggested by Paul Berry.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoglsl: Add validation for the "binding" qualifier. 85/7585/1
Kenneth Graunke [Tue, 16 Jul 2013 19:03:28 +0000 (12:03 -0700)]
glsl: Add validation for the "binding" qualifier.

The "binding" qualifier only applies to UBO blocks and samplers, along
with arrays of those types.  (It would also apply to images and atomic
counters, but we don't support those yet.)

This also validates sampler bindings against the maximum number of
texture units, and UBO bindings against the number of uniform buffer
binding points.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoglsl: Parse the "binding" keyword and store it in ast_type_qualifier. 84/7584/1
Kenneth Graunke [Tue, 16 Jul 2013 05:20:03 +0000 (22:20 -0700)]
glsl: Parse the "binding" keyword and store it in ast_type_qualifier.

Nothing actually uses this yet.

v2: Remove >= 0 checks.  They'll be handled in later validation.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoglsl: Have the lexer return LAYOUT_TOK if 420pack is enabled. 83/7583/1
Kenneth Graunke [Wed, 17 Jul 2013 17:39:59 +0000 (10:39 -0700)]
glsl: Have the lexer return LAYOUT_TOK if 420pack is enabled.

GL_ARB_shading_language_420pack also provides layout qualifiers.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoglsl: Use has_layout() rather than a partial open coded version. 82/7582/1
Kenneth Graunke [Tue, 16 Jul 2013 18:39:01 +0000 (11:39 -0700)]
glsl: Use has_layout() rather than a partial open coded version.

The idea of this code is to disallow layout(...) sections with the
deprecated "varying" or "attribute" keywords, unless a few select
extensions are enabled which allow a more relaxed check.

In order to detect a layout(...) section, the code checks for a number
of layout qualifiers.  However, it failed to check for all of them,
which could lead to layout(...) not being detected when it should.

By replacing this with has_layout(), we properly check for all layout
qualifiers, and also guarantees that new qualifiers added in the future
will not be forgotten.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoglsl: Relax auxiliary storage ordering requirements with 420pack. 81/7581/1
Kenneth Graunke [Tue, 16 Jul 2013 02:01:28 +0000 (19:01 -0700)]
glsl: Relax auxiliary storage ordering requirements with 420pack.

These were already semi-relaxed, since the storage qualifier rule
already skipped when 420pack was enabled.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agoglsl: Handle centroid qualifier ordering in C code, not the parser. 80/7580/1
Kenneth Graunke [Sun, 14 Jul 2013 02:35:02 +0000 (19:35 -0700)]
glsl: Handle centroid qualifier ordering in C code, not the parser.

The GL_ARB_shading_language_420pack extension/GLSL 4.20 split centroid
off into a new category, "auxiliary storage qualifiers," and allow these
to be placed anywhere in the series.  So we have to stop recognizing
"centroid in"/"centroid out"/"centroid varying" in the grammar and get
more creative.

The same approach used before works here, too.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agoglsl: Allow precision qualifiers to be flexibly ordered with 420pack. 79/7579/1
Kenneth Graunke [Tue, 16 Jul 2013 01:42:26 +0000 (18:42 -0700)]
glsl: Allow precision qualifiers to be flexibly ordered with 420pack.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agoglsl: Move precision handling to be part of qualifier handling. 78/7578/1
Kenneth Graunke [Mon, 15 Jul 2013 22:58:29 +0000 (15:58 -0700)]
glsl: Move precision handling to be part of qualifier handling.

This is necessary for the parser to be able to accept precision
qualifiers not immediately adjacent to the type, such as "const highp
inout float foo".

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agoglsl: Change is_precision_statement to default_precision != none. 77/7577/1
Kenneth Graunke [Mon, 15 Jul 2013 22:39:35 +0000 (15:39 -0700)]
glsl: Change is_precision_statement to default_precision != none.

Currently, we store precision in ast_type_specifier, rather than
ast_type_qualifier.  This works because precision is the last qualifier,
and immediately adjacent to the type.

Default precision statements (such as "precision highp float") are
represented as ast_type_specifier objects, with a boolean to indicate
that it's a default precision statement rather than an ordinary type.

ast_type_specifier::precision will be moving to ast_type_qualifier soon,
in order to support arbitrary qualifier ordering.  However, we still
need to store a "this is a precision statement" flag /and/ the default
precision in ast_type_specifier.

This patch changes the boolean into a new field, default_precision.
If default_precision != ast_precision_none, it's a precision statement
with the specified precision.  Otherwise, it's an ordinary type.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agoglsl: Disable ordering checks for const parameters with 420pack. 76/7576/1
Kenneth Graunke [Tue, 16 Jul 2013 00:02:21 +0000 (17:02 -0700)]
glsl: Disable ordering checks for const parameters with 420pack.

This makes the complier accept both "const in" and "in const".

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agoglsl: Handle "const" as a parameter qualifier. 75/7575/1
Kenneth Graunke [Mon, 15 Jul 2013 22:06:31 +0000 (15:06 -0700)]
glsl: Handle "const" as a parameter qualifier.

This will make it easy to support both "const in" and "in const", as
required by GLSL 4.20/ARB_shading_language_420pack.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agoglsl: Refactor parameter qualifier handling. 74/7574/1
Kenneth Graunke [Mon, 15 Jul 2013 18:45:24 +0000 (11:45 -0700)]
glsl: Refactor parameter qualifier handling.

"Parameter direction qualifier" is a new term I invented just now; it's
not part of any GLSL specification.

This paves the way handling multiple parameter qualifiers, in any order,
as required by GLSL 4.20/ARB_shading_language_420pack.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agoglsl: Use merge_qualifier() when processing qualifier lists. 73/7573/1
Kenneth Graunke [Mon, 15 Jul 2013 17:50:35 +0000 (10:50 -0700)]
glsl: Use merge_qualifier() when processing qualifier lists.

Most of ast_type_qualifier is simply a bitfield (represented as a
structure of unsigned:1 bits in a union with an unsigned).  However, it
also contains ARB_explicit_attrib_location's location/index fields.

In the past, this has worked by simply returning the layout qualifier's
ast_type_qualifier and merging the other bits into it.  However, that's
not obvious until you break it by switching $1 and $2.

Using merge_qualifier() copies them appropriately, and also properly
overrides layout qualifiers.  It also checks for duplicate qualifiers,
which renders some of the checks in the previous patch unnecessary.
However, those checks provide better error messages, such as "Duplicate
interpolation qualifier", rather than just "duplicate qualifier".

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agoglsl: Allow duplicate layout qualifiers with 420pack. 72/7572/1
Kenneth Graunke [Thu, 18 Jul 2013 23:31:05 +0000 (16:31 -0700)]
glsl: Allow duplicate layout qualifiers with 420pack.

The new 4.20 rules explicitly allow multiple layout(...) sections.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agoglsl: Disable ordering checks on most qualifiers for 420pack. 71/7571/1
Kenneth Graunke [Mon, 15 Jul 2013 23:11:00 +0000 (16:11 -0700)]
glsl: Disable ordering checks on most qualifiers for 420pack.

This makes the compiler accept invariant, storage, layout, and
interpolation qualifiers in any order when ARB_shading_language_420pack
is enabled.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agoglsl: Handle most qualifier ordering in C code rather than the grammar. 70/7570/1
Kenneth Graunke [Sat, 13 Jul 2013 22:27:52 +0000 (15:27 -0700)]
glsl: Handle most qualifier ordering in C code rather than the grammar.

The GL_ARB_shading_language_420pack extension/GLSL 4.20 allow qualifiers
to be specified in (basically) any order.  In order to support this, we
can't hardcode the ordering restrictions in the grammar.

This patch alters the grammar to accept invariant, storage, layout, and
interpolation qualifiers in any order, but adds C code to enforce the
ordering requirements.  In the 420pack case, we should be able to simply
skip the error checks.

As a bonus, this also lets us generate decent error messages, rather
than Bison's awful "unexpected TOKEN" errors.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agoglsl: Add a new ast_type_qualifier::has_auxiliary_storage() method. 69/7569/1
Kenneth Graunke [Sun, 14 Jul 2013 02:20:37 +0000 (19:20 -0700)]
glsl: Add a new ast_type_qualifier::has_auxiliary_storage() method.

"Auxiliary storage qualifiers" is the new term given to "centroid",
"patch", and "sample" by GLSL 4.20/GL_ARB_shading_language_420pack.

Even though we only support "centroid", it's useful to add this now
so that all auxiliary storage qualifiers get handled in the right places
once they're eventually supported.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agoglsl: Add a new ast_type_qualifier::has_storage() method. 68/7568/1
Kenneth Graunke [Sat, 13 Jul 2013 05:36:31 +0000 (22:36 -0700)]
glsl: Add a new ast_type_qualifier::has_storage() method.

This makes it easy to check if any storage qualifiers are set.

"centroid" is not considered a storage qualifier.  In the old language
rules, you can't specify "centroid" by itself; it's always "centroid
in", "centroid out", or "centroid varying."  So one of the other storage
qualifiers will always be set; there's no need to specifically check for
centroid.

In the new 4.20 rules, centroid is an auxiliary storage qualifier, not a
storage qualifier.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agoglsl: Add a new ast_type_qualifier::has_layout() method. 67/7567/1
Kenneth Graunke [Sat, 13 Jul 2013 05:34:19 +0000 (22:34 -0700)]
glsl: Add a new ast_type_qualifier::has_layout() method.

This makes it easy to check if any layout qualifiers are set.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agoi965: Combine URB code emission into a single group. 66/7566/1
Kenneth Graunke [Thu, 11 Jul 2013 17:24:15 +0000 (10:24 -0700)]
i965: Combine URB code emission into a single group.

All four URB packets need to be programmed together in order for the GPU
state to be valid.  Putting them in separate BEGIN..ADVANCE blocks is
risky: if we're nearing the end of a batch, the batch could be flushed
inbetween two of the commands, causing the URB programming to be split
into two batchbuffers.

This -might- be okay with hardware contexts, but it offers no advantages
over keeping them together, and has a potential for hangs.

Putting them into a single BEGIN..ADVANCE block ensures they'll be kept
in the same batch, which seems wise.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965/hsw: Change L3 MOCS for depth, hiz, and stencil 65/7565/1
Chad Versace [Thu, 18 Jul 2013 17:07:30 +0000 (10:07 -0700)]
i965/hsw: Change L3 MOCS for depth, hiz, and stencil

Change from "not cacheable" to "cacheable" in L3.
Do so for the draw upload path and blorp.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>