platform/upstream/mesa.git
11 years agost/mesa: implement glBitmap unpacking from a PBO, for the cache path
Brian Paul [Mon, 18 Feb 2013 15:36:35 +0000 (08:36 -0700)]
st/mesa: implement glBitmap unpacking from a PBO, for the cache path

We weren't mapping the PBO when using the bitmap cache (but we had
the PBO code for the non-cache path.)

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

Note: This is a candidate for the stable branches.

11 years agodraw: fix non-perspective interpolation in interp()
Brian Paul [Sat, 16 Feb 2013 18:54:22 +0000 (11:54 -0700)]
draw: fix non-perspective interpolation in interp()

This fixes a regression from ab74fee5e1a3fc3323b7238278637b232c2d0d95.
When we use the clip coordinate to compute the screen-space interpolation
factor, we need to first apply the divide-by-W step to the clip
coordinate.

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

Note: This is a candidate for the 9.1 branch.

11 years agost/mesa: remove what is left from u_blit
Marek Olšák [Thu, 14 Feb 2013 13:30:59 +0000 (14:30 +0100)]
st/mesa: remove what is left from u_blit

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agost/mesa: simplify and improve CopyTexSubImage
Marek Olšák [Thu, 14 Feb 2013 11:08:33 +0000 (12:08 +0100)]
st/mesa: simplify and improve CopyTexSubImage

It has become a bit messy.

Changes:

- finally correct checking for transfer ops depending on the base format

- making sure the base internal format and the texture format match
  (we were ignoring it, but it's important for correctness)

- the way-too-strict rule that both src and dst base formats must be the same
  was dropped; ensuring the simpler and more permissive rule mentioned above
  is enough

- stop using util_blit_pixels; pipe->blit is flexible enough, and now that we
  have RGBX and red-alpha formats, pipe->blit can be used for more cases

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agost/mesa: don't do sRGB conversion in CopyTexSubImage
Marek Olšák [Thu, 14 Feb 2013 11:48:12 +0000 (12:48 +0100)]
st/mesa: don't do sRGB conversion in CopyTexSubImage

Assuming I understand EXT_texture_sRGB correctly.

NOTE: This is a candidate for the stable branches.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agost/mesa: implement blit-based TexImage and TexSubImage
Marek Olšák [Thu, 14 Feb 2013 00:03:55 +0000 (01:03 +0100)]
st/mesa: implement blit-based TexImage and TexSubImage

A temporary texture is created such that it matches the format and type
combination and pixels are copied to it using memcpy. Then the blit is used to
copy the temporary texture to the texture image being modified by TexImage or
TexSubImage. The blit takes care of the format and type conversion and
swizzling. The result is a very fast texture upload involving as little CPU
as possible.

This improves performance in apps which upload textures during rendering.
An example is the Wine OpenGL backend for DirectDraw, which I used to test
the game StarCraft. Profiling had shown that TexSubImage was taking 50% of
CPU time without this patch, which was the main motivation for this work, and
now TexSubImage only takes 14% of CPU time. I had to underclock my CPU to see
any difference in the game and this patch does make the game a lot faster
if the CPU is slow (or using the powersave cpufreq profile).

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agost/mesa: fix blit-based GetTexImage for 1D array textures
Marek Olšák [Wed, 13 Feb 2013 21:32:03 +0000 (22:32 +0100)]
st/mesa: fix blit-based GetTexImage for 1D array textures

This is not easy to hit, because we have 3 code paths now
(tried in this order):
- memcpy-based (skips the blit) -> _mesa_tex_getimage
- blit-based
- slow pixel packing -> _mesa_tex_getimage

The main difference later in the code is the parameters of
_mesa_image_address3d.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agost/mesa: fix blit-based GetTexImage for depth/stencil formats
Marek Olšák [Wed, 13 Feb 2013 21:23:37 +0000 (22:23 +0100)]
st/mesa: fix blit-based GetTexImage for depth/stencil formats

BTW, we have 0 tests for glGetTexImage(format=GL_DEPTH*).

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agost/mesa: factor out code for determining blit.mask from CopyTexSubImage
Marek Olšák [Wed, 13 Feb 2013 21:15:55 +0000 (22:15 +0100)]
st/mesa: factor out code for determining blit.mask from CopyTexSubImage

I'll need this later.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agoradeonsi: Fix PIPE_FORMAT_X32_S8X24_UINT sampler hardware format
Michel Dänzer [Fri, 15 Feb 2013 14:54:28 +0000 (15:54 +0100)]
radeonsi: Fix PIPE_FORMAT_X32_S8X24_UINT sampler hardware format

4 more little piglits.

NOTE: This is a candidate for the 9.1 branch.

11 years agoradeonsi: Use stencil surface level information for stencil texturing
Michel Dänzer [Fri, 15 Feb 2013 10:30:50 +0000 (11:30 +0100)]
radeonsi: Use stencil surface level information for stencil texturing

7 more little dwarves^W piglits.

NOTE: This is a candidate for the 9.1 branch.

11 years agoradeonsi: properly implement S8Z24 depth-stencil format
Michel Dänzer [Fri, 15 Feb 2013 10:11:22 +0000 (11:11 +0100)]
radeonsi: properly implement S8Z24 depth-stencil format

Based on r600g commit 2b9659c9e627ad03160899b8be04f96307d098eb .

Fixes crashes with 4 piglit tests which are now hitting these formats.

NOTE: This is a candidate for the 9.1 branch.

11 years agor600g/llvm: Support for TBO
Vincent Lejeune [Thu, 14 Feb 2013 16:26:30 +0000 (17:26 +0100)]
r600g/llvm: Support for TBO

Reviewed-by: Tom Stellard <thomas.stellard at amd.com>
11 years agor600g/llvm: Set Inputs/Outputs count to 32 (api reported value)
Vincent Lejeune [Wed, 13 Feb 2013 19:20:04 +0000 (20:20 +0100)]
r600g/llvm: Set Inputs/Outputs count to 32 (api reported value)

Reviewed-by: Tom Stellard <thomas.stellard at amd.com>
11 years agor600g/llvm: Fix alpha_to_one piglit tests
Vincent Lejeune [Wed, 13 Feb 2013 17:49:30 +0000 (18:49 +0100)]
r600g/llvm: Fix alpha_to_one piglit tests

Reviewed-by: Tom Stellard <thomas.stellard at amd.com>
11 years agor600g/llvm: Add support for UBO
Vincent Lejeune [Tue, 12 Feb 2013 17:44:13 +0000 (18:44 +0100)]
r600g/llvm: Add support for UBO

NOTE: This is a candidate for the Mesa stable branch.

Reviewed-by: Tom Stellard <thomas.stellard at amd.com>
11 years agoi965: Fix leak in blorp CopyTexSubImage2D
Christopher James Halse Rogers [Sat, 16 Feb 2013 05:39:07 +0000 (16:39 +1100)]
i965: Fix leak in blorp CopyTexSubImage2D

_mesa_delete_renderbuffer does not call the driver-specific
renderbuffer delete function, so the blorp code was leaking the
Intel-specific bits, including some GEM objects.

Call the renderbuffer's ->Delete() method instead, which does the
right thing.

Fixes Unity rapidly sending the machine into the arms of the OOM-killer

Note: This is a candidate for the 9.1 branch.

Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agogallivm/tgsi: fix issues with sample opcodes
Roland Scheidegger [Fri, 15 Feb 2013 02:15:43 +0000 (03:15 +0100)]
gallivm/tgsi: fix issues with sample opcodes

We need to encode them as Texture instructions since the NumOffsets field
is encoded there. However, we don't encode the actual target in there, this
is derived from the sampler view src later.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agogallivm/tgsi: fix src modifier fetching with non-float types.
Roland Scheidegger [Sat, 16 Feb 2013 01:26:14 +0000 (02:26 +0100)]
gallivm/tgsi: fix src modifier fetching with non-float types.

Need to take the type into account. Also, if we want to allow
mov's with modifiers we need to pick a type (assume float).

v2: don't allow all modifiers on all type, in particular don't allow
absolute on non-float types and don't allow negate on unsigned.
Also treat UADD as signed (despite the name) since it is used
for handling both signed and unsigned integer arguments and otherwise
modifiers don't work.
Also add tgsi docs clarifying this.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agogallivm: fix issues with trunc/round/floor/ceil with no arch rounding
Roland Scheidegger [Thu, 31 Jan 2013 19:27:49 +0000 (11:27 -0800)]
gallivm: fix issues with trunc/round/floor/ceil with no arch rounding

The emulation of these if there's no rounding instruction available
is a bit more complicated than what the code did.
In particular, doing fp-to-int/int-to-fp will not work if the exponent
is large enough (and with NaNs, Infs). Hence such values need to be filtered
out and the original value returned in this case (which fortunately should
always be exact). This comes at the expense of performance (if your cpu
doesn't support rounding instructions).
Furthermore, floor/ifloor/ceil/iceil were affected by precision issues for
values near negative (for floor) or positive (for ceil) zero, fix that as well
(fixing this issue might not actually be slower except for ceil/iceil if the
type is not signed which is probably rare - note iceil has no callers left
in any case).

Also add some new rounding test values in lp_test_arit to actually test
for that stuff (which previously would have failed without sse41).

This fixes https://bugs.freedesktop.org/show_bug.cgi?id=59701.

11 years agogallivm: DIV shouldn't be deprecated.
Roland Scheidegger [Fri, 15 Feb 2013 02:04:33 +0000 (03:04 +0100)]
gallivm: DIV shouldn't be deprecated.

(Though it looks glsl won't emit it.)

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agomesa: Use PROGRAM_ERROR_STRING_ARB instead of the _NV name
Matt Turner [Tue, 12 Feb 2013 07:26:02 +0000 (23:26 -0800)]
mesa: Use PROGRAM_ERROR_STRING_ARB instead of the _NV name

Since NV_fragment_program is now gone. No functional change, since the
values are identical.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agotrace: add context pointer sanity checking
Brian Paul [Fri, 15 Feb 2013 17:42:32 +0000 (10:42 -0700)]
trace: add context pointer sanity checking

To help catch mixed up context pointer bugs in the future, add a
trace_context_check() function and some new assertions.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agotrace: fix incorrect trace_surface::base.context pointer
Brian Paul [Fri, 15 Feb 2013 17:36:32 +0000 (10:36 -0700)]
trace: fix incorrect trace_surface::base.context pointer

When a trace_surface object is created in trace_surf_create() we
weren't correctly setting the surface's context pointer.  Instead of
it being the trace context, it was the wrapped driver's context.
This caused things to blow up sometimes during surface deallocation.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agomesa: remove old version comment from gl.h
Brian Paul [Thu, 14 Feb 2013 23:22:26 +0000 (16:22 -0700)]
mesa: remove old version comment from gl.h

11 years agotrace: whitespace, comment clean-ups
Brian Paul [Thu, 14 Feb 2013 23:22:00 +0000 (16:22 -0700)]
trace: whitespace, comment clean-ups

11 years agotrace: move struct tr_list to tr_texture.h
Brian Paul [Thu, 14 Feb 2013 23:21:12 +0000 (16:21 -0700)]
trace: move struct tr_list to tr_texture.h

That's the only place it's used.

11 years agost/mesa: fix format query for GL_ARB_texture_rg
Brian Paul [Thu, 14 Feb 2013 19:24:02 +0000 (12:24 -0700)]
st/mesa: fix format query for GL_ARB_texture_rg

The GL_ARB_texture_rg spec says that we need to support both texturing
and rendering for the GL_RED and GL_RG formats.  So move the format
check up into the rendertarget_mapping[] list.  Also, add
PIPE_FORMAT_R8_UNORM to the list of formats required.

Note: This is a candidate for the stable branches.

Reviewed-by: Marek Olšák <maraeo@gmail.com>
11 years agoi965/fs: Do a general SEND dependency workaround for the original 965.
Eric Anholt [Tue, 5 Feb 2013 23:46:22 +0000 (15:46 -0800)]
i965/fs: Do a general SEND dependency workaround for the original 965.

We'd been ad-hoc inserting instructions in some SEND messages with no
knowledge of when it was required (so extra instructions), but not all SENDs
(so not often enough).  This should do much better than that, though it's
still flow-control-ignorant.

v2: Use BRW_MAX_MRF instead of magic numbers.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=58960
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
NOTE: Candidate for the stable branches.

11 years agoegl-wayland: Fix left-over wl_display_roundtrip() usage
Kristian Høgsberg [Fri, 15 Feb 2013 01:47:29 +0000 (20:47 -0500)]
egl-wayland: Fix left-over wl_display_roundtrip() usage

We have to use the EGL wayland event queue for roundtrip, so use the
wayland_roundtrip() helper, which does just that.

11 years agoi965/gen7: Set up all samplers even if samplers are sparsely used.
Eric Anholt [Thu, 14 Feb 2013 05:21:45 +0000 (21:21 -0800)]
i965/gen7: Set up all samplers even if samplers are sparsely used.

In GLSL, sampler indices are allocated contiguously from 0.  But in the
case of ARB_fragment_program (and possibly fixed function), an app that
uses texture 0 and 2 will use sampler indices 0 and 2, so we were only
allocating space for samplers 0 and 1 and setting up sampler 0.  We
would read garbage for sampler 2, resulting in flickering textures and
an angry simulator.

Fixes bad rendering in 0 A.D. and ETQW.  This was fixed for pre-gen7 by
28f4be9eb91b12a2c6b1db6660cca71a98c486ec

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=25201
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=58680
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
NOTE: This is a candidate for stable branches.

11 years agor600g: add support for red-alpha render targets
Marek Olšák [Wed, 13 Feb 2013 17:11:48 +0000 (18:11 +0100)]
r600g: add support for red-alpha render targets

11 years agor300g: add support for red-alpha render targets
Marek Olšák [Thu, 14 Feb 2013 13:59:01 +0000 (14:59 +0100)]
r300g: add support for red-alpha render targets

11 years agost/mesa: try to find exact format matching user format and type for DrawPixels
Marek Olšák [Tue, 12 Feb 2013 21:09:24 +0000 (22:09 +0100)]
st/mesa: try to find exact format matching user format and type for DrawPixels

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agor600g: properly implement S8Z24 depth-stencil format for Evergreen
Marek Olšák [Tue, 12 Feb 2013 22:09:44 +0000 (23:09 +0100)]
r600g: properly implement S8Z24 depth-stencil format for Evergreen

I should say "fix", but it has never been used until now.
S8Z24 is the format equivalent to the GL_UNSIGNED_INT_24_8 packing,
so we'll start to see it more often with st/mesa now making smart decisions
about formats.

The DB<->CB copy can change the channel ordering for transfers, other than
that, the internal DB format doesn't really matter.

R600-R700 support is possible except shadow mapping.
FMT_24_8 is broken if the SAMPLE_C instruction is used (no idea why).

Also the sampler swizzling was broken in theory and the fact it worked was
a lucky coincidence.

radeonsi might need to port this.

Reviewed-by: Jerome Glisse <jglisse@redhat.com>
11 years agoradeonsi: Handle TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS
Michel Dänzer [Tue, 12 Feb 2013 17:37:22 +0000 (18:37 +0100)]
radeonsi: Handle TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS

8 more little piglits.

NOTE: This is a candidate for the 9.1 branch.

11 years agoradeonsi: Fix array indices for detecting integer vertex formats
Michel Dänzer [Tue, 12 Feb 2013 16:49:36 +0000 (17:49 +0100)]
radeonsi: Fix array indices for detecting integer vertex formats

11 years agoglsl: Initialize ir_texture member variable.
Vinson Lee [Tue, 12 Feb 2013 06:35:01 +0000 (22:35 -0800)]
glsl: Initialize ir_texture member variable.

Fixes uninitialized pointer field defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agointel: Allow blit readpixels even when the pack alignment is set.
Eric Anholt [Thu, 7 Feb 2013 01:03:49 +0000 (17:03 -0800)]
intel: Allow blit readpixels even when the pack alignment is set.

The default alignment is 4, so this fast path was rarely hit.  Rather
than introduce logic to handle alignment, just use the Mesa core
function.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=46632
Cc: neil@linux.intel.com
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Remove writemask support from brw_SAMPLE().
Eric Anholt [Wed, 6 Feb 2013 00:21:07 +0000 (16:21 -0800)]
i965: Remove writemask support from brw_SAMPLE().

The code was rather broken for non-XYZW on 8-wide, but all of our
callers were using XYZW anyway.  For my experiments with using writemask
on texturing, I've been using manual header setup in the compiler
backends, since we want to actually know what registers are written for
optimization and register allocation.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965/fs: Use a helper function for checking for flow control instructions.
Eric Anholt [Tue, 5 Feb 2013 23:36:18 +0000 (15:36 -0800)]
i965/fs: Use a helper function for checking for flow control instructions.

In 2 of our checks, we were missing BREAK and CONTINUE.

NOTE: Candidate for the stable branches.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoshaderapi: Fix AttachShader error
bma [Tue, 12 Feb 2013 06:42:36 +0000 (08:42 +0200)]
shaderapi: Fix AttachShader error

Detect a duplicate Shader type as and error instead of silently allowing
it, restrict to ES2 API.

v2: Tapani Pälli <tapani.palli@intel.com>
    - make the check run time instead of compile time

v3: chadv
    - Quote spec on which error to generate.

Signed-off-by: bma <Bo.Ma@windriver.com>
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-and-tested-by: Chad Versace <chad.versace@linux.intel.com>
11 years agoconfigure.ac: Add components to LLVM_COMPONENTS when using llvm shared libs
Tom Stellard [Fri, 25 Jan 2013 15:43:11 +0000 (16:43 +0100)]
configure.ac: Add components to LLVM_COMPONENTS when using llvm shared libs

This is required when LLVM is built with CMake, which creates one
shared library for each component.

11 years agoi965: Re-enable the -RHW workaround for original gen4 chips.
Eric Anholt [Wed, 6 Feb 2013 23:22:45 +0000 (15:22 -0800)]
i965: Re-enable the -RHW workaround for original gen4 chips.

Fixes broken clipping in supertuxkart and presumably many other applications.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=51471
NOTE: Candidate for the stable branches.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965/gen4: Work around missing sRGB RGB DXT1 support.
Eric Anholt [Wed, 6 Feb 2013 01:39:35 +0000 (17:39 -0800)]
i965/gen4: Work around missing sRGB RGB DXT1 support.

The hardware just doesn't support it.  I suspect this was a regression from
the move to fixed MESA_FORMATs for compressed textures and that previously we
were storing uncompressed for this or something.

Fixes GPU hangs in piglit "texwrap GL_EXT_texture_sRGB-s3tc bordercolor
swizzled" on my GM965.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Fix error checking on "flat" keyword to match GLSL ES 3.00, GLSL 1.50.
Paul Berry [Sat, 9 Feb 2013 00:46:20 +0000 (16:46 -0800)]
glsl: Fix error checking on "flat" keyword to match GLSL ES 3.00, GLSL 1.50.

All of the GLSL specs from GLSL 1.30 (and GLSL ES 3.00) onward contain
language requiring certain integer variables to be declared with the
"flat" keyword, but they differ in exactly *when* the rule is
enforced:

(a) GLSL 1.30 and 1.40 say that vertex shader outputs having integral
type must be declared as "flat".  There is no restriction on fragment
shader inputs.

(b) GLSL 1.50 through 4.30 say that fragment shader inputs having
integral type must be declared as "flat".  There is no restriction on
vertex shader outputs.

(c) GLSL ES 3.00 says that both vertex shader outputs and fragment
shader inputs having integral type must be declared as "flat".

Previously, Mesa's behaviour was consistent with (a).  This patch
makes it consistent with (b) when compiling desktop shaders, and (c)
when compiling ES shaders.

Rationale for desktop shaders: once we add geometry shaders, (b) really
seems like the right choice, because it requires "flat" in just the
situations where it matters.  Since we may want to extend geometry
shader support back before GLSL 1.50 (via ARB_geometry_shader4), it
seems sensible to apply this rule to all GLSL versions.  Also, this
matches the behaviour of the nVidia proprietary driver for Linux, and
the expectations of Intel's oglconform test suite.

Rationale for ES shaders: since the behaviour specified in GLSL ES
3.00 matches neither pre-GLSL-1.50 nor post-GLSL-1.50 behaviour, it
seems likely that this was a deliberate choice on the part of the GLES
folks to be more restrictive.  Also, the argument in favor of (b)
doesn't apply to GLES, since it doesn't support geometry shaders at
all.

Some discussion about this has already happened on the Mesa-dev list.
See:

http://lists.freedesktop.org/archives/mesa-dev/2013-February/034199.html

Fixes piglit tests:
- glsl-1.30/compiler/interpolation-qualifiers/nonflat-*.frag
- glsl-1.30/compiler/interpolation-qualifiers/vs-flat-int-0{2,3,4,5}.vert
- glsl-es-3.00/compiler/interpolation-qualifiers/varying-struct-nonflat-{int,uint}.frag

Fixes oglconform tests:
- glsl-q-inperpol negative.fragin.{int,uint,ivec,uvec}

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
11 years agoglsl: don't allow non-flat integral types in varying structs/arrays.
Paul Berry [Thu, 7 Feb 2013 00:09:39 +0000 (16:09 -0800)]
glsl: don't allow non-flat integral types in varying structs/arrays.

In the GLSL 1.30 spec, section 4.3.6 ("Outputs") says:

    "If a vertex output is a signed or unsigned integer or integer
    vector, then it must be qualified with the interpolation qualifier
    flat."

The GLSL ES 3.00 spec further clarifies, in section 4.3.6 ("Output
Variables"):

    "Vertex shader outputs that are, *or contain*, signed or unsigned
    integers or integer vectors must be qualified with the
    interpolation qualifier flat."

(Emphasis mine.)

The language in the GLSL ES 3.00 spec is clearly correct and should be
applied to all shading language versions, since varyings that contain
ints can't be interpolated, regardless of which shading language
version is in use.

(Note that in GLSL 1.50 the restriction is changed to apply to
fragment shader inputs rather than vertex shader outputs, to
accommodate the fact that in the presence of geometry shaders, vertex
shader outputs are not necessarily interpolated.  That will be
addressed by a future patch).

NOTE: This is a candidate for stable branches.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
11 years agoglsl: Allow default precision qualifiers to be set for sampler types.
Paul Berry [Tue, 12 Feb 2013 20:36:41 +0000 (12:36 -0800)]
glsl: Allow default precision qualifiers to be set for sampler types.

From GLSL ES 3.00 section 4.5.4 ("Default Precision Qualifiers"):

    "The precision statement

        precision precision-qualifier type;

    can be used to establish a default precision qualifier. The type
    field can be either int or float or any of the sampler types, and
    the precision-qualifier can be lowp, mediump, or highp."

GLSL ES 1.00 has similar language.  GLSL 1.30 doesn't allow precision
qualifiers on sampler types, but this seems like an oversight (since
the intention of including these in GLSL 1.30 is to allow
compatibility with ES shaders).

Previously, Mesa followed GLSL 1.30 and only allowed default precision
qualifiers to be set for float and int.  This patch makes it follow
GLSL ES rules in all cases.

Fixes Piglit tests default-precision-sampler.{vert,frag}.

Partially addresses https://bugs.freedesktop.org/show_bug.cgi?id=60737.

NOTE: This is a candidate for stable branches.

Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agost/mesa: fix texture buffer objects
Marek Olšák [Tue, 12 Feb 2013 20:00:43 +0000 (21:00 +0100)]
st/mesa: fix texture buffer objects

Broken by 624528834f53f54c7a934f929769b7e6b230a0b1.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agoi965: Use derived state for Haswell's 3DSTATE_VF packet.
Kenneth Graunke [Mon, 11 Feb 2013 00:55:19 +0000 (16:55 -0800)]
i965: Use derived state for Haswell's 3DSTATE_VF packet.

Otherwise, we fail to correctly handle GL_PRIMITIVE_RESTART_FIXED_INDEX.

Fixes gles3conform's primitive_restart_mode test.

NOTE: This is a candidate for the 9.1 branch.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agost/mesa: accelerate glGetTexImage for all formats using a blit
Marek Olšák [Thu, 7 Feb 2013 03:36:33 +0000 (04:36 +0100)]
st/mesa: accelerate glGetTexImage for all formats using a blit

This commit allows using glGetTexImage during rendering and still
maintain interactive framerates.

This improves performance of WarCraft 3 under Wine. The framerate is improved
from 25 fps to 39 fps in the main menu, and from 0.5 fps to 32 fps in the game.

v2: fix choosing the format for decompression

11 years agogallium: add red-alpha texture formats and a couple of util functions
Marek Olšák [Thu, 7 Feb 2013 03:33:52 +0000 (04:33 +0100)]
gallium: add red-alpha texture formats and a couple of util functions

This is for glGetTexImage and it will be used for samplers only (which some
drivers already implement by reading util_format_description).

v2: incorporate Brian's suggestion

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agor600g: fix lockup when hyperz & alpha test are enabled together. v3
Jerome Glisse [Fri, 8 Feb 2013 21:02:32 +0000 (16:02 -0500)]
r600g: fix lockup when hyperz & alpha test are enabled together. v3

Seems that alpha test being enabled confuse the GPU on the order in
which it should perform the Z testing. So force the order programmed
throught db shader control.

v2: Only force z order when alpha test is enabled
v3: Update db shader when binding new dsa + spelling fix

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
11 years agoCopyTexImage: Don't check sRGB vs LINEAR for desktop GL
Jordan Justen [Mon, 11 Feb 2013 23:22:10 +0000 (15:22 -0800)]
CopyTexImage: Don't check sRGB vs LINEAR for desktop GL

In OpenGL 4.3, new language was added that would require
this check. But, if this check results in broken applications
then perhaps it will be reversed.

For now, remove this check and re-evaluate when
desktop GL 4.3 is closer.

NOTE: This is a candidate for the 9.1 branch.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
11 years agoradeonsi: remove constant index limitation v3
Christian König [Mon, 4 Feb 2013 16:55:32 +0000 (17:55 +0100)]
radeonsi: remove constant index limitation v3

With the llvm patches, fixing 14 piglit tests in total.

v2: increase the const limit
v3: document the const limit

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
11 years agoradeonsi: support constants as TEX coordinates
Christian König [Mon, 4 Feb 2013 16:46:42 +0000 (17:46 +0100)]
radeonsi: support constants as TEX coordinates

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
11 years agoglsl: Fix unsupported version error for GLSL ES 3.00, future proof for 3.30.
Paul Berry [Tue, 5 Feb 2013 23:07:26 +0000 (15:07 -0800)]
glsl: Fix unsupported version error for GLSL ES 3.00, future proof for 3.30.

When the user specifies an unsupported GLSL version,
_mesa_glsl_parse_state::process_version_directive() nicely gives them
an error message telling them which GLSL versions are supported.
Previous to this patch, the logic for determining whether a given
language version was supported was independent from the logic to
generate this error message string; as a result, we had a bug where
GLSL 3.00 would never be listed in the error message as an available
language version, even if it was really available.

To make matters worse, the code for generating the error message
string assumed that desktop GL versions were always separated by 0.10,
an assumption that will be wrong as soon as we support GLSL 3.30.

This patch fixes both problems by adding a table of supported GLSL
versions to _mesa_glsl_parse_state; this table is used both to
generate the error message and to check whether a given version is
supported.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agogallium/docs: fix typos in sample opcode descriptions
Roland Scheidegger [Tue, 12 Feb 2013 15:48:52 +0000 (16:48 +0100)]
gallium/docs: fix typos in sample opcode descriptions

11 years agonv50: fix bogus parameters when processing sample instructions
Roland Scheidegger [Tue, 12 Feb 2013 15:45:49 +0000 (16:45 +0100)]
nv50: fix bogus parameters when processing sample instructions

Discovered accidentally when changing SAMPLE_L definition.
Turns out the lod arguments were already correct for the new definition
but the compare and derivs were not.

Reviewed-by: Christoph Bumiller <e0425955@student.tuwien.ac.at>
11 years agogallium: fix tgsi SAMPLE_L opcode to use separate source for explicit lod
Roland Scheidegger [Tue, 12 Feb 2013 15:41:56 +0000 (16:41 +0100)]
gallium: fix tgsi SAMPLE_L opcode to use separate source for explicit lod

It looks like using coord.w as explicit lod value is a mistake, most likely
because some dx10 docs had it specified that way. Seems this was changed though:
http://msdn.microsoft.com/en-us/library/windows/desktop/hh447229%28v=vs.85%29.aspx
- let's just hope it doesn't depend on runtime build version or something.
Not only would this need translation (so go against the stated goal these
opcodes should be close to dx10 semantics) but it would prevent usage of this
opcode with cube arrays, which is apparently possible:
http://msdn.microsoft.com/en-us/library/windows/desktop/bb509699%28v=vs.85%29.aspx
(Note not only does this show cube arrays using explicit lod, but also the
confusion with this opcode: it lists an explicit lod parameter value, but then
states last component of location is used as lod).
(For "true" hw drivers, only nv50 had code to handle it, and it appears the
code was already right for the new semantics, though fix up the seemingly
wrong c/d arguments while there.)

v2: fix comment, separate out other changes.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agoutil: fix incorrect Z bit masking in util_clear_depth_stencil()
Brian Paul [Mon, 11 Feb 2013 23:39:42 +0000 (16:39 -0700)]
util: fix incorrect Z bit masking in util_clear_depth_stencil()

For PIPE_FORMAT_Z24_UNORM_S8_UINT, the Z bits are in the 24
least significant bits.

Fixes http://bugs.freedesktop.org/show_bug.cgi?id=60527
and http://bugs.freedesktop.org/show_bug.cgi?id=60524
and http://bugs.freedesktop.org/show_bug.cgi?id=60047

Note: This is a candidate for the stable branches.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agoradeon: Remove dead STANDALONE_MMIO defines
Matt Turner [Fri, 8 Feb 2013 01:21:22 +0000 (17:21 -0800)]
radeon: Remove dead STANDALONE_MMIO defines

These were, at some point in the past, used to request that Xorg's
compiler.h export a static inline xf86ReadMmio32 instead of a function
pointer. compiler.h only has this option for DEC Alpha.

But Xorg's compiler.h isn't being included by either of these two files
and the radeon driver still works on Alpha, so the definitions are dead
and not needed.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
11 years agollvmpipe: implement dual source blending
Roland Scheidegger [Tue, 12 Feb 2013 02:41:48 +0000 (03:41 +0100)]
llvmpipe: implement dual source blending

link up the fs outputs and blend inputs, and make sure the second blend source
is correctly loaded and converted (which is quite complex).
There's a slight refactoring of the monster generate_unswizzled_blend()
function where it makes sense to factor out alpha conversion (which needs
to run twice for dual source blend).
This passes piglit arb_blend_func_extended tests.

v2: remove new but ultimately not used function...

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agodocs: Mark a few things done in GL3.txt.
Kenneth Graunke [Mon, 11 Feb 2013 23:55:00 +0000 (15:55 -0800)]
docs: Mark a few things done in GL3.txt.

11 years agoi965: Add missing dirty bits to INTEL_DEBUG=state arrays.
Kenneth Graunke [Sun, 6 Jan 2013 01:16:41 +0000 (17:16 -0800)]
i965: Add missing dirty bits to INTEL_DEBUG=state arrays.

These are more recent additions, and no one remembered to update the
INTEL_DEBUG=state code.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965: Reorganize brw_bits to match the order in brw_context.h.
Kenneth Graunke [Sun, 6 Jan 2013 01:14:59 +0000 (17:14 -0800)]
i965: Reorganize brw_bits to match the order in brw_context.h.

This reorders the "brw_bits" array in brw_state_upload.c to match the
order of the #defines in brw_context.h.

Otherwise, it's really hard to see if any are missing.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965: Use BRW_NEW_CONTEXT for gen7_disable rather than BRW_NEW_BATCH.
Kenneth Graunke [Sun, 6 Jan 2013 01:20:01 +0000 (17:20 -0800)]
i965: Use BRW_NEW_CONTEXT for gen7_disable rather than BRW_NEW_BATCH.

These don't need to be re-disabled on every batch if we're using
hardware contexts.  (If we're not, this is equivalent.)

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agor600g: make sure async blit is done 8 * pitch at a time v2
Jerome Glisse [Wed, 6 Feb 2013 20:03:17 +0000 (15:03 -0500)]
r600g: make sure async blit is done 8 * pitch at a time v2

The blit must be aligned on 8 horizontal block.

v2: no need to align the reminder

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
11 years agowinsys/radeon: fix bo with virtual address referencing mismatch
Martin Andersson [Sat, 2 Feb 2013 16:55:07 +0000 (17:55 +0100)]
winsys/radeon: fix bo with virtual address referencing mismatch

If the same context try to flink and open the object, use the
same bo struct instead of opening a new gem handle for the object.
This way we avoid avoid having 2 different handle pointing to the
same kernel object which can latter lead to trouble with virtual
address.

Fix:
https://bugs.freedesktop.org/show_bug.cgi?id=60200

Signed-off-by: Martin Andersson <g02maran@gmail.com>
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
11 years agovbo: Merge GL_QUADS drawing requests in display lists.
Eric Anholt [Fri, 1 Feb 2013 03:49:21 +0000 (14:49 +1100)]
vbo: Merge GL_QUADS drawing requests in display lists.

minecraft apparently has its piles of display lists each contain 6
instances of glBegin(GL_QUADS)/verts/glEnd(), which appear in the
compiled list as 6 prims of 4 verts each in one draw call.  We can
reduce driver overhead even more by making that one prim of 24 verts.

Improves minecraft performance by 1.6% +/- .25% (n=446)

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
11 years agovbo: Print display list debug using printf() like dlist.c does.
Eric Anholt [Fri, 1 Feb 2013 01:10:18 +0000 (12:10 +1100)]
vbo: Print display list debug using printf() like dlist.c does.

Otherwise, the stderr and stdout debug end up interleaved wrong
when I pipe them to a file.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
11 years agoi965: Remove some stale comments about the brw_constant_buffer atom.
Eric Anholt [Thu, 24 Jan 2013 01:59:12 +0000 (17:59 -0800)]
i965: Remove some stale comments about the brw_constant_buffer atom.

These have been wrong since f428255bde93a452a7cdd48fba21839c99beb6cb
back in 2009!

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Simplify VS push constant upload code since removal of old path.
Eric Anholt [Thu, 24 Jan 2013 00:00:29 +0000 (16:00 -0800)]
i965: Simplify VS push constant upload code since removal of old path.

We used to have clip planes optionally included in the push constants,
resulting in a variable amount of data uploaded, but no more.  This also
means less wasted space in the batch for our push constants.

v2: Update _NEW_TRANSFORM state bit information.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
11 years agoi965: Add perf debug for a corner case.
Eric Anholt [Wed, 23 Jan 2013 23:26:36 +0000 (15:26 -0800)]
i965: Add perf debug for a corner case.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Fix access mode of index buffer rebase.
Eric Anholt [Wed, 23 Jan 2013 23:23:43 +0000 (15:23 -0800)]
i965: Fix access mode of index buffer rebase.

It doesn't matter with our current implementation of MapBufferRange,
but it was wrong -- the result pointer is read by intel_upload_data().

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Fix indentation of index buffer rebase code.
Eric Anholt [Wed, 23 Jan 2013 23:22:57 +0000 (15:22 -0800)]
i965: Fix indentation of index buffer rebase code.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agomesa: fix GetTexImage if mesa format and internal format don't match
Marek Olšák [Wed, 6 Feb 2013 21:39:53 +0000 (22:39 +0100)]
mesa: fix GetTexImage if mesa format and internal format don't match

Tested with softpipe only exposing RGBA formats.

NOTE: This is a candidate for the stable branches.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agomesa: don't use memcpy fast path for GetTexImage if base format is different
Marek Olšák [Wed, 6 Feb 2013 21:33:55 +0000 (22:33 +0100)]
mesa: don't use memcpy fast path for GetTexImage if base format is different

The Mesa format can be RGBA8888_REV, the format/type can be
GL_RGBA/GL_UNSIGNED_BYTE, but the actual texture internal format can be
LUMINANCE_ALPHA, INTENSITY, etc. Therefore we should look at the base
internal format as well.

NOTE: This is a candidate for the stable branches.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agomesa: don't use _mesa_base_tex_format for format parameter of GetTexImage
Marek Olšák [Wed, 6 Feb 2013 21:31:44 +0000 (22:31 +0100)]
mesa: don't use _mesa_base_tex_format for format parameter of GetTexImage

_mesa_base_tex_format doesn't accept GL_BGR and GL_ABGR_EXT, etc.

v2: add a (now hopefully complete) helper function to deal with this

NOTE: This is a candidate for the stable branches.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agomesa: adjust usage of swapBytes/littleEndian in format_matches_format_and_type
Marek Olšák [Tue, 29 Jan 2013 19:58:55 +0000 (20:58 +0100)]
mesa: adjust usage of swapBytes/littleEndian in format_matches_format_and_type

- swapBytes has no effect on 8-bit single-component formats
- GL_SHORT is in host byte order, so checking for littleEndian is unnecessary,
  I decided to make the change for single-component formats only

Based on suggestions from Michel Dänzer.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
11 years agomesa: remove per-format memcpy codepaths from texstore functions
Marek Olšák [Mon, 28 Jan 2013 20:47:47 +0000 (21:47 +0100)]
mesa: remove per-format memcpy codepaths from texstore functions

It's obsoleted by the common function _mesa_texstore_memcpy.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agomesa: implement common texstore memcpy function for all formats
Marek Olšák [Mon, 28 Jan 2013 20:18:02 +0000 (21:18 +0100)]
mesa: implement common texstore memcpy function for all formats

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agomesa: fill in Z32_FLOAT_X24S8 in _mesa_format_matches_format_and_type
Marek Olšák [Mon, 28 Jan 2013 20:13:18 +0000 (21:13 +0100)]
mesa: fill in Z32_FLOAT_X24S8 in _mesa_format_matches_format_and_type

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agomesa: fill in signed cases and RGBA16 in _mesa_format_matches_format_and_type
Marek Olšák [Mon, 28 Jan 2013 20:11:46 +0000 (21:11 +0100)]
mesa: fill in signed cases and RGBA16 in _mesa_format_matches_format_and_type

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
11 years agomesa: fill in INT/UINT format cases in _mesa_format_matches_format_and_type
Marek Olšák [Mon, 28 Jan 2013 20:08:35 +0000 (21:08 +0100)]
mesa: fill in INT/UINT format cases in _mesa_format_matches_format_and_type

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
11 years agomesa: fill in YCBCR cases in _mesa_format_matches_format_and_type
Marek Olšák [Mon, 28 Jan 2013 20:06:11 +0000 (21:06 +0100)]
mesa: fill in YCBCR cases in _mesa_format_matches_format_and_type

based on the texstore code

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
11 years agomesa: fill in SRGB cases in _mesa_format_matches_format_and_type
Marek Olšák [Mon, 28 Jan 2013 20:02:46 +0000 (21:02 +0100)]
mesa: fill in SRGB cases in _mesa_format_matches_format_and_type

Texstore takes the same codepath as the corresponding linear formats.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agollvmpipe: fix vertex_header mask store in big-endian
Adhemerval Zanella [Sun, 20 Jan 2013 17:42:16 +0000 (11:42 -0600)]
llvmpipe: fix vertex_header mask store in big-endian

This patch fixes the vertex_header mask bitfield store in big-endian
architectures by bit-swap the fields accordingly.

Reviewed-by: Adam Jackson <ajax@redhat.com>
11 years agollvmpipe: remove lp_swizzled_cbuf
Adhemerval Zanella [Mon, 21 Jan 2013 11:19:31 +0000 (05:19 -0600)]
llvmpipe: remove lp_swizzled_cbuf

Ununsed since 75da95c5.

Reviewed-by: Adam Jackson <ajax@redhat.com>
11 years agodocs: document removal of makedepend build dependency
Andreas Boll [Mon, 11 Feb 2013 09:38:11 +0000 (10:38 +0100)]
docs: document removal of makedepend build dependency

Build dependency removed with
424f2008814ed9047628c40ccd4258a8a9fd8299

Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agodocs: update making a new mesa release info
Andreas Boll [Wed, 30 Jan 2013 21:35:58 +0000 (22:35 +0100)]
docs: update making a new mesa release info

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agodocs: use proper title for index.html
Andreas Boll [Wed, 30 Jan 2013 21:35:54 +0000 (22:35 +0100)]
docs: use proper title for index.html

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agodocs: mention some other supported APIs
Andreas Boll [Wed, 30 Jan 2013 21:35:51 +0000 (22:35 +0100)]
docs: mention some other supported APIs

v2: add ES3

Reviewed-by: Brian Paul <brianp@vmware.com> (v1)
11 years agodocs: update sourcetree
Andreas Boll [Wed, 30 Jan 2013 21:35:43 +0000 (22:35 +0100)]
docs: update sourcetree

glsl directory is located in src and not in src/egl

v2: remove ppc, move glapi from src/mesa to src/mapi

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agodocs: replace CVS with git
Andreas Boll [Wed, 30 Jan 2013 21:35:35 +0000 (22:35 +0100)]
docs: replace CVS with git

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agoconfigure.ac: Do not check for rt on Mac OS X.
Vinson Lee [Sun, 27 Jan 2013 06:50:05 +0000 (22:50 -0800)]
configure.ac: Do not check for rt on Mac OS X.

There is no rt library on Mac OS X.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=58872
Acked-by: Matt Turner <mattst88@gmail.com>
11 years agointel: Do not expose OES_compressed_ETC1_RGB8_texture or ARB_texture_rgb10_a2ui pre...
Ian Romanick [Sat, 9 Feb 2013 02:03:33 +0000 (18:03 -0800)]
intel: Do not expose OES_compressed_ETC1_RGB8_texture or ARB_texture_rgb10_a2ui pre-GEN4

Older hardware cannot do ARB_texture_rgb10_a2ui, and the translation
code for OES_compressed_ETC1_RGB8_texture was never implemented in the
i915 driver.

NOTE: This is a candidate for all stable branches.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agosoftpipe: clean up lod computation
Roland Scheidegger [Sat, 9 Feb 2013 02:42:17 +0000 (18:42 -0800)]
softpipe: clean up lod computation

This should handle the new lod_zero modifier more correctly.
The runtime-conditional is a bit more complex however we now also do
scalar lod computation when appropriate which should more than make up for it.
The refactoring should also fix an issue with explicit lods
(lod clamp wasn't applied to them).
Also, always pass lod as the 5th element from tgsi executor, which simplifies
things (get rid of annoying conditionals later).

v2: based on Brian's feedback, use switch in a couple of places, fix up
some function parameter names, fix up comments.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agosoftpipe: try to beat new dx10-style sample opcodes into shape
Roland Scheidegger [Wed, 6 Feb 2013 02:48:55 +0000 (18:48 -0800)]
softpipe: try to beat new dx10-style sample opcodes into shape

There were several bugs how this was handled, most opcodes wouldn't even
have fetched the right arguments.
Also, the tex "target" is coming from the sampler view, hence it cannot
have information about shadow comparisons - fortunately this is not only
sampler state but also needs to have matching instruction, so just use this
instead to identify shadow comparisons.
Still untested (compiles...).
Note that sample_i and sviewinfo are still busted (just assert).
(The problem is that the interface for doing the opengl-equivalent functions
txf and txq is tied to the specific the sampler itself but these opcodes
have no sampler associated with them. Oops...)
Also, even the other sample instructions will not work correctly since
they always operate on samplers which include the texture state. Fixing
this wouldn't be that difficult but most likely make softpipe quite a bit
slower when using the OpenGL tex opcodes (as the samplers have pre-baked
function calls in the sampler state depending on texture state and that stuff
would need to be evaluated at runtime), so leave it for now.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agogallivm: fix up size queries for dx10 sviewinfo opcode
Roland Scheidegger [Tue, 5 Feb 2013 21:37:57 +0000 (13:37 -0800)]
gallivm: fix up size queries for dx10 sviewinfo opcode

Need to calculate the number of mip levels (if it would be worthwile could
store it in dynamic state).
While here, the query code also used chan 2 for the lod value.
This worked with mesa state tracker but it seems safer to use chan 0.
Still passes piglit textureSize (with some handwaving), though the non-GL
parts are (largely) untested.

v2: clarify and expect the sviewinfo opcode to return ints, not floats,
just like the OpenGL textureSize (dx10 supports dst modifiers with resinfo).
Also simplify some code.

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