platform/upstream/mesa.git
11 years agost/mesa: make st_flush do what glFlush does
Marek Olšák [Fri, 23 Nov 2012 16:42:11 +0000 (17:42 +0100)]
st/mesa: make st_flush do what glFlush does

11 years agoglx/dri2: add and use new driver hook flush_with_flags
Marek Olšák [Fri, 23 Nov 2012 17:31:42 +0000 (18:31 +0100)]
glx/dri2: add and use new driver hook flush_with_flags

11 years agoglx: move the glFlush call one layer down
Marek Olšák [Tue, 13 Nov 2012 16:06:37 +0000 (17:06 +0100)]
glx: move the glFlush call one layer down

11 years agor300g: refuse to create too large textures
Marek Olšák [Sat, 1 Dec 2012 21:40:00 +0000 (22:40 +0100)]
r300g: refuse to create too large textures

11 years agor300g: fix memory leaks in texture_create error paths
Marek Olšák [Sat, 1 Dec 2012 21:38:36 +0000 (22:38 +0100)]
r300g: fix memory leaks in texture_create error paths

11 years agor300g: fix revoking hyperz access
Marek Olšák [Sat, 1 Dec 2012 20:18:59 +0000 (21:18 +0100)]
r300g: fix revoking hyperz access

The bug was uncovered by 67c8e96f5ace67f9c17556934ee9532877d3a00.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=57763

11 years agogallivm: drop border wrap clamping code
Roland Scheidegger [Fri, 30 Nov 2012 19:46:23 +0000 (20:46 +0100)]
gallivm: drop border wrap clamping code

The border clamping code is unnecessary, since we don't care if a wrapped
coord value is -1 or <-1 (same for length vs. >length), in either case the
border handling code will mask out the offset and replace the texel value with
the border color.
Note that technically this is not entirely correct. Omitting clamping on the
float coords means that flt->int conversion may result in undefined values for
values of very large magnitude.
However there's no reason we should honor this here since:
a) we don't care for that for ordinary wrap modes in the aos code when
   converting coords and the problem is worse there (as we've got only
   effectively 24 instead of 32bits)
b) at least in some cases the clamping was done already in int space hence
   doing nothing to fix that problem.
c) with sse2 flt->int conversion with such values results in 0x80000000 which
   is just perfect (for clamp to border - not so much for the ordinary clamp to
   edge).

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agor300g: handle map flag DISCARD_WHOLE_RESOURCE
Marek Olšák [Fri, 30 Nov 2012 14:23:41 +0000 (15:23 +0100)]
r300g: handle map flag DISCARD_WHOLE_RESOURCE

This should improve performance in apps which trigger this codepath.
(e.g. Wine does)

11 years agoradeon: Fix memory leak in radeonCreateScreen2.
Vinson Lee [Fri, 30 Nov 2012 07:10:03 +0000 (23:10 -0800)]
radeon: Fix memory leak in radeonCreateScreen2.

Fixes a memory leak defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agonouveau: Fix build.
Brian Paul [Sat, 1 Dec 2012 03:11:21 +0000 (19:11 -0800)]
nouveau: Fix build.

Fixes nouveau build failure introduced at
c73245882c7ff1277b190b97f093f7b423a22f10.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=57746
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
11 years agoglsl: fix uninitialised variable from constructor
Dave Airlie [Fri, 30 Nov 2012 10:24:33 +0000 (20:24 +1000)]
glsl: fix uninitialised variable from constructor

Coverity pointed out this uninitialised class member.

Note: This is a candidate for stable branches.

Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agoglsl: initialise killed_all field.
Dave Airlie [Fri, 30 Nov 2012 10:23:20 +0000 (20:23 +1000)]
glsl: initialise killed_all field.

coverity pointed out this field was being used uninitialised.

Note: This is a candidate for stable branches.

Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agosvga: remove pointless assert on unsigned >= 0
Dave Airlie [Fri, 30 Nov 2012 10:02:39 +0000 (20:02 +1000)]
svga: remove pointless assert on unsigned >= 0

all unsigneds are >= 0 :-)

There may be an argument for leaving this in, in case someone
changes min_lod to an integer, so feel free to apply or drop.

Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agoglsl: fix cut-n-paste error in error handling. (v2)
Dave Airlie [Fri, 30 Nov 2012 08:33:21 +0000 (18:33 +1000)]
glsl: fix cut-n-paste error in error handling. (v2)

Reported by coverity scan.

v2: fix second case

Note: This is a candidate for stable branches.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agor300g: fix comparison of hyperz flush time.
Dave Airlie [Fri, 30 Nov 2012 08:27:51 +0000 (18:27 +1000)]
r300g: fix comparison of hyperz flush time.

I haven't confirmed this is doing the correct thing, but at
least this might make someone review it!

Reported by internal RH coverity scan.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
11 years agodri_glx: fix use after free report
Dave Airlie [Fri, 30 Nov 2012 07:47:47 +0000 (17:47 +1000)]
dri_glx: fix use after free report

the critical error would use driverName.

Found by internal RH coverity scan.

Note: This is a candidate for stable branches.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agoRevert "glcpp: Rewrite line-continuation support to act globally."
Carl Worth [Sat, 1 Dec 2012 01:17:56 +0000 (17:17 -0800)]
Revert "glcpp: Rewrite line-continuation support to act globally."

This reverts commit 962a1c07b44fe500b79b3ca6806d72a432c1f055.

Further testing revealed that this commit can cause the pre-processor to enter
infinite loops. For now, simply revert this code until a cleaner,
better-tested version is available.

11 years agoglcpp: Rewrite line-continuation support to act globally.
Carl Worth [Thu, 29 Nov 2012 22:49:46 +0000 (14:49 -0800)]
glcpp: Rewrite line-continuation support to act globally.

Previously, we were only supporting line-continuation backslash characters
within lines of pre-processor directives, (as per the specification). With
OpenGL 4.2 and GLES3, line continuations are now supported anywhere within a
shader.

While changing this, also fix a bug where the preprocessor was ignoring
line continuation characters when a line ended in multiple backslash
characters.

The new code is also more efficient than the old. Previously, we would
perform a ralloc copy at each newline. We now perform copies only at each
occurrence of a line-continuation.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoegl/wayland: Dispatch the event queue before get_buffers
Ander Conselvan de Oliveira [Thu, 22 Nov 2012 13:34:49 +0000 (15:34 +0200)]
egl/wayland: Dispatch the event queue before get_buffers

When a client frame callback is executed and the client starts rendering
again, the egl event queue might not have been dispatched so that the
buffer release event for the previous frame hasn't been processed. In
that case a third buffer is allocated, even though it would be possible
to reuse the buffer that was just released.

The wl_display_dispatch_queue_pending() entry point is available from
wayland-client 1.0.2, so require that in configure.ac.  Also, just
let the pkg-config macro throw its own error, which will show what version
we were looking for and failed to find.

Note: This is a candidate for stable branches.

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
11 years agoegl/wayland: Add invalidate back in eglSwapBuffers()
Kristian Høgsberg [Fri, 30 Nov 2012 18:29:17 +0000 (13:29 -0500)]
egl/wayland: Add invalidate back in eglSwapBuffers()

Commit ca3ed3e024864e91ca3cccc59fb96950e1d079b5 fixed the problem where
eglMakeCurrent would trigger a getbuffer callback that then breaks the
following wl_egl_window_resize() call.  However, we still need to
invalidate buffers in eglSwapBuffers, since in wayland we always swap
buffers, so the dri driver needs to come out and ask us for the next buffer
after each swapbuffer.

Note: this is a candidate for stable branches.

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
11 years agoi965/fs: Add fs_reg::is_zero() and is_one(); use for opt_algebraic().
Kenneth Graunke [Sat, 17 Nov 2012 23:10:53 +0000 (15:10 -0800)]
i965/fs: Add fs_reg::is_zero() and is_one(); use for opt_algebraic().

These helper macros save you from writing nasty expressions like:

   if ((inst->src[1].type == BRW_REGISTER_TYPE_F &&
         inst->src[1].imm.f == 1.0) ||
        ((inst->src[1].type == BRW_REGISTER_TYPE_D ||
          inst->src[1].type == BRW_REGISTER_TYPE_UD) &&
         inst->src[1].imm.u == 1)) {

Instead, you simply get to write inst->src[1].is_one().  Simple.
Also, this makes the FS backend match the VS backend (which has these).

This patch also converts opt_algebraic to use the new helper functions.
As a consequence, it will now also optimize integer-typed expressions.

Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agost/mesa: fix context use-after-free problem in st_renderbuffer_delete()
Brian Paul [Fri, 30 Nov 2012 17:11:54 +0000 (10:11 -0700)]
st/mesa: fix context use-after-free problem in st_renderbuffer_delete()

The use-after-free happened when the renderbuffer was shared by multiple
contexts and we tried to delete the renderbuffer using a context which
was previously deleted.

Note: this is a candidate for the stable branches.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agoutil: added pipe_surface_release() function
Brian Paul [Fri, 30 Nov 2012 17:10:25 +0000 (10:10 -0700)]
util: added pipe_surface_release() function

To fix a pipe_context::surface_destroy() use-after-free problem.
We previously added pipe_sampler_view_release() for similar reasons.

Note: this is a candidate for the stable branches.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agomesa: pass context parameter to gl_renderbuffer::Delete()
Brian Paul [Fri, 30 Nov 2012 17:04:48 +0000 (10:04 -0700)]
mesa: pass context parameter to gl_renderbuffer::Delete()

We sometimes need a rendering context when deleting renderbuffers.
Pass it explicitly instead of trying to grab a current context
(which might be NULL).  The next patch will make use of this.

Note: this is a candidate for the stable branches.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agoegl/wayland: Don't invalidate drawable on swap buffers
Ander Conselvan de Oliveira [Fri, 30 Nov 2012 15:41:02 +0000 (17:41 +0200)]
egl/wayland: Don't invalidate drawable on swap buffers

We used to invalidate the drawable after a call to eglSwapBuffers(),
so that a wl_egl_window_resize() would take effect for the next frame.
However, that leads to calling dri2_get_buffers() when eglMakeCurrent()
is called with the current context and surface, and a later call to
wl_egl_window_resize() would not take effect until the next buffer
swap.

Instead, add a callback from wl_egl_window_resize() back to the wayland
egl platform, and invalidate the drawable only when it is resized.

This solves a bug on wayland clients when going back to windowed mode
from fullscreen when clicking a pop up menu, where the window size
after this would be the fullscreen size.

Note: this is a candidate for stable branches.
CC: wayland-devel@lists.freedesktop.org
11 years agoegl: Only enable GLX backend if X11 EGL platform is enabled
Kristian Høgsberg [Thu, 29 Nov 2012 20:11:13 +0000 (15:11 -0500)]
egl: Only enable GLX backend if X11 EGL platform is enabled

We don't want to compile in a bunch of X11 dependencies in libEGL if
we can't run EGL on X11.

11 years agollvmpipe: Remove remnants of lp_tile_soa from Makefile.
José Fonseca [Fri, 30 Nov 2012 07:05:24 +0000 (07:05 +0000)]
llvmpipe: Remove remnants of lp_tile_soa from Makefile.

Completely forgot about updating Makefile when removing it. Stephane
already fixed the make build, but there were a few mentions of
lp_tile_soa left in the tree.

11 years agoi965/fp: Fix segfault on gen4 TXB instructions.
Eric Anholt [Mon, 26 Nov 2012 21:39:11 +0000 (13:39 -0800)]
i965/fp: Fix segfault on gen4 TXB instructions.

The gen4 simd16 workaround looks at ir->type to determine how much
storage to allocate for the simd16 value.  In fragment programs,
texturing only ever returns float vec4s (unlike GLSL, which can also
have scalar floats or vector integers), so this is the right type.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=56962
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agollvmpipe: Fix incorrect sizeof.
Vinson Lee [Thu, 29 Nov 2012 06:36:30 +0000 (22:36 -0800)]
llvmpipe: Fix incorrect sizeof.

Fixes sizeof not portable defects reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agollvmpipe: Fix build break from 75da95c50
Stéphane Marchesin [Fri, 30 Nov 2012 03:49:44 +0000 (19:49 -0800)]
llvmpipe: Fix build break from 75da95c50

The Makefile looks for a file which is gone (lp_tile_soa.c)

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

11 years agomesa: Fix GL_LUMINANCE handling for textures in glGetTexImage
Anuj Phogat [Fri, 16 Nov 2012 18:47:56 +0000 (10:47 -0800)]
mesa: Fix GL_LUMINANCE handling for textures in glGetTexImage

We need to rebase colors (ex: set G=B=0) when getting GL_LUMINANCE
textures in following cases:
1. If the luminance texture is actually stored as rgba
2. If getting a luminance texture, but returning rgba
3. If getting an rgba texture, but returning luminance

A similar fix was pushed by Brian Paul for uncompressed textures
in commit: f5d0ced.
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=47220

Observed no regressions in piglit and ogles2conform due to this fix.
This patch will cause failures in intel oglconform pxconv-gettex,
pxstore-gettex and pxtrans-gettex test cases. The cause of failures
is a bug in test cases. Expected luminance value is calculted
incorrectly in test cases: L = R+G+B.

V2: Set G = 0 when getting a RG texture but returning luminance.

Note: This is a candidate for stable branches.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <idr@freedesktop.org>
11 years agoRevert "meta: Don't try to glOrtho when the draw buffer isn't initialized."
Kenneth Graunke [Thu, 29 Nov 2012 21:47:13 +0000 (13:47 -0800)]
Revert "meta: Don't try to glOrtho when the draw buffer isn't initialized."

This reverts commit 9947470655bbf8f4a9c98fe6d93ff5c3486f1124.
Apparently it caused a lot of Piglit regressions.

11 years agor600g: mirror simplification of if/break opcodes
Vincent Lejeune [Wed, 28 Nov 2012 18:59:07 +0000 (19:59 +0100)]
r600g: mirror simplification of if/break opcodes

Reviewed-by: Tom Stellard <thomas.stellard at amd.com>
11 years agor600g: separate resource_id and sampler_id tex info in tgsi-to-llvm
Vincent Lejeune [Tue, 20 Nov 2012 22:22:47 +0000 (23:22 +0100)]
r600g: separate resource_id and sampler_id tex info in tgsi-to-llvm

Reviewed-by: Tom Stellard <thomas.stellard at amd.com>
11 years agoglcpp: Update README for new support of __LINE__ and __FILE__.
Carl Worth [Thu, 29 Nov 2012 05:43:45 +0000 (21:43 -0800)]
glcpp: Update README for new support of __LINE__ and __FILE__.

Drop these from the known limitations list since support was recently added
for these.

Also, fix a typo while in the area, (and the oddly missing final newline).

Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agoglcpp: Add test involving token pasting of INTEGER tokens.
Carl Worth [Thu, 29 Nov 2012 01:32:03 +0000 (17:32 -0800)]
glcpp: Add test involving token pasting of INTEGER tokens.

This test file is very similar to test 113-line-and-file-macros but uses token
pasting for cleaner quiz answers (without spaces between the digits). This
test passes thanks to the recent addition of support for pasting INTEGER
tokens, (but would have failed without that).

(Note that this test is distinct from test 059-token-pasting-integer which
pastes integers parsed from the source. Those are parsed to INTEGER_STRING
tokens and are already pasted correctly as verified by that test. The only way
to generate the INTEGER tokens which currently fail to paste is with an
internal define such as __LINE__ that results in an integer.)

Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agoglcpp: Add support for pasting of INTEGER tokens.
Carl Worth [Thu, 29 Nov 2012 01:34:36 +0000 (17:34 -0800)]
glcpp: Add support for pasting of INTEGER tokens.

By generalizing the current code designed to paste string tokens of various
types.

Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agoglcpp: Flag invalid pastes for integer followed by non-digits
Carl Worth [Wed, 28 Nov 2012 21:01:24 +0000 (13:01 -0800)]
glcpp: Flag invalid pastes for integer followed by non-digits

As recently tested in the additions to the invalid paste test, it is illegal
to paste a non-digit sequence onto the end of an integer.

The 082-invalid-paste test should now pass again.

Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agoglcpp: Extend the invalid-paste test
Carl Worth [Wed, 28 Nov 2012 20:57:09 +0000 (12:57 -0800)]
glcpp: Extend the invalid-paste test

The current code lets a few invalid pastes through, such as an string pasted
onto the end of an integer. Extend the invalid-paste test to catch some of
these.

Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agoglcpp: More factoring-out of common code to simplify things.
Carl Worth [Wed, 28 Nov 2012 20:11:02 +0000 (12:11 -0800)]
glcpp: More factoring-out of common code to simplify things.

This time creating a new _token_list_create_with_one_integer function
modeled after the existing _token_list_create_with_one_space function
(both implemented with new _token_list_create_with_one_ival).

Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agoglcpp: Factor out a tiny bit of repeated code.
Carl Worth [Wed, 28 Nov 2012 20:03:50 +0000 (12:03 -0800)]
glcpp: Factor out a tiny bit of repeated code.

This function is getting a little long too read. Simplify it by pulling
up one assignment from every condition.

Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agoglcpp: Add support for __LINE__ and __FILE__ macros
Carl Worth [Wed, 28 Nov 2012 19:52:05 +0000 (11:52 -0800)]
glcpp: Add support for __LINE__ and __FILE__ macros

These tokens are easy to expand by just looking at the current, tracked
location values, (and no need to look anything up in the hash table).

Add a test which verifies __LINE__ with several values, (and verifies __FILE__
for the single value of 0). Our testing framework isn't sophisticated enough
here to have a test with multiple file inputs.

This commit fixes part of es3conform's preprocess16_frag test.

Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agomesa: Rename API_OPENGL to API_OPENGL_COMPAT.
Paul Berry [Tue, 27 Nov 2012 20:26:51 +0000 (12:26 -0800)]
mesa: Rename API_OPENGL to API_OPENGL_COMPAT.

This should help avoid confusion now that we're using the gl_api enum
to distinguishing between core and compatibility API's.  The
corresponding enum value for core API's is API_OPENGL_CORE.

Acked-by: Eric Anholt <eric@anholt.net>
Acked-by: Matt Turner <mattst88@gmail.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agogallium/postprocess: share pipe_context and cso_context with the state tracker
Marek Olšák [Thu, 29 Nov 2012 01:55:01 +0000 (02:55 +0100)]
gallium/postprocess: share pipe_context and cso_context with the state tracker

Using one context instead of two is more efficient and
we can skip another context flush.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agomesa: move some helper functions from fboobject.c to glformats.c
Marek Olšák [Wed, 28 Nov 2012 18:07:18 +0000 (19:07 +0100)]
mesa: move some helper functions from fboobject.c to glformats.c

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agoandroid: include api_exec.c in generated files list
Tapani Pälli [Thu, 29 Nov 2012 07:48:00 +0000 (09:48 +0200)]
android: include api_exec.c in generated files list

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
11 years agogallivm: Fix lp_build_float_to_half.
José Fonseca [Thu, 29 Nov 2012 16:52:06 +0000 (16:52 +0000)]
gallivm: Fix lp_build_float_to_half.

The current implementation was close by not fully correct: several
operations that should be done in floating point were being done in
integer.

Fixes piglit fbo-clear-formats GL_ARB_texture_float

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agogallivm: fix a trivial txq issue for 2d shadow and cube shadow samplers
Roland Scheidegger [Thu, 29 Nov 2012 03:00:35 +0000 (04:00 +0100)]
gallivm: fix a trivial txq issue for 2d shadow and cube shadow samplers

untested (couldn't get the piglit test to run even with version overrides)
but seemed blatantly wrong.
In any case it would only affect an error case which when it would happen
probably all hope is lost anyway.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
11 years agollvmpipe: support array textures
Roland Scheidegger [Thu, 29 Nov 2012 03:08:32 +0000 (04:08 +0100)]
llvmpipe: support array textures

This adds array (1d,2d) texture support to llvmpipe.
Though probably should do something about 1d array textures requiring gobs
of memory (this issue is not strictly limited to arrays but it is probably
worse there).
Initial code by Jakob Bornecrantz <jakob@vmware.com>

Reviewed-by: José Fonseca <jfonseca@vmware.com>
11 years agogallivm: support array textures
Roland Scheidegger [Thu, 29 Nov 2012 03:06:48 +0000 (04:06 +0100)]
gallivm: support array textures

Support 1d and 2d array textures (including shadow samplers),
and (as a side effect mostly) also shadow cube samplers.
Seems to pass the relevant piglit tests both for sampling and rendering
to (though some require version overrides).
Since we don't support render target indices rendering to array textures
is still restricted to a single layer at a time.
Also, the min/max layer in the sampler view (which is unnecessary for GL)
is ignored (always use all layers).

Reviewed-by: José Fonseca <jfonseca@vmware.com>
11 years agollvmpipe: Remove lp_build_blend_soa()
José Fonseca [Wed, 28 Nov 2012 21:06:03 +0000 (21:06 +0000)]
llvmpipe: Remove lp_build_blend_soa()

No longer used/necessary, as we always blend in AoS now.

Trivial.

11 years agollvmpipe: Eliminate color buffer swizzling.
José Fonseca [Wed, 28 Nov 2012 20:14:17 +0000 (20:14 +0000)]
llvmpipe: Eliminate color buffer swizzling.

Now dead code.

Also had to remove the show_tiles/show_subtiles because now the color
buffers are always stored in their native format, so there is no longer
an easy way to paint the tile sizes.

Depth-stencil buffers are still swizzled.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agollvmpipe: Only advertise unswizzled formats.
José Fonseca [Wed, 28 Nov 2012 19:25:05 +0000 (19:25 +0000)]
llvmpipe: Only advertise unswizzled formats.

Update llvmpipe_is_format_supported and llvmpipe_is_format_unswizzled
so that only the formats that we can render without swizzling are
advertised.

We can still render all D3D10 required formats except
PIPE_FORMAT_R11G11B10_FLOAT, which needs to be implemented in a future
opportunity.

Removal of rendertarget swizzling will be done in a subsequent change.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agoutil/u_format: Kill util_format_is_array().
José Fonseca [Wed, 28 Nov 2012 19:20:18 +0000 (19:20 +0000)]
util/u_format: Kill util_format_is_array().

It is buggy (it was giving wrong results for some of the formats with
padding), and util_format_description::is_array already does precisely
what's intended.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agoutil/u_format: Tighten the meaning of is_array bit to exclude mixed type formats.
José Fonseca [Wed, 28 Nov 2012 19:18:09 +0000 (19:18 +0000)]
util/u_format: Tighten the meaning of is_array bit to exclude mixed type formats.

This is what we want in practice.

The only change is in PIPE_FORMAT_R8SG8SB8UX8U_NORM, which no longer is
considered an array format.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agoutil/u_format: Fix format manipulation for big-endian
Adhemerval Zanella [Thu, 22 Nov 2012 19:48:45 +0000 (13:48 -0600)]
util/u_format: Fix format manipulation for big-endian

This patch fixes various format manipulation for big-endian
architectures.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agogallivm: Fix format manipulation for big-endian
Adhemerval Zanella [Thu, 22 Nov 2012 19:48:45 +0000 (13:48 -0600)]
gallivm: Fix format manipulation for big-endian

This patch fixes various format manipulation for big-endian
architectures.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agogallivm: Add byte-swap construct calls
Adhemerval Zanella [Thu, 22 Nov 2012 18:23:23 +0000 (12:23 -0600)]
gallivm: Add byte-swap construct calls

This patch adds two more functions in type conversions header:
* lp_build_bswap: construct a call to llvm.bswap intrinsic for an
  element
* lp_build_bswap_vec: byte swap every element in a vector base on the
  input and output types.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agogallivm: Fix vector constant for shuffle
Adhemerval Zanella [Thu, 22 Nov 2012 19:42:45 +0000 (13:42 -0600)]
gallivm: Fix vector constant for shuffle

This patch fixes the vector constant generation used for vector shuffle
for big-endian machines.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agogallivm: clear Altivec NJ bit
Adhemerval Zanella [Thu, 22 Nov 2012 17:55:35 +0000 (11:55 -0600)]
gallivm: clear Altivec NJ bit

This patch enforces the clear of NJ bit in VSCR Altivec register so
denormal numbers are handles as expected by IEEE standards.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agogallivm: Altivec floating-point rounding
Adhemerval Zanella [Thu, 22 Nov 2012 17:37:18 +0000 (11:37 -0600)]
gallivm: Altivec floating-point rounding

This patch adds Altivec intrinsics for float vector types. It changes
the SSE specific definitions to a platform neutral and adds the calls
to Altivec intrinsic builder.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agogallivm: Altivec vector add/sub intrisics
Adhemerval Zanella [Thu, 22 Nov 2012 17:20:42 +0000 (11:20 -0600)]
gallivm: Altivec vector add/sub intrisics

This patch add correct vector addition and substraction intrisics when
using Altivec with PPC. Current code uses default path and LLVM backend
ends up issuing carry-out arithmetic instruction while it is expected
saturated ones.

It also includes a fix for PowerPC where char are unsigned by default,
resulting in bogus values for vector shifting.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agogallivm: Altivec vector max/min intrisics
Adhemerval Zanella [Thu, 22 Nov 2012 17:03:11 +0000 (11:03 -0600)]
gallivm: Altivec vector max/min intrisics

This patch adds the PPC Altivec instrics max/min instruction for
supported Altivec vector types (16xi8, 8xi16, 4xi32, 4xf32).

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agogallivm: Altivec pack/unpack intrisics
Adhemerval Zanella [Thu, 22 Nov 2012 16:54:45 +0000 (10:54 -0600)]
gallivm: Altivec pack/unpack intrisics

This patch adds PPC Altivec support for pack/unpack operations using Altivec
supported vector type (8xi8, 16xi16, 4xi32, 4xf32).

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agoradeonsi: Bitcast result of packf16 intrinsic to float for export intrinsic.
Michel Dänzer [Tue, 27 Nov 2012 18:53:58 +0000 (19:53 +0100)]
radeonsi: Bitcast result of packf16 intrinsic to float for export intrinsic.

Fixes 7 piglit tests, and prevents many more from crashing.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-and-Tested-by: Christian König <christian.koenig@amd.com>
11 years agoi965/vs: Move struct brw_compile (p) entirely inside vec4_generator.
Kenneth Graunke [Tue, 27 Nov 2012 08:16:05 +0000 (00:16 -0800)]
i965/vs: Move struct brw_compile (p) entirely inside vec4_generator.

The brw_compile structure contains the brw_instruction store and the
brw_eu_emit.c state tracking fields.  These are only useful for the
final assembly generation pass; the earlier compilation stages doesn't
need them.

This also means that the code generator for future hardware won't have
access to the brw_compile structure, which is extremely desirable
because it prevents accidental generation of Gen4-7 code.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
11 years agoi965/vs: Split final assembly code generation out of vec4_visitor.
Kenneth Graunke [Tue, 27 Nov 2012 06:53:10 +0000 (22:53 -0800)]
i965/vs: Split final assembly code generation out of vec4_visitor.

Compiling shaders requires several main steps:

   1. Generating VS IR from either GLSL IR or Mesa IR
   2. Optimizing the IR
   3. Register allocation
   4. Generating assembly code

This patch splits out step 4 into a separate class named "vec4_generator."

There are several reasons for doing so:

   1. Future hardware has a different instruction encoding.  Splitting
      this out will allow us to replace vec4_generator (which relies
      heavily on the brw_eu_emit.c code and struct brw_instruction) with
      a new code generator that writes the new format.

   2. It reduces the size of the vec4_visitor monolith.  (Arguably, a lot
      more should be split out, but that's left for "future work.")

   3. Separate namespaces allow us to make helper functions for
      generating instructions in both classes: ADD() can exist in
      vec4_visitor and create IR, while ADD() in vec4_generator() can
      create brw_instructions.  (Patches for this upcoming.)

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
11 years agoi965/vs: Abort on unsupported opcodes rather than failing.
Kenneth Graunke [Tue, 27 Nov 2012 05:56:06 +0000 (21:56 -0800)]
i965/vs: Abort on unsupported opcodes rather than failing.

Final code generation should never fail.  This is a bug, and there
should be no user-triggerable cases where this could occur.

Also, we're not going to have a fail() method after the split.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
11 years agoi965/vs: Move uses of brw_compile from do_vs_prog to brw_vs_emit.
Kenneth Graunke [Tue, 27 Nov 2012 07:59:32 +0000 (23:59 -0800)]
i965/vs: Move uses of brw_compile from do_vs_prog to brw_vs_emit.

The brw_compile structure is closely tied to the Gen4-7 hardware
encoding.  However, do_vs_prog is very generic: it just calls out to
get a compiled program and then uploads it.

This isn't ultimately where we want it, but it's a step in the right
direction: it's now closer to the code generator.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
11 years agoi965/vs: Rework memory contexts for shader compilation data.
Kenneth Graunke [Tue, 27 Nov 2012 07:52:20 +0000 (23:52 -0800)]
i965/vs: Rework memory contexts for shader compilation data.

During compilation, we allocate a bunch of things: the IR needs to last
at least until code generation...and then the program store needs to
last until after we upload the program.

For simplicity's sake, just keep it all around until we upload the
program.  After that, it can all be freed.

This will also save a lot of headaches during the upcoming refactoring.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
11 years agoi965/vs: Pass the brw_context pointer into brw_compute_vue_map().
Kenneth Graunke [Tue, 27 Nov 2012 07:07:51 +0000 (23:07 -0800)]
i965/vs: Pass the brw_context pointer into brw_compute_vue_map().

We used to steal it out of the brw_compile struct, but that won't be
initialized in time soon (and is eventually going away).

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
11 years agoi965/vs: Pass the brw_context pointer into vec4_visitor and do_vs_prog.
Kenneth Graunke [Tue, 27 Nov 2012 06:14:27 +0000 (22:14 -0800)]
i965/vs: Pass the brw_context pointer into vec4_visitor and do_vs_prog.

We used to steal it out of the brw_compile struct...but vec4_visitor
isn't going to have one of those in the future.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
11 years agoi965/vs: Move some functions from brw_vec4_emit.cpp to brw_vec4.cpp.
Kenneth Graunke [Tue, 27 Nov 2012 05:46:27 +0000 (21:46 -0800)]
i965/vs: Move some functions from brw_vec4_emit.cpp to brw_vec4.cpp.

This leaves only the final code generation stage in brw_vec4_emit.cpp,
moving the payload setup, run(), and brw_vs_emit functions to brw_vec4.cpp.

The fragment shader backend puts these functions in brw_fs.cpp, so this
patch also helps with consistency.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
11 years agometa: Don't try to glOrtho when the draw buffer isn't initialized.
Kenneth Graunke [Tue, 27 Nov 2012 05:11:14 +0000 (21:11 -0800)]
meta: Don't try to glOrtho when the draw buffer isn't initialized.

I ran across this while running a glGenerateMipmap() test.

_meta_GenerateMipmap sets MESA_META_TRANSFORM, which causes
_mesa_meta_begin to try and set a default orthographic projection.

Unfortunately, if the drawbuffer isn't set up, ctx->DrawBuffer->Width
and Height are 0, which just causes an GL_INVALID_VALUE error.

Fixes oglconform's fbo/mipmap.automatic, mipmap.manual, and
mipmap.manualIterateTexTargets.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agodocs: Mark some features in GL3.txt as done for r600
Jason Wood [Thu, 29 Nov 2012 00:05:12 +0000 (01:05 +0100)]
docs: Mark some features in GL3.txt as done for r600

Signed-off-by: Marek Olšák <maraeo@gmail.com>
11 years agost/mesa: allow forward-compatible contexts and set Const.ContextFlags
Marek Olšák [Wed, 28 Nov 2012 19:38:22 +0000 (20:38 +0100)]
st/mesa: allow forward-compatible contexts and set Const.ContextFlags

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agost/mesa: add support for GL core profiles
Marek Olšák [Fri, 23 Nov 2012 19:20:03 +0000 (20:20 +0100)]
st/mesa: add support for GL core profiles

The rest of the plumbing was in place already.

I have tested this by turning on all GL 3.1 features.
The drivers not supporting GL 3.1 will fail to create a core profile
as they should.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoconfigure.ac: remove -fomit-frame-pointer from LLVM flags
Marek Olšák [Tue, 27 Nov 2012 23:28:18 +0000 (00:28 +0100)]
configure.ac: remove -fomit-frame-pointer from LLVM flags

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
11 years agoconfigure.ac: look for whole words in LLVM flags, not prefixes
Marek Olšák [Tue, 27 Nov 2012 22:56:04 +0000 (23:56 +0100)]
configure.ac: look for whole words in LLVM flags, not prefixes

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
11 years agoconfigure.ac: consolidate stripping unwanted LLVM flags
Marek Olšák [Tue, 27 Nov 2012 22:38:01 +0000 (23:38 +0100)]
configure.ac: consolidate stripping unwanted LLVM flags

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
11 years agoconfigure.ac: print LLVM flags
Marek Olšák [Tue, 27 Nov 2012 21:32:50 +0000 (22:32 +0100)]
configure.ac: print LLVM flags

to see what we're mixing with ours

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
11 years agoutil: add more memory debugging features
Brian Paul [Wed, 28 Nov 2012 20:35:01 +0000 (13:35 -0700)]
util: add more memory debugging features

Add a DEBUG_FREED_MEMORY option to help catch use-after-free errors.
Add debug_memory_check() function which can be periodically called to
check that all known blocks are good.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
11 years agollvmpipe: Implement logic ops for the AoS path.
José Fonseca [Wed, 28 Nov 2012 20:45:03 +0000 (20:45 +0000)]
llvmpipe: Implement logic ops for the AoS path.

It was forgotten in the previous patch series, but it is trivial to
implement, based on the SoA path.

This fixes glean logicOp failures.

11 years agollvmpipe: Don't use dynamically sized arrays.
José Fonseca [Wed, 28 Nov 2012 19:57:26 +0000 (19:57 +0000)]
llvmpipe: Don't use dynamically sized arrays.

Unfortunately for MSVC arrays with a constant variable size are still
considered dynamically sized.

11 years agoi965/gen4-5: Fix segfaults with stencil-only depth/stencil setups.
Eric Anholt [Mon, 26 Nov 2012 22:46:11 +0000 (14:46 -0800)]
i965/gen4-5: Fix segfaults with stencil-only depth/stencil setups.

Fixes a ton of piglit regressions since the depthstencil fixes for gen6+.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=57309
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965/fs: Don't generate saturates over existing variable values.
Eric Anholt [Mon, 26 Nov 2012 22:22:12 +0000 (14:22 -0800)]
i965/fs: Don't generate saturates over existing variable values.

Fixes a crash in http://workshop.chromeexperiments.com/stars/ on i965,
and the new piglit test glsl-fs-clamp-5.
We were trying to emit a saturating move into a uniform, which the code
generator appropriately choked on.  This was broken in the change in
32ae8d3b321185a85b73ff703d8fc26bd5f48fa7.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=57166
NOTE: This is a candidate for the 9.0 branch.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965/fs: Add some minimal backend-IR dumping.
Eric Anholt [Tue, 30 Oct 2012 22:35:44 +0000 (15:35 -0700)]
i965/fs: Add some minimal backend-IR dumping.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agollvmpipe: Update llvmpipe_is_format_unswizzled to reflect latest changes.
James Benton [Fri, 14 Sep 2012 12:29:58 +0000 (13:29 +0100)]
llvmpipe: Update llvmpipe_is_format_unswizzled to reflect latest changes.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agollvmpipe: Enable vertex color clamping.
James Benton [Thu, 13 Sep 2012 15:05:08 +0000 (16:05 +0100)]
llvmpipe: Enable vertex color clamping.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agollvmpipe: Unswizzled rendering.
James Benton [Thu, 13 Sep 2012 15:04:42 +0000 (16:04 +0100)]
llvmpipe: Unswizzled rendering.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agogallivm: Updated lp_build_const_mask_aos to input number of channels.
James Benton [Wed, 11 Jul 2012 14:39:53 +0000 (15:39 +0100)]
gallivm: Updated lp_build_const_mask_aos to input number of channels.

Also updated lp_build_const_mask_aos_swizzled to reflect this.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agoutil: Updated util_format_is_array to be more accurate.
James Benton [Wed, 11 Jul 2012 14:32:47 +0000 (15:32 +0100)]
util: Updated util_format_is_array to be more accurate.

Will allow formats with padding, e.g. RGBX.
Will now allow swizzled formats as long as the alpha is channel 3.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agogallivm: Added support for float to half-float conversion in lp_build_conv.
James Benton [Fri, 8 Jun 2012 17:49:53 +0000 (18:49 +0100)]
gallivm: Added support for float to half-float conversion in lp_build_conv.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agogallivm: Changed lp_build_pad_vector to correctly handle scalar argument.
James Benton [Wed, 30 May 2012 13:40:33 +0000 (14:40 +0100)]
gallivm: Changed lp_build_pad_vector to correctly handle scalar argument.

Removed the lp_type argument as it was unnecessary.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agogallivm: Add a function to generate lp_type for a format.
James Benton [Wed, 30 May 2012 13:38:52 +0000 (14:38 +0100)]
gallivm: Add a function to generate lp_type for a format.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agogallivm: Add support for unorm16 in lp_build_mul.
James Benton [Wed, 30 May 2012 13:36:22 +0000 (14:36 +0100)]
gallivm: Add support for unorm16 in lp_build_mul.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agoglcpp: Support #elif(expression) with no intervening space.
Matt Turner [Mon, 26 Nov 2012 19:53:45 +0000 (11:53 -0800)]
glcpp: Support #elif(expression) with no intervening space.

And add test cases to ensure that this works
- 110 verifies that glcpp rejects #elif<digits> which glcpp
  previously accepted.
- 111 verifies that glcpp accepts #if followed immediately by
  (, +, -, !, or ~.
- 112 does the same as 111 but for #elif.

See 17f9beb6 for #if change.
Reviewed-by: Carl Worth <cworth@cworth.org>
11 years agoglcpp: Reject #version and #line not followed by whitespace
Matt Turner [Wed, 21 Nov 2012 01:23:42 +0000 (17:23 -0800)]
glcpp: Reject #version and #line not followed by whitespace

Fixes part of es3conform's preprocess16_frag test.
Reviewed-by: Carl Worth <cworth@cworth.org>
11 years agomesa: fix BlitFramebuffer between linear and sRGB formats
Marek Olšák [Fri, 23 Nov 2012 02:02:44 +0000 (03:02 +0100)]
mesa: fix BlitFramebuffer between linear and sRGB formats

NOTE: This is a candidate for the stable branches.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agogallivm: fix multiple lods with different min/mag filter and wide vectors
Roland Scheidegger [Wed, 28 Nov 2012 17:07:27 +0000 (18:07 +0100)]
gallivm: fix multiple lods with different min/mag filter and wide vectors

broken since 529fe420ba6836479619ba42e53665724755fc1c,
I forgot some code, only added the comment...
Fixes bug 57644.