Compare commits

...

97 Commits

Author SHA1 Message Date
Ian Romanick
796b4a7b40 mesa: Bump version to 9.2-rc1 2013-08-19 16:49:02 -07:00
Ian Romanick
d3004acdd1 glsl: Use alignment of container record for its first field
The first field of a record in a UBO has the aligment of the record
itself.

Fixes piglit vs-struct-pad, fs-struct-pad, and (with the patch posted to
the piglit list that extends the test) layout-std140.

NOTE: The bit of strangeness with the version of visit_field without the
record_type poitner is because that method is pure virtual in the base
class.  The original implementation of the class did this to ensure
derived classes remembered to implement that flavor.  Now they can
implement either flavor but not both.  I don't know a C++ way to enforce
that.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=68195
Cc: "9.2 9.1" mesa-stable@lists.freedesktop.org
(cherry picked from commit 574e4843e9)
2013-08-19 16:40:07 -07:00
Ian Romanick
684316512c glsl: Add new overload of program_resource_visitor::visit_field method
The outer-most record is passed into the visit_field method for
the first field.  In other words, in the following structure:

    struct S1 {
        vec4 v;
        float f;
    };

    struct S {
        S1 s1;
        S1 s2;
    };

    uniform Ubo {
        S s;
    };

s.s1.v would get record_type = S (because s1.v is the first non-record
field in S), and s.s2.v would get record_type = S1.  s.s1.f and s.s2.f
would get record_type = NULL becuase they aren't the first field of
anything.

This new overload isn't used yet, but the next patch will add several
uses.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Cc: "9.2 9.1" mesa-stable@lists.freedesktop.org
(cherry picked from commit 5ac884fd9f)
2013-08-19 16:40:03 -07:00
Ian Romanick
9f7f727345 glsl: Disallow embedded structure definitions
Continue to allow them in GLSL 1.10 because the spec allows it.
Generate an error in all other versions because the specs specifically
disallow it.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "9.2" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit d9bb8b7b56)
2013-08-19 16:39:59 -07:00
Ian Romanick
1fb22bf143 meta: Add default precision qualifier to all fragement shaders
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "9.2" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 5fb1dd51f3)
2013-08-19 16:39:55 -07:00
Ian Romanick
9fa7313e34 glsl: Add default precision qualifiers for ES builtins
Once the compiler proplerly checks for default precision qualifiers,
these shaders will cease to compile.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "9.2" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 5ac247a73e)
2013-08-19 16:39:52 -07:00
Marek Olšák
6296abed15 glsl: don't eliminate texcoords that can be set by GL_COORD_REPLACE
Tested by examining generated TGSI shaders from piglit/glsl-routing.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Henri Verbeet <hverbeet@gmail.com>
Tested-by: Henri Verbeet <hverbeet@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit d13003f544)
2013-08-19 16:39:48 -07:00
Ilia Mirkin
5b8c943eb2 nv50: allow non-nv12 buffers to be created, just pass them through to vl
Since we expose non-NV12 formats as supported when there is no decoer
profile selected, make sure that those formats are actually allowed to
be allocated.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Tested-by: Emil Velikov <emil.l.velikov@gmail.com>
Cc: "9.2" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit a8346a2f52)
2013-08-19 16:39:43 -07:00
Anuj Phogat
d72f7720a6 meta: Fix blitting a framebuffer with renderbuffer attachment
This patch fixes a case of framebuffer blitting with renderbuffer
as color attachment and GL_LINEAR filter. Meta implementation of
glBlitFrambuffer() converts source color buffer to a texture and
uses it to do the scaled blitting in to destination buffer. Using
the exact source rectangle to create the texture does incorrect
linear filtering along the edges. This patch makes the changes to
extend the texture edges by one pixel in x, y directions. This
ensures correct linear filtering.
It fixes failing piglit fbo-attachments-blit-scaled-linear test.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
CC: "9.2" <mesa-stable@lists.freedesktop.org>
CC: "9.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
(cherry picked from commit d944a6144f)
2013-08-16 12:36:38 -07:00
Ilia Mirkin
b40d9e4f41 nv30: remove no-longer-used formats from table
Commit 14ee790df7 removed the formats from the vtxfmt_table but forgot
to also update the info_table.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "9.2 and 9.1" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit c1a6f59b20)
2013-08-16 12:36:34 -07:00
Kenneth Graunke
e2185778e2 i965: Force X-tiling for 128 bpp formats on Sandybridge.
128 bpp formats are not allowed to be Y-tiled on any architectures
except Gen7.

+11 Piglits on Sandybridge (mostly regression fixes since the
switch to Y-tiling).

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=63867
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=64261
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Cc: "9.2" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit c189840b21)
2013-08-16 12:36:31 -07:00
Laurent Carlier
a98d5f2663 mesa/program: remove useless YYID
This fixes the build with Bison 3.0. Also works with Bison 2.7.1.

CC: "9.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 5ffa28df4e)
2013-08-16 12:15:39 -07:00
Ian Romanick
24d1949ddc mesa/vbo: Fix handling of attribute 0 in non-compatibilty contexts
It is only in OpenGL compatibility-style contexts where generic
attribute 0 and GL_VERTEX_ARRAY have a bizzare, aliasing relationship.
Moreover, it is only in OpenGL compatibility-style contexts and OpenGL
ES 1.x where one of these attributes provokes the vertex.  In all other
APIs each implicit call to glArrayElement provokes a vertex regardless
of which attributes are enabled.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Robert Bragg <robert@sixbynine.org>
Cc: "9.0 9.1 9.2" <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=55503
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=66292
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67548
(cherry picked from commit 41eef83cc0)
2013-08-15 15:16:45 -07:00
Vinson Lee
996bc26c87 i915,i965: Fix memory leak in try_pbo_upload (v2)
Fixes "Resource leak" defect reported by Coverity.
Tested on Haswell, no Piglit regressions.

v2: Apply to i965, not just i915. (chadv)

CC: "9.2, 9.1" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
(cherry picked from commit 035bf21983)
2013-08-15 15:16:45 -07:00
Michel Dänzer
b055c8689e radeonsi: Don't leave gaps between position exports from vertex shader
If the vertex shader exports clip distances but not point size, use
position exports 1/2 instead of 2/3 for the clip distances. Fixes
geometry corruption in that case.

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

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
(cherry picked from commit b00269aa58)
2013-08-15 15:16:44 -07:00
Roland Scheidegger
d6d0175203 llvmpipe: fix stencil bug if we have both stencil and depth tests
This is a very well hidden bug found by accident (only the fixed glean
tstencil2 test so far seems to hit it).
We must use new mask with combined s_pass values and orig_mask values
for zpass/zfail stencil ops, otherwise both the sfail op and one of
zpass/zfail op are applied (probably not hit in most tests because
some of the ops tend to be KEEP usually).

Note: this is a candidate for the 9.2 branch.

Reviewed-by: Zack Rusin <zackr@vmware.com>
(cherry picked from commit abdd32dcd5)
2013-08-15 15:16:44 -07:00
Ilia Mirkin
4ba5fd1052 nv30: U8_USCALED only works for size 4
See https://bugs.freedesktop.org/show_bug.cgi?id=61635 for a sample
program. Changing it to use a vec4 makes it work. Remove the unsupported
formats.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "9.2 and 9.1" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 14ee790df7)
2013-08-15 15:16:44 -07:00
Ian Romanick
872c09586c glsl: Emit better warnings for things that look like default precision statements
Previously we would emit a warning for empty declarations like

float;

We would also emit the same warning for things like

highp float;

However, this second case is most likely the application trying to set
the default precision.  This makes the compiler generate a stronger
warning with some suggestion of a fix.

It really seems like this should be an error.  I'll bet that 100% of the
time someone writes 'highp float;' the actually meant 'precision highp
float;'.  Alas, both AMD and NVIDIA accept this syntax, and the spec
doesn't explicitly forbid it.

This makes piglit's precision-05.vert generate the following warnings:

0:12(11): warning: empty declaration with precision qualifier, to set the default precision, use `precision lowp float;'
0:13(12): warning: empty declaration with precision qualifier, to set the default precision, use `precision mediump int;'

v2: Add { } around a one-line if body and fix a comment.  Suggested by
Ken.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "9.2" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 830f4df993)
2013-08-15 15:16:44 -07:00
Roland Scheidegger
4f44202aae 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>
2013-08-15 17:38:27 +02:00
Jon Severinsson
33b581f6f6 radeon/llvm: Add missing "%s" format string to fprintf.
This fixes a compilation warning with -Wformat-security.

CC: "9.2" <mesa-stable@lists.freedesktop.org>

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
(cherry picked from commit 9298f537a7)
2013-08-14 11:21:30 +02:00
Tapani Pälli
c088c24588 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>
(cherry picked from commit 8c211dd742)
2013-08-13 18:13:35 -07:00
Armin K
7d6dcb61cd gbm: Link to libwayland-drm if Wayland EGL platform is enabled
We were relying on libEGL to pull in libwayland-client symbols, but with
commit 2c2e64edab cleaned up the
symbol leak.

CC: "9.2" <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67962
Tested-by: Bryce Harrington <b.harrington@samsung.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
(cherry picked from commit f423eba46e)
2013-08-13 18:11:22 -07:00
Ian Romanick
8025bac852 glsl: Require function return type arrays be explicitly sized
Fixes piglit array-function-return-unsized.vert.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "9.2" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 1b35e33af4)
2013-08-13 17:57:39 -07:00
Ian Romanick
5d6dc93490 glsl: Move and refine test for unsized arrays in GLSL ES
GLSL ES does not allow unsized arrays, and GLSL ES 1.00 does not allow
array initializers.  However, GLSL ES 3.00 allows array initializers,
and the initializer can explicitly size the array.  The specification
even includes some examples of this:

    float x[] = float[2] (1.0, 2.0);     // declares an array of size 2
    float y[] = float[] (1.0, 2.0, 3.0); // declares an array of size 3

    float a[5];
    float b[] = a;

Move the unsized array check to after the initializer has been
processed.  If the array is still unsized, generate the error.  This
should have no effect in GLSL ES 1.00 because, as previously mentioned,
array initializers are not allowed.

Fixes piglit "glsl-es-3.00 compiler array-sized-by-initializer.vert".

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "9.1 9.2" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 42624b1c81)
2013-08-13 17:57:02 -07:00
Ian Romanick
31f582abd4 glx: Generate GLXBadDrawable when drawable is zero
Fixes piglit glx-query-drawable-GLXBadDrawable.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Cc: "9.2" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit d5aee174b8)
2013-08-13 17:54:29 -07:00
Ian Romanick
0b131ae24f mesa: Use _mesa_detach_renderbuffer when deleting a texture
The functional change is that now invalidate_framebuffer is called if
the texture is actually detached from one of the currently bound FBOs.
Previously this was only done for renderbuffers.

The remaining changes make the texture delete path look more similar to
the renderbuffer delete path.  This includes adding relevant spec
quotations to justify the behavior.

Fixes piglit fbo-incomplete "delete texture of bound FBO" test.

v2: Move 'fb->Attachment[i].Texture == att' check from previous patch to
this patch... where it was intended to be in the first place.  Noticed
by Chad.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Cc: "9.2" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit ef83bd2b95)
2013-08-13 17:54:24 -07:00
Ian Romanick
8ee4a4e417 mesa: Make detach_renderbuffer available outside fbobject.c
Also add a return value indicating whether any work was done.

This will be used by the next patch.

v2: Move 'fb->Attachment[i].Texture == att' check to the next
patch... where it was intended to be in the first place.  Noticed by
Chad.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Cc: "9.2" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 438cc6bc49)
2013-08-13 17:54:21 -07:00
Ian Romanick
0c405cd0e8 meta: Don't call _mesa_Ortho with width or height of 0
Fixes failures in oglconform fbo mipmap.manual.color,
mipmap.manual.colorAndDepth, mipmap.automatic, and
mipmap.manualIterateTexTargets subtests.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Cc: "9.2" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 341fb93c16)
2013-08-13 17:54:17 -07:00
Vadim Girlin
b76ff3dbcd r600g/sb: use MULADD workaround on R7xx for MULADD_IEEE
Looks like the same issue that was seen with MULADD in trans slot on
R7xx also affects MULADD_IEEE (maybe all OP3 instructions and MULADD is
just a most frequently used?). So the workaround is to not allow affected
instructions to be placed into the trans slot.

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=67927

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
Cc: "9.2" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 17bb96b03d)
2013-08-13 17:54:12 -07:00
Ian Romanick
cb8e109492 glsl: Don't allow const on out or inout function parameters
Fixes piglit tests const-inout-parameter.frag and
const-out-parameter.frag.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Cc: "9.2" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 5894898148)
2013-08-09 15:26:08 -07:00
Alex Deucher
4006fc4656 r600g: disable GPUVM by default
Cayman and trinity systems still seem to suffer from
stability problems with GPUVM.  This also fixes compute
on these asics.  It can still be enabled for testing
by setting env var RADEON_VA=true.

Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=65958

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
CC: "9.2" <mesa-stable@lists.freedesktop.org>
CC: "9.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Christian König <christian.koenig@amd.com>
(cherry picked from commit c88783047e)
2013-08-09 15:26:05 -07:00
Chad Versace
731a08341e egl: Do not export private symbols
libEGL was incorrectly exporting *all* symbols, public and private.
This patch adds -fvisibility=hidden to libEGL's linker flags to ensure
that only symbols annotated with __attribute__((visibility("default")))
get exported.

Sanity-checked with libEGL's builtin DRI2 driver and the i965 DRI driver
by running Piglit on X/EGL and by running weston-gears on Weston as an
X client.

Sanity-checked with libEGL's Gallium driver (which is not built-in) and
the swrast Gallium driver by running es2gears_x11.

Kristian reviewed the symbol diff in `nm libEGL.so`.

CC: "9.2" <mesa-stable@lists.freedesktop.org>
CC: Ian Romanick <idr@freedesktop.org>
Acked-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
(cherry picked from commit 2c2e64edab)
2013-08-09 15:26:00 -07:00
Kenneth Graunke
3da0c76ec0 i965: Remember to call intel_prepare_render() before blitting.
Otherwise, blits to the window system buffer may cause crashes,
since dst_irb->mt may be NULL.

This code is lifted straight out of brw_blorp_framebuffer()'s
try_blorp_blit() helper.

Fixes crashes in Piglit's fbo-sys-blit on systems without BLORP.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=65919
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <idr@freedesktop.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Cc: "9.2" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit fb3d62fe3d)
2013-08-09 15:25:56 -07:00
Tom Stellard
10ff10c89e r300g/compiler/tests: Pass the required LDFLAGS when building the test program
CC: "9.2 <mesa-stable@lists.freedesktop.org>"
(cherry picked from commit d0c13fba17)
2013-08-07 18:35:28 -07:00
Tom Stellard
12da1bcb3b r300g/compiler/tests: Fix segfault
CC: "9.2" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit d691ba4d94)
2013-08-07 18:35:21 -07:00
Emil Velikov
195e995968 nv50: handle pure integer vertex attributes
And as a side effect fix a crash in the following piglit test:
general/attribs GL3

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Cc: "9.2 and 9.1" mesa-stable@lists.freedesktop.org
(cherry picked from commit 07c8f7a6f8)
2013-08-06 19:53:33 -07:00
Ian Romanick
6f9b090719 mesa: Generate a renderbuffer wrapper even if the texture has no image
This prevents a segfault in check_begin_texture_render when an FBO is
rebound while in this state.  This fixes the piglit test
fbo-incomplete-invalid-texture.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "9.1 9.2" mesa-stable@lists.freedesktop.org
(cherry picked from commit 2f9fe2d80a)
2013-08-06 12:20:12 -07:00
Ian Romanick
70c9e07bd4 mesa: Validate the layer selection of an array texture too
Previously only the slice of a 3D texture was validated in the FBO
completeness check.  This fixes the failure in the 'invalid layer of an
array texture' subtest of piglit's fbo-incomplete test.

v2: 1D_ARRAY textures have Depth == 1.  Instead, compare against Height.

v3: Handle CUBE_MAP_ARRAY textures too.  Noticed by Marek.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "9.1 9.2" mesa-stable@lists.freedesktop.org
(cherry picked from commit 25281fef0f)
2013-08-06 12:20:08 -07:00
Ian Romanick
d383ff0843 mesa: Don't call driver RenderTexture for invalid zoffset
This fixes the segfault in the 'invalid slice of 3D texture' and
'invalid layer of an array texture' subtests of piglit's fbo-incomplete
test.

The 'invalid layer of an array texture' subtest still fails.

v2: Fix off-by-one comparison error noticed by Chris Forbes.  Also,
1D_ARRAY textures have Depth == 1.  Instead, compare against Height.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> [v1]
Cc: "9.1 9.2" mesa-stable@lists.freedesktop.org
(cherry picked from commit 41485fea7c)
2013-08-06 12:20:05 -07:00
Ian Romanick
d1419857d7 mesa: Don't call driver RenderTexture for really broken textures
This fixes the segfault in the '0x0 texture' subtest of piglit's
fbo-incomplete test.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "9.1 9.2" mesa-stable@lists.freedesktop.org
(cherry picked from commit fb49713f8e)
2013-08-06 12:20:01 -07:00
Ian Romanick
c15b2d86e2 mesa: Remove stray debug printfs in attachment completeness code
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "9.1 9.2" mesa-stable@lists.freedesktop.org
(cherry picked from commit 0c3dbd689b)
2013-08-06 12:19:58 -07:00
Ian Romanick
1e0ad955e7 mesa: Treat glBindFramebuffer and glBindFramebufferEXT more correctly
Allow user-generated names for glBindFramebufferEXT on desktop GL.
Disallow its use altogether for core profiles.

Names bound with glBindFramebuffer in desktop OpenGL are still
(incorrectly) shared across the share group instead of being
per-context.  This gets us a bit closer to being strictly conformant.

v2: Disallow glBindFramebufferEXT in 3.1 by not installing it in the
dispatch table.  Suggested by Jordan.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> [v1]
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> [v1]
Cc: mesa-stable@lists.freedesktop.org
(cherry picked from commit 4a9522a5a0)
2013-08-06 12:19:55 -07:00
Ian Romanick
9aeb967e75 mesa: Treat glBindRenderbuffer and glBindRenderbufferEXT correctly
Allow user-generated names for glBindRenderbufferEXT on desktop GL.
Disallow its use altogether for core profiles.

v2: Disallow glBindRenderbufferEXT in 3.1 by not installing it in the
dispatch table.  Suggested by Jordan.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> [v1]
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> [v1]
Cc: mesa-stable@lists.freedesktop.org
(cherry picked from commit 97965e87fc)
2013-08-06 12:19:40 -07:00
Ian Romanick
001c29cb18 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>
(cherry picked from commit b55c1638ad)
2013-08-06 09:44:17 -07:00
Matt Turner
c331562158 Makefile.am: Remove api_exec_es* from EXTRA_FILES.
These files were removed in commits a0102154 and a8ab7e33.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Andreas Boll <andreas.boll.dev@gmail.com>
2013-08-06 09:38:38 -07:00
Marek Olšák
8e1d37161f st/dri: add a new driconf option disable_shader_bit_encoding for Unigine
Now Unigine Heaven 3.0 finally works with r600g.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 7568a89500)
2013-08-06 09:26:08 -07:00
Marek Olšák
78e760c234 mesa,glsl,st/dri: add a new driconf option force_glsl_version for Unigine
See documentation in mtypes.h.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit 0f6a7cb00c)
2013-08-06 09:26:01 -07:00
Marek Olšák
71891ce017 driconf: enable app-specific workarounds for all drivers
They were only enabled for i965.

Note that drirc must be installed in /etc.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit 7f2f804c75)
2013-08-06 09:25:54 -07:00
Marek Olšák
a19bc84380 st/dri: remove more unused driconf options
vblank_mode is read by dri_util.c and falls under the "dri2" driver name,
which is not connected to the actual Mesa/Gallium driver in any way.

Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 772070527f)
2013-08-06 09:25:48 -07:00
Marek Olšák
73bde3b8ff st/dri: implement the driconf option force_s3tc_enable properly
Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 83dbe61ea4)
2013-08-06 09:25:43 -07:00
Marek Olšák
4a37827752 driconf: remove the unused option allow_large_textures
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit f27f3a4b15)
2013-08-06 09:25:36 -07:00
Marek Olšák
adc87c5e3f st/dri: support the driconf option disable_blend_func_extended
This is needed for Unigine.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 2acc27cc6d)
2013-08-06 09:25:27 -07:00
Marek Olšák
4d7ebeb51e st/osmesa: initialize disable_glsl_line_continuations
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 71e0b5d688)
2013-08-06 09:25:16 -07:00
Michel Dänzer
6d8f471640 radeonsi: Number of SGPRs retrieved from LLVM already includes VCC
Fixes spurious 'Assertion `num_sgprs <= 104' failed.' with shaders using
all 104 SGPRs.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Christian König <christian.koenig@amd.com>
(cherry picked from commit 46b6f79fea)
2013-08-06 09:22:28 -07:00
Andreas Boll
687415cf70 docs: Document UVD (2.2 and 3.0) video decoding support in mesa 9.2
Cc: "9.2" mesa-stable@lists.freedesktop.org
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 9d569fed8d)
2013-08-05 17:25:56 -07:00
Andreas Boll
e4f81bdbc4 docs: Document that i965 Gen6+ requires Kernel 3.6 or later
Cc: "9.2" mesa-stable@lists.freedesktop.org
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit ec4a6a94b1)
2013-08-05 17:25:53 -07:00
Samuel Pitoiset
6c25c0a0da nvc0: properly align NVE4_COMPUTE_MP_TEMP_SIZE
MP_TEMP_SIZE must be aligned to 0x8000, while TEMP_SIZE on NVE4_3D
must be aligned to 0x20000, so perform both alignments to be sure
we allocate enough space (actually the bo will most likely use 128
KiB pages and not aligning to that would be a waste anyway).

Cc: "9.2" mesa-stable@lists.freedesktop.org
(cherry picked from commit ef6d5ee9f3)
2013-08-05 17:25:51 -07:00
Kenneth Graunke
526e71bfcc mesa/program: Switch from the deprecated YYLEX_PARAM to %lex-param.
YYLEX_PARAM is no longer supported as of Bison 3.0.  Instead, the Bison
developers recommend using %lex-param.

%lex-param takes a type and variable name, similar to %parse-param,
so you can't pass an arbitrary expression like state->scanner.  But Flex
insists on passing the actual scanner object, not an arbitrary object
like state.

To solve this, the parser defines a wrapper lex() function which accepts
"state," and calls Flex's lex() function with state->scanner.

Fixes the build with Bison 3.0.  Also works with Bison 2.7.1.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67354
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Tested-by: Laurent Carlier <lordheavym@gmail.com>
Cc: "9.2" mesa-stable@lists.freedesktop.org
(cherry picked from commit 6d2a9220b8)
2013-08-05 17:25:48 -07:00
Kenneth Graunke
06aee8a56c mesa/program: Change the program parser's namespace.
Bison 3.0 removes the YYLEX_PARAM macro.  In preparation for handling
this using %lex-param, the parser needs a wrapper function for the
actual Flex lex() function.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67354
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Tested-by: Laurent Carlier <lordheavym@gmail.com>
Cc: "9.2" mesa-stable@lists.freedesktop.org
(cherry picked from commit de917b4c4c)
2013-08-05 17:25:45 -07:00
Kenneth Graunke
b319e3975e glsl: Switch from the deprecated YYLEX_PARAM to %lex-param.
YYLEX_PARAM is no longer supported as of Bison 3.0.  Instead, the Bison
developers recommend using %lex-param.

%lex-param takes a type and variable name, similar to %parse-param,
so you can't pass an arbitrary expression like state->scanner.  But Flex
insists on passing the actual scanner object, not an arbitrary object
like state.

To solve this, the parser defines a wrapper lex() function which accepts
"state," and calls Flex's lex() function with state->scanner.

Fixes the build with Bison 3.0.  Also works with Bison 2.7.1.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67354
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Tested-by: Laurent Carlier <lordheavym@gmail.com>
Cc: "9.2" mesa-stable@lists.freedesktop.org
(cherry picked from commit f043381334)
2013-08-05 17:25:42 -07:00
Kenneth Graunke
d4c2c5a739 glsl: Change the lexer's namespace.
Bison 3.0 removes the YYLEX_PARAM macro.  In preparation for handling
this using %lex-param, the parser needs a wrapper function for the
actual Flex lex() function.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67354
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Tested-by: Laurent Carlier <lordheavym@gmail.com>
Cc: "9.2" mesa-stable@lists.freedesktop.org
(cherry picked from commit eb7c8c7fb6)
2013-08-05 17:25:40 -07:00
Eric Anholt
a3f48d97cd egl: Restore "bogus" DRI2 invalidate event code.
I had removed it in commit 1e7776ca2b
because it was obviously wrong -- why do we care whether the server is a
version that emits events, if we're not watching for the server's events,
anyway?  And why would you only invalidate on a server that emits
invalidate events, when the comment said to emit invalidates if the server
*doesn't*?  Only, I missed that we otherwise don't flag that our buffers
might have changed at swap time at all, so the driver was only checking
for new buffers when triggered by the Viewport hack.  Of course you don't
expect Viewport to be called after a swap.

So, this is effectively a revert of the previous commit, except that I
dropped the check for only emitting invalidates on a new server -- we
*always* need to invalidate if we're doing a SwapBuffers.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=63435
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "9.1 and 9.2" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit eed0a80137)
2013-08-05 17:07:15 -07:00
Mikko Juola
030ada7a50 mesa: fix multisampling proxy textures not being queryable
The code that checks if some texture target is valid for
glGetTexLevelParameter*() was not programmed to check for multisampling
proxy textures.  This made it impossible(?) to use the proxy textures
for their intended purpose as glGetTexLevelParameter*() would just fail
on you.

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

Cc: mesa-stable@lists.freedesktop.org
(cherry picked from commit 8624a514c2)
2013-08-05 17:07:11 -07:00
Mikko Juola
b61036fa2d mesa: fix proxy textures becoming immutable and unusable
glTexStorage*() functions make textures immutable.  This carries on to
proxy textures.  Error checking in texture storage functions prevents
proxy textures from working after first time because internally, they
became immutable.

This commit makes the error checking ignore the immutability flag when
working with proxy textures.

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

Cc: mesa-stable@lists.freedesktop.org
(cherry picked from commit e404105e7d)
2013-08-05 17:07:06 -07:00
Mikko Juola
ddf6f591a9 mesa: fix proxy textures not working with default texture binding
When working with the glTexStorage*() functions, the error checking
checks that a non-default (i.e., non-zero) texture is currently bound.
However, this check made glTexStorage*() functions fail with proxy
textures when the default texture is bound. Proxy textures do not care
about the current texture bindings so for them this check should not
be done.

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

Cc: mesa-stable@lists.freedesktop.org
(cherry picked from commit 3f3f66fd94)
2013-08-05 17:07:03 -07:00
Mikko Juola
e3dbfc5769 mesa: fix number of mipmaps calculation for proxy textures
The function _mesa_get_tex_max_num_levels() is supposed to calculate
the number of mipmap levels but it was not written to handle proxy
textures, at best returning a maximum of 1 mipmap level. Because of
this, at least glTexStorage*() calls would incorrectly fail when used
with proxy textures with more than one mipmap level.

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

Cc: mesa-stable@lists.freedesktop.org
(cherry picked from commit de7e3741eb)
2013-08-05 17:06:59 -07:00
Brian Paul
cdcba2878a mesa: improve free() cleanup in generate_mipmap_compressed()
Free all our temporary buffers in one place at the end of the
function.  Fixes memory leak detected by Coverity.

Note: This is a candidate for the 9.x branches
Cc: mesa-stable@lists.freedesktop.org

Reviewed-by: José Fonseca <jfonseca@vmware.com>
(cherry picked from commit e5f32a0b3a)
2013-08-05 16:58:05 -07:00
Chris Forbes
8efee44c38 i965/vs: Put lod parameter in the correct place for Gen4
This was never visible before due to the bogus sampler state pointer.
Fixes remaining vertex texturing breakage on Gen4.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: mesa-stable@lists.freedesktop.org
(cherry picked from commit cace82b0cd)
2013-08-05 16:58:01 -07:00
Chris Forbes
3bdd95270d i965/vs: set up sampler state pointer for Gen4/5.
Fixes broken filter and lod selection for vertex texturing.
(txs/txf only worked properly because they ignore the sampler state
completely)

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: mesa-stable@lists.freedesktop.org
(cherry picked from commit 97676032c2)
2013-08-05 16:57:57 -07:00
Marek Olšák
5476049e38 st/mesa: fix opcode translation for ARB_shader_bit_encoding functions
We treat the opcodes as MOVs, but we should at least change the type
of the expression, which later affects which TGSI opcode is chosen.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 369c829152)
2013-08-05 16:57:53 -07:00
Marek Olšák
a2dbaeb2d8 gallium/postprocessing: convert blits to pipe->blit
PP saves current states to cso_context and then util_blit_pixels does
the same. cso_context doesn't like that and the original state is not
correctly restored.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 4c89ec1f69)
2013-08-05 16:57:49 -07:00
Marek Olšák
ded1695494 gallium/postprocessing: fix shader parsing
tokens was converted to a pointer, which made the Elements macro return 1.

Broken by e87fc11cac.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit c84e8d039e)
2013-08-05 16:57:46 -07:00
Marek Olšák
3213c60d81 mesa: default texture buffer format should be R8 in the core profile
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>

v2: Since we don't expose the extension in the compatibility profile,
    the "if (API == CORE) .. else .." statement is removed.
(cherry picked from commit 7db83d8d4b)
2013-08-05 15:41:14 -07:00
Marek Olšák
678ac190a5 mesa: default DEPTH_TEXTURE_MODE should be RED in the core profile
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit a6b1a7c0d2)
2013-08-05 15:41:14 -07:00
Marek Olšák
771b576da6 st/mesa: fix sRGB renderbuffers without EXT_framebuffer_sRGB support
https://bugs.freedesktop.org/show_bug.cgi?id=59322

Cc: mesa-stable@lists.freedesktop.org
(cherry picked from commit 1302c66896)
2013-08-05 15:41:14 -07:00
Marek Olšák
9c66a29358 Revert "r300g: Give CLIP_DISABLE another try"
This reverts commit e866bd1ade.

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

Cc: mesa-stable@lists.freedesktop.org
(cherry picked from commit 4dfe1a0df5)
2013-08-05 15:41:14 -07:00
Ian Romanick
5154c93fa8 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
(cherry picked from commit 803f755ede)
2013-08-05 15:41:14 -07:00
Kenneth Graunke
8a27c824ec 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
(cherry picked from commit 17856726c9)
2013-08-05 15:41:14 -07:00
Kenneth Graunke
4953bf3837 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
(cherry picked from commit c178ec0d7e)
2013-08-05 15:41:14 -07:00
Chris Forbes
c7bfe87721 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>
(cherry picked from commit 124f567f1d)
2013-08-05 15:41:14 -07:00
Dave Airlie
c6f6b4e161 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>
(cherry picked from commit 19338157c9)
2013-08-05 15:41:14 -07:00
Kenneth Graunke
4f5e18cb3e Revert "i965: Delete pre-DRI2.3 viewport hacks."
This reverts commit c9db037dc9.

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
(cherry picked from commit 0e9549e2bd)
2013-08-05 15:41:13 -07:00
Paul Berry
e108bb07a0 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>
(cherry picked from commit a5eecb246d)
2013-08-05 15:41:13 -07:00
Brian Paul
55241e9958 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>
(cherry picked from commit 8a9df7a370)
2013-08-05 15:41:13 -07:00
Brian Paul
6237090330 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>
(cherry picked from commit 484fa87984)
2013-08-05 15:41:13 -07:00
Brian Paul
55ab069e5f 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>
(cherry picked from commit 2931bcb0d2)
2013-08-05 15:41:13 -07:00
Francisco Jerez
925e8a200b clover: Respect kernel argument alignment restrictions.
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
(cherry picked from commit df530829f7)
2013-08-05 15:41:13 -07:00
Francisco Jerez
014b9ceb62 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>
(cherry picked from commit f64c0ca692)
2013-08-05 15:41:13 -07:00
Francisco Jerez
8f80e55002 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>
(cherry picked from commit 829caf410e)
2013-08-05 15:41:13 -07:00
Francisco Jerez
579eae3012 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>
(cherry picked from commit 2265b40e37)
2013-08-05 15:41:13 -07:00
Francisco Jerez
cb06c9b2aa 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>
(cherry picked from commit a3dcab43c6)
2013-08-05 15:41:13 -07:00
Tom Stellard
253a4c3e73 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>
(cherry picked from commit 8c9d3c62f6)
2013-08-05 15:41:13 -07:00
Tom Stellard
99666d81e4 gallium: Add PIPE_CAP_ENDIANNESS
Cc: mesa-stable@lists.freedesktop.org
[ Francisco Jerez: Fix "PIPE_ENDIAN_SMALL" in the documentation,
  define PIPE_ENDIAN_NATIVE. ]
(cherry picked from commit 4e90bc9a12)
2013-08-05 15:41:12 -07:00
Maarten Lankhorst
e8bc520713 nvc0: force use of correct firmware file
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
(cherry picked from commit e847b5ae06)
2013-08-03 12:54:41 +02:00
Ilia Mirkin
49f40ebefa nv50: fix some h264 interlaced decoding on vp2
Some videos specify mb_adaptive_frame_field_flag instead of
field_pic_flag. This implies that the pic height needs to be halved, and
this field needs to be passed to the VP engine.

Cc: "9.2" mesa-stable@lists.freedesktop.org

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
(cherry picked from commit 8edb79f1ef)
2013-08-03 12:54:20 +02:00
Christoph Bumiller
9b8ad64362 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.
2013-07-25 15:55:21 +02:00
Jeremy Huddleston Sequoia
ee421aec32 Apple: glFlush() is not needed with CGLFlushDrawable()
<rdar://problem/14496373>

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit fa5ed99d8e)
2013-07-20 11:48:44 -07:00
128 changed files with 1424 additions and 599 deletions

View File

@@ -35,7 +35,7 @@ LOCAL_C_INCLUDES += \
# define ANDROID_VERSION (e.g., 4.0.x => 0x0400)
LOCAL_CFLAGS += \
-DPACKAGE_VERSION=\"9.2.0-devel\" \
-DPACKAGE_VERSION=\"9.2.0-rc1\" \
-DPACKAGE_BUGREPORT=\"https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa\" \
-DANDROID_VERSION=0x0$(MESA_ANDROID_MAJOR_VERSION)0$(MESA_ANDROID_MINOR_VERSION)

View File

@@ -57,12 +57,6 @@ EXTRA_FILES = \
src/glsl/glcpp/glcpp-lex.c \
src/glsl/glcpp/glcpp-parse.c \
src/glsl/glcpp/glcpp-parse.h \
src/mesa/main/api_exec_es1.c \
src/mesa/main/api_exec_es1_dispatch.h \
src/mesa/main/api_exec_es1_remap_helper.h \
src/mesa/main/api_exec_es2.c \
src/mesa/main/api_exec_es2_dispatch.h \
src/mesa/main/api_exec_es2_remap_helper.h \
src/mesa/program/lex.yy.c \
src/mesa/program/program_parse.tab.c \
src/mesa/program/program_parse.tab.h \

View File

@@ -70,7 +70,7 @@ if env['gles']:
# Environment setup
env.Append(CPPDEFINES = [
('PACKAGE_VERSION', '\\"9.2.0-devel\\"'),
('PACKAGE_VERSION', '\\"9.2.0-rc1\\"'),
('PACKAGE_BUGREPORT', '\\"https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa\\"'),
])

View File

@@ -6,7 +6,7 @@ dnl Tell the user about autoconf.html in the --help output
m4_divert_once([HELP_END], [
See docs/autoconf.html for more details on the options for Mesa.])
AC_INIT([Mesa], [9.2.0-devel],
AC_INIT([Mesa], [9.2.0-rc1],
[https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa])
AC_CONFIG_AUX_DIR([bin])
AC_CONFIG_MACRO_DIR([m4])

View File

@@ -52,6 +52,7 @@ Note: some of the new features are only available with certain drivers.
<li>Added new freedreno gallium driver</li>
<li>OSMesa interface for gallium llvmpipe/softpipe drivers</li>
<li>Gallium Heads-Up Display (HUD) feature for performance monitoring</li>
<li>Added support for UVD (2.2 and 3.0) video decoding on r600g and radeonsi through VDPAU (requires Kernel 3.10 or later)</li>
</ul>
@@ -70,7 +71,8 @@ Note: some of the new features are only available with certain drivers.
the (unsupported) GDI driver.</li>
<li>GL_EXT_separate_shader_objects has been removed from all Gallium drivers,
because it disallows a critical GLSL shader optimization.
GL_ARB_separate_shader_objects doesn't have this issue.
GL_ARB_separate_shader_objects doesn't have this issue.</li>
<li>i965 Gen6+ requires Kernel 3.6 or later. (92d2f5a)</li>
</ul>
</div>

View File

@@ -29,6 +29,10 @@ if HAVE_DRI_GLX
SUBDIRS += glx
endif
if HAVE_EGL_PLATFORM_WAYLAND
SUBDIRS += egl/wayland
endif
if HAVE_GBM
SUBDIRS += gbm
endif

View File

@@ -21,8 +21,4 @@
SUBDIRS=
if HAVE_EGL_PLATFORM_WAYLAND
SUBDIRS += wayland
endif
SUBDIRS += drivers main

View File

@@ -28,6 +28,7 @@ AM_CFLAGS = \
-I$(top_srcdir)/src/egl/wayland/wayland-drm \
-I$(top_builddir)/src/egl/wayland/wayland-drm \
$(DEFINES) \
$(VISIBILITY_CFLAGS) \
$(LIBDRM_CFLAGS) \
$(LIBUDEV_CFLAGS) \
$(LIBKMS_CFLAGS) \

View File

@@ -743,6 +743,20 @@ dri2_swap_buffers_msc(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw,
free(reply);
}
/* Since we aren't watching for the server's invalidate events like we're
* supposed to (due to XCB providing no mechanism for filtering the events
* the way xlib does), and SwapBuffers is a common cause of invalidate
* events, just shove one down to the driver, even though we haven't told
* the driver that we're the kind of loader that provides reliable
* invalidate events. This causes the driver to request buffers again at
* its next draw, so that we get the correct buffers if a pageflip
* happened. The driver should still be using the viewport hack to catch
* window resizes.
*/
if (dri2_dpy->flush &&
dri2_dpy->flush->base.version >= 3 && dri2_dpy->flush->invalidate)
(*dri2_dpy->flush->invalidate)(dri2_surf->dri_drawable);
return swap_count;
}

View File

@@ -22,6 +22,7 @@
AM_CFLAGS = \
-I$(top_srcdir)/include \
-I$(top_srcdir)/src/egl/main \
$(VISIBILITY_CFLAGS) \
$(X11_CFLAGS) \
$(DEFINES)

View File

@@ -29,6 +29,7 @@ AM_CFLAGS = \
-I$(top_srcdir)/include \
-I$(top_srcdir)/src/gbm/main \
$(DEFINES) \
$(VISIBILITY_CFLAGS) \
$(EGL_CFLAGS) \
-D_EGL_NATIVE_PLATFORM=$(EGL_NATIVE_PLATFORM) \
-D_EGL_DRIVER_SEARCH_DIR=\"$(EGL_DRIVER_INSTALL_DIR)\" \

View File

@@ -1,6 +1,7 @@
AM_CFLAGS = -I$(top_srcdir)/src/egl/main \
-I$(top_srcdir)/include \
$(DEFINES) \
$(VISIBILITY_CFLAGS) \
$(WAYLAND_CFLAGS)
noinst_LTLIBRARIES = libwayland-drm.la

View File

@@ -2,6 +2,7 @@ pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = wayland-egl.pc
AM_CFLAGS = $(DEFINES) \
$(VISIBILITY_CFLAGS) \
$(WAYLAND_CFLAGS)
lib_LTLIBRARIES = libwayland-egl.la

View File

@@ -58,7 +58,7 @@ draw_get_option_use_llvm(void)
#ifdef PIPE_ARCH_X86
util_cpu_detect();
/* require SSE2 due to LLVM PR6960. */
/* require SSE2 due to LLVM PR6960. XXX Might be fixed by now? */
if (!util_cpu_caps.has_sse2)
value = FALSE;
#endif
@@ -78,6 +78,9 @@ draw_create_context(struct pipe_context *pipe, boolean try_llvm)
if (draw == NULL)
goto err_out;
/* we need correct cpu caps for disabling denorms in draw_vbo() */
util_cpu_detect();
#if HAVE_LLVM
if (try_llvm && draw_get_option_use_llvm()) {
draw->llvm = draw_llvm_create(draw);

View File

@@ -77,6 +77,14 @@ void pp_debug(const char *, ...);
struct program *pp_init_prog(struct pp_queue_t *, struct pipe_context *pipe,
struct cso_context *);
void pp_init_fbos(struct pp_queue_t *, unsigned int, unsigned int);
void pp_blit(struct pipe_context *pipe,
struct pipe_resource *src_tex,
int srcX0, int srcY0,
int srcX1, int srcY1,
int srcZ0,
struct pipe_surface *dst,
int dstX0, int dstY0,
int dstX1, int dstY1);
/* The filters */

View File

@@ -31,7 +31,6 @@
#include "pipe/p_screen.h"
#include "util/u_inlines.h"
#include "util/u_blit.h"
#include "util/u_math.h"
#include "util/u_debug.h"
#include "util/u_memory.h"
@@ -111,13 +110,6 @@ pp_init(struct pipe_context *pipe, const unsigned int *enabled,
}
}
ppq->p->blitctx = util_create_blit(ppq->p->pipe, cso);
if (ppq->p->blitctx == NULL) {
pp_debug("Unable to create a blit context.\n");
goto error;
}
ppq->n_filters = curpos;
ppq->n_tmp = (curpos > 2 ? 2 : 1);
ppq->n_inner_tmp = tmp_req;
@@ -180,11 +172,6 @@ pp_free(struct pp_queue_t *ppq)
pp_free_fbos(ppq);
if (ppq && ppq->p) {
/* Only destroy created contexts. */
if (ppq->p->blitctx) {
util_destroy_blit(ppq->p->blitctx);
}
if (ppq->p->pipe && ppq->filters && ppq->shaders) {
for (i = 0; i < ppq->n_filters; i++) {
unsigned int filter = ppq->filters[i];

View File

@@ -43,7 +43,6 @@
#include "postprocess/postprocess.h"
#include "postprocess/pp_mlaa.h"
#include "postprocess/pp_filters.h"
#include "util/u_blit.h"
#include "util/u_box.h"
#include "util/u_sampler.h"
#include "util/u_inlines.h"
@@ -191,10 +190,9 @@ pp_jimenezmlaa_run(struct pp_queue_t *ppq, struct pipe_resource *in,
pp_filter_set_fb(p);
/* Blit the input to the output */
util_blit_pixels(p->blitctx, in, 0, 0, 0,
w, h, 0, p->framebuffer.cbufs[0],
0, 0, w, h, 0, PIPE_TEX_MIPFILTER_NEAREST,
TGSI_WRITEMASK_XYZW, 0);
pp_blit(p->pipe, in, 0, 0,
w, h, 0, p->framebuffer.cbufs[0],
0, 0, w, h);
u_sampler_view_default_template(&v_tmp, in, in->format);
arr[0] = p->pipe->create_sampler_view(p->pipe, in, &v_tmp);

View File

@@ -56,8 +56,6 @@ struct program
struct pipe_resource *vbuf;
struct pipe_surface surf;
struct pipe_sampler_view *view;
struct blit_state *blitctx;
};

View File

@@ -28,12 +28,50 @@
#include "postprocess.h"
#include "postprocess/pp_filters.h"
#include "util/u_blit.h"
#include "util/u_inlines.h"
#include "util/u_sampler.h"
#include "tgsi/tgsi_parse.h"
void
pp_blit(struct pipe_context *pipe,
struct pipe_resource *src_tex,
int srcX0, int srcY0,
int srcX1, int srcY1,
int srcZ0,
struct pipe_surface *dst,
int dstX0, int dstY0,
int dstX1, int dstY1)
{
struct pipe_blit_info blit;
memset(&blit, 0, sizeof(blit));
blit.src.resource = src_tex;
blit.src.level = 0;
blit.src.format = src_tex->format;
blit.src.box.x = srcX0;
blit.src.box.y = srcY0;
blit.src.box.z = srcZ0;
blit.src.box.width = srcX1 - srcX0;
blit.src.box.height = srcY1 - srcY0;
blit.src.box.depth = 1;
blit.dst.resource = dst->texture;
blit.dst.level = dst->u.tex.level;
blit.dst.format = dst->format;
blit.dst.box.x = dstX0;
blit.dst.box.y = dstY0;
blit.dst.box.z = 0;
blit.dst.box.width = dstX1 - dstX0;
blit.dst.box.height = dstY1 - dstY0;
blit.dst.box.depth = 1;
blit.mask = PIPE_MASK_RGBA;
pipe->blit(pipe, &blit);
}
/**
* Main run function of the PP queue. Called on swapbuffers/flush.
*
@@ -66,10 +104,10 @@ pp_run(struct pp_queue_t *ppq, struct pipe_resource *in,
unsigned int w = ppq->p->framebuffer.width;
unsigned int h = ppq->p->framebuffer.height;
util_blit_pixels(ppq->p->blitctx, in, 0, 0, 0,
w, h, 0, ppq->tmps[0],
0, 0, w, h, 0, PIPE_TEX_MIPFILTER_NEAREST,
TGSI_WRITEMASK_XYZW, 0);
pp_blit(ppq->p->pipe, in, 0, 0,
w, h, 0, ppq->tmps[0],
0, 0, w, h);
in = ppq->tmp[0];
}
@@ -218,8 +256,8 @@ pp_tgsi_to_state(struct pipe_context *pipe, const char *text, bool isvs,
return NULL;
}
if (tgsi_text_translate(text, tokens, Elements(tokens)) == FALSE) {
pp_debug("Failed to translate %s\n", name);
if (tgsi_text_translate(text, tokens, PP_MAX_TOKENS) == FALSE) {
_debug_printf("pp: Failed to translate a shader for %s\n", name);
return NULL;
}

View File

@@ -111,7 +111,6 @@ util_format_s3tc_init(void)
util_dl_proc fetch_2d_texel_rgba_dxt3;
util_dl_proc fetch_2d_texel_rgba_dxt5;
util_dl_proc tx_compress_dxtn;
char *force_s3tc_enable;
if (!first_time)
return;
@@ -122,15 +121,8 @@ util_format_s3tc_init(void)
library = util_dl_open(DXTN_LIBNAME);
if (!library) {
if ((force_s3tc_enable = getenv("force_s3tc_enable")) &&
!strcmp(force_s3tc_enable, "true")) {
debug_printf("couldn't open " DXTN_LIBNAME ", enabling DXTn due to "
"force_s3tc_enable=true environment variable\n");
util_format_s3tc_enabled = TRUE;
} else {
debug_printf("couldn't open " DXTN_LIBNAME ", software DXTn "
"compression/decompression unavailable\n");
}
debug_printf("couldn't open " DXTN_LIBNAME ", software DXTn "
"compression/decompression unavailable\n");
return;
}

View File

@@ -32,8 +32,10 @@
#include <fcntl.h>
#include <X11/Xlib-xcb.h>
#include <X11/extensions/dri2tokens.h>
#include <xcb/dri2.h>
#include <xf86drm.h>
#include <errno.h>
#include "pipe/p_screen.h"
#include "pipe/p_context.h"
@@ -305,6 +307,7 @@ vl_screen_create(Display *display, int screen)
xcb_generic_error_t *error = NULL;
char *device_name;
int fd, device_name_length;
unsigned int driverType;
drm_magic_t magic;
@@ -332,7 +335,22 @@ vl_screen_create(Display *display, int screen)
s = xcb_setup_roots_iterator(xcb_get_setup(scrn->conn));
while (screen--)
xcb_screen_next(&s);
connect_cookie = xcb_dri2_connect_unchecked(scrn->conn, s.data->root, XCB_DRI2_DRIVER_TYPE_DRI);
driverType = XCB_DRI2_DRIVER_TYPE_DRI;
#ifdef DRI2DriverPrimeShift
{
char *prime = getenv("DRI_PRIME");
if (prime) {
unsigned int primeid;
errno = 0;
primeid = strtoul(prime, NULL, 0);
if (errno == 0)
driverType |=
((primeid & DRI2DriverPrimeMask) << DRI2DriverPrimeShift);
}
}
#endif
connect_cookie = xcb_dri2_connect_unchecked(scrn->conn, s.data->root, driverType);
connect = xcb_dri2_connect_reply(scrn->conn, connect_cookie, NULL);
if (connect == NULL || connect->driver_name_length + connect->device_name_length == 0)
goto free_screen;

View File

@@ -168,6 +168,8 @@ The integer capabilities:
since they are linked) a driver can support. Returning 0 is equivalent
to returning 1 because every driver has to support at least a single
viewport/scissor combination.
* ''PIPE_CAP_ENDIANNESS``:: The endianness of the device. Either
PIPE_ENDIAN_BIG or PIPE_ENDIAN_LITTLE.
.. _pipe_capf:

View File

@@ -227,6 +227,9 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_MAX_TEXEL_OFFSET:
return 7;
case PIPE_CAP_ENDIANNESS:
return PIPE_ENDIAN_LITTLE;
default:
DBG("unknown param %d", param);
return 0;

View File

@@ -263,6 +263,8 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap)
case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT:
case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER:
return 0;
case PIPE_CAP_ENDIANNESS:
return PIPE_ENDIAN_LITTLE;
default:
debug_printf("%s: Unknown cap %u.\n", __FUNCTION__, cap);

View File

@@ -421,6 +421,8 @@ ilo_get_param(struct pipe_screen *screen, enum pipe_cap param)
return 1 << 27;
case PIPE_CAP_MAX_VIEWPORTS:
return ILO_MAX_VIEWPORTS;
case PIPE_CAP_ENDIANNESS:
return PIPE_ENDIAN_LITTLE;
default:
return 0;

View File

@@ -836,7 +836,7 @@ lp_build_depth_stencil_test(struct gallivm_state *gallivm,
LLVMValueRef stencil_vals = NULL;
LLVMValueRef z_bitmask = NULL, stencil_shift = NULL;
LLVMValueRef z_pass = NULL, s_pass_mask = NULL;
LLVMValueRef orig_mask = lp_build_mask_value(mask);
LLVMValueRef current_mask = lp_build_mask_value(mask);
LLVMValueRef front_facing = NULL;
boolean have_z, have_s;
@@ -984,7 +984,7 @@ lp_build_depth_stencil_test(struct gallivm_state *gallivm,
/* apply stencil-fail operator */
{
LLVMValueRef s_fail_mask = lp_build_andnot(&s_bld, orig_mask, s_pass_mask);
LLVMValueRef s_fail_mask = lp_build_andnot(&s_bld, current_mask, s_pass_mask);
stencil_vals = lp_build_stencil_op(&s_bld, stencil, S_FAIL_OP,
stencil_refs, stencil_vals,
s_fail_mask, front_facing);
@@ -1032,6 +1032,11 @@ lp_build_depth_stencil_test(struct gallivm_state *gallivm,
/* compare src Z to dst Z, returning 'pass' mask */
z_pass = lp_build_cmp(&z_bld, depth->func, z_src, z_dst);
/* mask off bits that failed stencil test */
if (s_pass_mask) {
current_mask = LLVMBuildAnd(builder, current_mask, s_pass_mask, "");
}
if (!stencil[0].enabled) {
/* We can potentially skip all remaining operations here, but only
* if stencil is disabled because we still need to update the stencil
@@ -1041,25 +1046,19 @@ lp_build_depth_stencil_test(struct gallivm_state *gallivm,
if (do_branch) {
lp_build_mask_check(mask);
do_branch = FALSE;
}
}
if (depth->writemask) {
LLVMValueRef zselectmask;
LLVMValueRef z_pass_mask;
/* mask off bits that failed Z test */
zselectmask = LLVMBuildAnd(builder, orig_mask, z_pass, "");
/* mask off bits that failed stencil test */
if (s_pass_mask) {
zselectmask = LLVMBuildAnd(builder, zselectmask, s_pass_mask, "");
}
z_pass_mask = LLVMBuildAnd(builder, current_mask, z_pass, "");
/* Mix the old and new Z buffer values.
* z_dst[i] = zselectmask[i] ? z_src[i] : z_dst[i]
*/
z_dst = lp_build_select(&z_bld, zselectmask, z_src, z_dst);
z_dst = lp_build_select(&z_bld, z_pass_mask, z_src, z_dst);
}
if (stencil[0].enabled) {
@@ -1067,13 +1066,13 @@ lp_build_depth_stencil_test(struct gallivm_state *gallivm,
LLVMValueRef z_fail_mask, z_pass_mask;
/* apply Z-fail operator */
z_fail_mask = lp_build_andnot(&s_bld, orig_mask, z_pass);
z_fail_mask = lp_build_andnot(&s_bld, current_mask, z_pass);
stencil_vals = lp_build_stencil_op(&s_bld, stencil, Z_FAIL_OP,
stencil_refs, stencil_vals,
z_fail_mask, front_facing);
/* apply Z-pass operator */
z_pass_mask = LLVMBuildAnd(builder, orig_mask, z_pass, "");
z_pass_mask = LLVMBuildAnd(builder, current_mask, z_pass, "");
stencil_vals = lp_build_stencil_op(&s_bld, stencil, Z_PASS_OP,
stencil_refs, stencil_vals,
z_pass_mask, front_facing);
@@ -1083,7 +1082,7 @@ lp_build_depth_stencil_test(struct gallivm_state *gallivm,
/* No depth test: apply Z-pass operator to stencil buffer values which
* passed the stencil test.
*/
s_pass_mask = LLVMBuildAnd(builder, orig_mask, s_pass_mask, "");
s_pass_mask = LLVMBuildAnd(builder, current_mask, s_pass_mask, "");
stencil_vals = lp_build_stencil_op(&s_bld, stencil, Z_PASS_OP,
stencil_refs, stencil_vals,
s_pass_mask, front_facing);

View File

@@ -231,6 +231,8 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
return 0;
case PIPE_CAP_MAX_VIEWPORTS:
return PIPE_MAX_VIEWPORTS;
case PIPE_CAP_ENDIANNESS:
return PIPE_ENDIAN_NATIVE;
}
/* should only get here on unhandled cases */
debug_printf("Unexpected PIPE_CAP %d query\n", param);

View File

@@ -111,9 +111,6 @@ nv30_format_info_table[PIPE_FORMAT_COUNT] = {
_(R16G16_SNORM , __V_),
_(R16G16B16_SNORM , __V_),
_(R16G16B16A16_SNORM , __V_),
_(R8_USCALED , __V_),
_(R8G8_USCALED , __V_),
_(R8G8B8_USCALED , __V_),
_(R8G8B8A8_USCALED , __V_),
_(R16_FLOAT , __V_),
_(R16G16_FLOAT , __V_), //S_V_),
@@ -160,9 +157,6 @@ nv30_vtxfmt_table[PIPE_FORMAT_COUNT] = {
_(R8G8_UNORM , U8_UNORM , 2),
_(R8G8B8_UNORM , U8_UNORM , 3),
_(R8G8B8A8_UNORM , U8_UNORM , 4),
_(R8_USCALED , U8_USCALED , 1),
_(R8G8_USCALED , U8_USCALED , 2),
_(R8G8B8_USCALED , U8_USCALED , 3),
_(R8G8B8A8_USCALED , U8_USCALED , 4),
_(R16_SNORM , V16_SNORM , 1),
_(R16G16_SNORM , V16_SNORM , 2),

View File

@@ -130,6 +130,8 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY:
case PIPE_CAP_PREFER_BLIT_BASED_TEXTURE_TRANSFER:
return 1;
case PIPE_CAP_ENDIANNESS:
return PIPE_ENDIAN_LITTLE;
default:
debug_printf("unknown param %d\n", param);
return 0;

View File

@@ -40,13 +40,15 @@ nv30_emit_vtxattr(struct nv30_context *nv30, struct pipe_vertex_buffer *vb,
const unsigned nc = util_format_get_nr_components(ve->src_format);
struct nouveau_pushbuf *push = nv30->base.pushbuf;
struct nv04_resource *res = nv04_resource(vb->buffer);
const struct util_format_description *desc =
util_format_description(ve->src_format);
const void *data;
float v[4];
data = nouveau_resource_map_offset(&nv30->base, res, vb->buffer_offset +
ve->src_offset, NOUVEAU_BO_RD);
util_format_read_4f(ve->src_format, v, 0, data, 0, 0, 0, 1, 1);
desc->unpack_rgba_float(v, 0, data, 0, 1, 1);
switch (nc) {
case 4:

View File

@@ -189,6 +189,8 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
return 0;
case PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK:
return PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_NV50;
case PIPE_CAP_ENDIANNESS:
return PIPE_ENDIAN_LITTLE;
default:
NOUVEAU_ERR("unknown PIPE_CAP %d\n", param);
return 0;

View File

@@ -40,7 +40,7 @@ struct nv50_constbuf {
const uint8_t *data;
} u;
uint32_t size; /* max 65536 */
uint16_t offset;
uint32_t offset;
boolean user; /* should only be TRUE if u.data is valid and non-NULL */
};

View File

@@ -140,10 +140,20 @@ nv50_emit_vtxattr(struct nv50_context *nv50, struct pipe_vertex_buffer *vb,
const void *data = (const uint8_t *)vb->user_buffer + ve->src_offset;
float v[4];
const unsigned nc = util_format_get_nr_components(ve->src_format);
const struct util_format_description *desc =
util_format_description(ve->src_format);
assert(vb->user_buffer);
util_format_read_4f(ve->src_format, v, 0, data, 0, 0, 0, 1, 1);
if (desc->channel[0].pure_integer) {
if (desc->channel[0].type == UTIL_FORMAT_TYPE_SIGNED) {
desc->unpack_rgba_sint((int32_t *)v, 0, data, 0, 1, 1);
} else {
desc->unpack_rgba_uint((uint32_t *)v, 0, data, 0, 1, 1);
}
} else {
desc->unpack_rgba_float(v, 0, data, 0, 1, 1);
}
switch (nc) {
case 4:

View File

@@ -624,17 +624,13 @@ nv84_video_buffer_create(struct pipe_context *pipe,
union nouveau_bo_config cfg;
unsigned bo_size;
if (getenv("XVMC_VL"))
if (getenv("XVMC_VL") || template->buffer_format != PIPE_FORMAT_NV12)
return vl_video_buffer_create(pipe, template);
if (!template->interlaced) {
debug_printf("Require interlaced video buffers\n");
return NULL;
}
if (template->buffer_format != PIPE_FORMAT_NV12) {
debug_printf("Must use NV12 format\n");
return NULL;
}
if (template->chroma_format != PIPE_VIDEO_CHROMA_FORMAT_420) {
debug_printf("Must use 4:2:0 format\n");
return NULL;

View File

@@ -136,12 +136,11 @@ nv84_decoder_bsp(struct nv84_decoder *dec,
params.iseqparm.chroma_format_idc = 1;
params.iseqparm.pic_width_in_mbs_minus1 = mb(dec->base.width) - 1;
if (desc->field_pic_flag)
if (desc->field_pic_flag || desc->mb_adaptive_frame_field_flag)
params.iseqparm.pic_height_in_map_units_minus1 = mb_half(dec->base.height) - 1;
else
params.iseqparm.pic_height_in_map_units_minus1 = mb(dec->base.height) - 1;
/* TODO: interlaced still doesn't work, maybe due to ref frame management. */
if (desc->bottom_field_flag)
params.ipicparm.curr_pic_order_cnt = desc->field_order_cnt[1];
else

View File

@@ -39,10 +39,10 @@ struct h264_iparm1 {
uint32_t h1; // 1fc
uint32_t h2; // 200
uint32_t h3; // 204
uint32_t unk208;
uint32_t field_pic_flag;
uint32_t format;
uint32_t unk214;
uint32_t mb_adaptive_frame_field_flag; // 208
uint32_t field_pic_flag; // 20c
uint32_t format; // 210
uint32_t unk214; // 214
};
struct h264_iparm2 {
@@ -56,7 +56,7 @@ struct h264_iparm2 {
uint32_t h2; // 1c
uint32_t h3; // 20
uint32_t unk24;
uint32_t unk28;
uint32_t mb_adaptive_frame_field_flag; // 28
uint32_t top; // 2c
uint32_t bottom; // 30
uint32_t is_reference; // 34
@@ -100,6 +100,7 @@ nv84_decoder_vp_h264(struct nv84_decoder *dec,
param1.height = param1.h2 = height;
param1.h1 = param1.h3 = align(height, 32);
param1.format = 0x3231564e; /* 'NV12' */
param1.mb_adaptive_frame_field_flag = desc->mb_adaptive_frame_field_flag;
param1.field_pic_flag = desc->field_pic_flag;
param2.width = width;
@@ -115,6 +116,7 @@ nv84_decoder_vp_h264(struct nv84_decoder *dec,
param2.top = desc->bottom_field_flag ? 2 : 1;
param2.bottom = desc->bottom_field_flag;
}
param2.mb_adaptive_frame_field_flag = desc->mb_adaptive_frame_field_flag;
param2.is_reference = desc->is_reference;
PUSH_SPACE(push, 5 + 16 + 3 + 2 + 6 + (is_ref ? 2 : 0) + 3 + 2 + 4 + 2);

View File

@@ -179,6 +179,8 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
return 1;
case PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK:
return PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_NV50;
case PIPE_CAP_ENDIANNESS:
return PIPE_ENDIAN_LITTLE;
default:
NOUVEAU_ERR("unknown PIPE_CAP %d\n", param);
return 0;
@@ -510,6 +512,7 @@ nvc0_screen_resize_tls_area(struct nvc0_screen *screen,
}
size *= (screen->base.device->chipset >= 0xe0) ? 64 : 48; /* max warps */
size = align(size, 0x8000);
size *= screen->mp_count;
size = align(size, 1 << 17);

View File

@@ -38,7 +38,7 @@ struct nvc0_constbuf {
const void *data;
} u;
uint32_t size;
uint16_t offset;
uint32_t offset;
boolean user; /* should only be TRUE if u.data is valid and non-NULL */
};

View File

@@ -153,7 +153,7 @@ static void nvc0_video_getpath(enum pipe_video_profile profile, char *path)
break;
}
case PIPE_VIDEO_CODEC_VC1: {
sprintf(path, "/lib/firmware/nouveau/vuc-vc1-%u", profile - PIPE_VIDEO_PROFILE_VC1_SIMPLE);
sprintf(path, "/lib/firmware/nouveau/vuc-vc1-0");
break;
}
case PIPE_VIDEO_CODEC_MPEG4_AVC: {

View File

@@ -78,11 +78,11 @@ nve4_screen_compute_setup(struct nvc0_screen *screen,
*/
BEGIN_NVC0(push, NVE4_COMPUTE(MP_TEMP_SIZE_HIGH(0)), 3);
PUSH_DATAh(push, screen->tls->size / screen->mp_count);
PUSH_DATA (push, screen->tls->size / screen->mp_count);
PUSH_DATA (push, (screen->tls->size / screen->mp_count) & ~0x7fff);
PUSH_DATA (push, 0xff);
BEGIN_NVC0(push, NVE4_COMPUTE(MP_TEMP_SIZE_HIGH(1)), 3);
PUSH_DATAh(push, screen->tls->size / screen->mp_count);
PUSH_DATA (push, screen->tls->size / screen->mp_count);
PUSH_DATA (push, (screen->tls->size / screen->mp_count) & ~0x7fff);
PUSH_DATA (push, 0xff);
/* Unified address space ? Who needs that ? Certainly not OpenCL.

View File

@@ -18,7 +18,8 @@ AM_CFLAGS = \
$(RADEON_CFLAGS)
r300_compiler_tests_LDADD = libr300.la libr300-helper.la \
$(top_builddir)/src/gallium/auxiliary/libgallium.la
$(top_builddir)/src/gallium/auxiliary/libgallium.la \
$(GALLIUM_DRI_LIB_DEPS)
r300_compiler_tests_CPPFLAGS = \
-I$(top_srcdir)/src/gallium/drivers/r300/compiler
r300_compiler_tests_SOURCES = \

View File

@@ -80,7 +80,7 @@ static void test_runner_rc_optimize(struct test_result * result)
unsigned radeon_compiler_optimize_run_tests()
{
struct test tests[] = {
static struct test tests[] = {
{"rc_optimize() => peephole_mul_omod()", test_runner_rc_optimize},
{NULL, NULL}
};

View File

@@ -91,8 +91,8 @@ static void tex_1d_swizzle(struct test_result *result)
unsigned radeon_compiler_regalloc_run_tests()
{
struct test tests[] = {
{"rc_pair_regalloc() => TEX 1D Swizzle - r300", tex_1d_swizzle},
static struct test tests[] = {
{"rc_pair_regalloc() => TEX 1D Swizzle - r300", tex_1d_swizzle },
{NULL, NULL}
};
return run_tests(tests);

View File

@@ -96,7 +96,7 @@ static void test_runner_rc_inst_can_use_presub(struct test_result * result)
unsigned radeon_compiler_util_run_tests()
{
struct test tests[] = {
static struct test tests[] = {
{"rc_inst_can_use_presub()", test_runner_rc_inst_can_use_presub},
{NULL, NULL}
};

View File

@@ -104,7 +104,6 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
case PIPE_CAP_TGSI_CAN_COMPACT_CONSTANTS:
case PIPE_CAP_USER_INDEX_BUFFERS:
case PIPE_CAP_USER_CONSTANT_BUFFERS:
case PIPE_CAP_DEPTH_CLIP_DISABLE: /* XXX implemented, but breaks Regnum Online */
case PIPE_CAP_PREFER_BLIT_BASED_TEXTURE_TRANSFER:
return 1;
@@ -138,6 +137,7 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
case PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS:
case PIPE_CAP_INDEP_BLEND_ENABLE:
case PIPE_CAP_INDEP_BLEND_FUNC:
case PIPE_CAP_DEPTH_CLIP_DISABLE:
case PIPE_CAP_SHADER_STENCIL_EXPORT:
case PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS:
case PIPE_CAP_TGSI_INSTANCEID:
@@ -190,6 +190,8 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
/* Render targets. */
case PIPE_CAP_MAX_RENDER_TARGETS:
return 4;
case PIPE_CAP_ENDIANNESS:
return PIPE_ENDIAN_LITTLE;
}
return 0;
}

View File

@@ -1333,8 +1333,7 @@ static void* r300_create_rs_state(struct pipe_context* pipe,
if (r300_screen(pipe->screen)->caps.has_tcl) {
vap_clip_cntl = (state->clip_plane_enable & 63) |
R300_PS_UCP_MODE_CLIP_AS_TRIFAN |
(state->depth_clip ? 0 : R300_CLIP_DISABLE);
R300_PS_UCP_MODE_CLIP_AS_TRIFAN;
} else {
vap_clip_cntl = R300_CLIP_DISABLE;
}

View File

@@ -679,6 +679,8 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
case PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK:
return PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_R600;
case PIPE_CAP_ENDIANNESS:
return PIPE_ENDIAN_LITTLE;
}
return 0;
}

View File

@@ -1490,7 +1490,8 @@ unsigned post_scheduler::try_add_instruction(node *n) {
// FIXME workaround for some problems with MULADD in trans slot on r700,
// (is it really needed on r600?)
if (a->bc.op == ALU_OP3_MULADD && !ctx.is_egcm()) {
if ((a->bc.op == ALU_OP3_MULADD || a->bc.op == ALU_OP3_MULADD_IEEE) &&
!ctx.is_egcm()) {
allowed_slots &= 0x0F;
}

View File

@@ -124,7 +124,7 @@ unsigned radeon_llvm_compile(LLVMModuleRef M, struct radeon_llvm_binary *binary,
r = LLVMTargetMachineEmitToMemoryBuffer(tm, M, LLVMObjectFile, &err,
&out_buffer);
if (r) {
fprintf(stderr, err);
fprintf(stderr, "%s", err);
FREE(err);
return 1;
}

View File

@@ -440,6 +440,8 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
case PIPE_CAP_MAX_TEXEL_OFFSET:
return 7;
case PIPE_CAP_ENDIANNESS:
return PIPE_ENDIAN_LITTLE;
}
return 0;
}

View File

@@ -562,12 +562,11 @@ static void si_alpha_test(struct lp_build_tgsi_context *bld_base,
}
static void si_llvm_emit_clipvertex(struct lp_build_tgsi_context * bld_base,
unsigned index)
LLVMValueRef (*pos)[9], unsigned index)
{
struct si_shader_context *si_shader_ctx = si_shader_context(bld_base);
struct lp_build_context *base = &bld_base->base;
struct lp_build_context *uint = &si_shader_ctx->radeon_bld.soa.bld_base.uint_bld;
LLVMValueRef args[9];
unsigned reg_index;
unsigned chan;
unsigned const_chan;
@@ -582,6 +581,8 @@ static void si_llvm_emit_clipvertex(struct lp_build_tgsi_context * bld_base,
}
for (reg_index = 0; reg_index < 2; reg_index ++) {
LLVMValueRef *args = pos[2 + reg_index];
args[5] =
args[6] =
args[7] =
@@ -612,10 +613,6 @@ static void si_llvm_emit_clipvertex(struct lp_build_tgsi_context * bld_base,
args[3] = lp_build_const_int32(base->gallivm,
V_008DFC_SQ_EXP_POS + 2 + reg_index);
args[4] = uint->zero;
lp_build_intrinsic(base->gallivm->builder,
"llvm.SI.export",
LLVMVoidTypeInContext(base->gallivm->context),
args, 9);
}
}
@@ -630,17 +627,18 @@ static void si_llvm_emit_epilogue(struct lp_build_tgsi_context * bld_base)
struct tgsi_parse_context *parse = &si_shader_ctx->parse;
LLVMValueRef args[9];
LLVMValueRef last_args[9] = { 0 };
LLVMValueRef pos_args[4][9] = { { 0 } };
unsigned semantic_name;
unsigned color_count = 0;
unsigned param_count = 0;
int depth_index = -1, stencil_index = -1;
int i;
while (!tgsi_parse_end_of_tokens(parse)) {
struct tgsi_full_declaration *d =
&parse->FullToken.FullDeclaration;
unsigned target;
unsigned index;
int i;
tgsi_parse_token(parse);
@@ -716,7 +714,7 @@ handle_semantic:
target = V_008DFC_SQ_EXP_POS + 2 + d->Semantic.Index;
break;
case TGSI_SEMANTIC_CLIPVERTEX:
si_llvm_emit_clipvertex(bld_base, index);
si_llvm_emit_clipvertex(bld_base, pos_args, index);
shader->clip_dist_write = 0xFF;
continue;
case TGSI_SEMANTIC_FOG:
@@ -734,9 +732,13 @@ handle_semantic:
si_llvm_init_export_args(bld_base, d, index, target, args);
if (si_shader_ctx->type == TGSI_PROCESSOR_VERTEX ?
(semantic_name == TGSI_SEMANTIC_POSITION) :
(semantic_name == TGSI_SEMANTIC_COLOR)) {
if (si_shader_ctx->type == TGSI_PROCESSOR_VERTEX &&
target >= V_008DFC_SQ_EXP_POS &&
target <= (V_008DFC_SQ_EXP_POS + 3)) {
memcpy(pos_args[target - V_008DFC_SQ_EXP_POS],
args, sizeof(args));
} else if (si_shader_ctx->type == TGSI_PROCESSOR_FRAGMENT &&
semantic_name == TGSI_SEMANTIC_COLOR) {
if (last_args[0]) {
lp_build_intrinsic(base->gallivm->builder,
"llvm.SI.export",
@@ -806,66 +808,87 @@ handle_semantic:
memcpy(last_args, args, sizeof(args));
}
if (!last_args[0]) {
assert(si_shader_ctx->type == TGSI_PROCESSOR_FRAGMENT);
if (si_shader_ctx->type == TGSI_PROCESSOR_VERTEX) {
unsigned pos_idx = 0;
/* Specify which components to enable */
last_args[0] = lp_build_const_int32(base->gallivm, 0x0);
for (i = 0; i < 4; i++)
if (pos_args[i][0])
shader->nr_pos_exports++;
/* Specify the target we are exporting */
last_args[3] = lp_build_const_int32(base->gallivm, V_008DFC_SQ_EXP_MRT);
for (i = 0; i < 4; i++) {
if (!pos_args[i][0])
continue;
/* Set COMPR flag to zero to export data as 32-bit */
last_args[4] = uint->zero;
/* dummy bits */
last_args[5]= uint->zero;
last_args[6]= uint->zero;
last_args[7]= uint->zero;
last_args[8]= uint->zero;
si_shader_ctx->shader->spi_shader_col_format |=
V_028714_SPI_SHADER_32_ABGR;
si_shader_ctx->shader->cb_shader_mask |= S_02823C_OUTPUT0_ENABLE(0xf);
}
/* Specify whether the EXEC mask represents the valid mask */
last_args[1] = lp_build_const_int32(base->gallivm,
si_shader_ctx->type == TGSI_PROCESSOR_FRAGMENT);
if (shader->fs_write_all && shader->nr_cbufs > 1) {
int i;
/* Specify that this is not yet the last export */
last_args[2] = lp_build_const_int32(base->gallivm, 0);
for (i = 1; i < shader->nr_cbufs; i++) {
/* Specify the target we are exporting */
last_args[3] = lp_build_const_int32(base->gallivm,
V_008DFC_SQ_EXP_MRT + i);
pos_args[i][3] = lp_build_const_int32(base->gallivm, V_008DFC_SQ_EXP_POS + pos_idx++);
if (pos_idx == shader->nr_pos_exports)
/* Specify that this is the last export */
pos_args[i][2] = uint->one;
lp_build_intrinsic(base->gallivm->builder,
"llvm.SI.export",
LLVMVoidTypeInContext(base->gallivm->context),
last_args, 9);
pos_args[i], 9);
}
} else {
if (!last_args[0]) {
/* Specify which components to enable */
last_args[0] = lp_build_const_int32(base->gallivm, 0x0);
/* Specify the target we are exporting */
last_args[3] = lp_build_const_int32(base->gallivm, V_008DFC_SQ_EXP_MRT);
/* Set COMPR flag to zero to export data as 32-bit */
last_args[4] = uint->zero;
/* dummy bits */
last_args[5]= uint->zero;
last_args[6]= uint->zero;
last_args[7]= uint->zero;
last_args[8]= uint->zero;
si_shader_ctx->shader->spi_shader_col_format |=
si_shader_ctx->shader->spi_shader_col_format << 4;
si_shader_ctx->shader->cb_shader_mask |=
si_shader_ctx->shader->cb_shader_mask << 4;
V_028714_SPI_SHADER_32_ABGR;
si_shader_ctx->shader->cb_shader_mask |= S_02823C_OUTPUT0_ENABLE(0xf);
}
last_args[3] = lp_build_const_int32(base->gallivm, V_008DFC_SQ_EXP_MRT);
/* Specify whether the EXEC mask represents the valid mask */
last_args[1] = uint->one;
if (shader->fs_write_all && shader->nr_cbufs > 1) {
int i;
/* Specify that this is not yet the last export */
last_args[2] = lp_build_const_int32(base->gallivm, 0);
for (i = 1; i < shader->nr_cbufs; i++) {
/* Specify the target we are exporting */
last_args[3] = lp_build_const_int32(base->gallivm,
V_008DFC_SQ_EXP_MRT + i);
lp_build_intrinsic(base->gallivm->builder,
"llvm.SI.export",
LLVMVoidTypeInContext(base->gallivm->context),
last_args, 9);
si_shader_ctx->shader->spi_shader_col_format |=
si_shader_ctx->shader->spi_shader_col_format << 4;
si_shader_ctx->shader->cb_shader_mask |=
si_shader_ctx->shader->cb_shader_mask << 4;
}
last_args[3] = lp_build_const_int32(base->gallivm, V_008DFC_SQ_EXP_MRT);
}
/* Specify that this is the last export */
last_args[2] = lp_build_const_int32(base->gallivm, 1);
lp_build_intrinsic(base->gallivm->builder,
"llvm.SI.export",
LLVMVoidTypeInContext(base->gallivm->context),
last_args, 9);
}
/* Specify that this is the last export */
last_args[2] = lp_build_const_int32(base->gallivm, 1);
lp_build_intrinsic(base->gallivm->builder,
"llvm.SI.export",
LLVMVoidTypeInContext(base->gallivm->context),
last_args, 9);
/* XXX: Look up what this function does */
/* ctx->shader->output[i].spi_sid = r600_spi_sid(&ctx->shader->output[i]);*/
}

View File

@@ -113,6 +113,7 @@ struct si_shader {
bool vs_out_misc_write;
bool vs_out_point_size;
unsigned nr_cbufs;
unsigned nr_pos_exports;
unsigned clip_dist_write;
};

View File

@@ -74,13 +74,13 @@ static void si_pipe_shader_vs(struct pipe_context *ctx, struct si_pipe_shader *s
si_pm4_set_reg(pm4, R_02870C_SPI_SHADER_POS_FORMAT,
S_02870C_POS0_EXPORT_FORMAT(V_02870C_SPI_SHADER_4COMP) |
S_02870C_POS1_EXPORT_FORMAT(shader->shader.vs_out_misc_write ?
S_02870C_POS1_EXPORT_FORMAT(shader->shader.nr_pos_exports > 1 ?
V_02870C_SPI_SHADER_4COMP :
V_02870C_SPI_SHADER_NONE) |
S_02870C_POS2_EXPORT_FORMAT((shader->shader.clip_dist_write & 0x0F) ?
S_02870C_POS2_EXPORT_FORMAT(shader->shader.nr_pos_exports > 2 ?
V_02870C_SPI_SHADER_4COMP :
V_02870C_SPI_SHADER_NONE) |
S_02870C_POS3_EXPORT_FORMAT((shader->shader.clip_dist_write & 0xF0) ?
S_02870C_POS3_EXPORT_FORMAT(shader->shader.nr_pos_exports > 3 ?
V_02870C_SPI_SHADER_4COMP :
V_02870C_SPI_SHADER_NONE));
@@ -91,10 +91,10 @@ static void si_pipe_shader_vs(struct pipe_context *ctx, struct si_pipe_shader *s
num_user_sgprs = SI_VS_NUM_USER_SGPR;
num_sgprs = shader->num_sgprs;
if (num_user_sgprs > num_sgprs)
num_sgprs = num_user_sgprs;
/* Last 2 reserved SGPRs are used for VCC */
num_sgprs += 2;
if (num_user_sgprs > num_sgprs) {
/* Last 2 reserved SGPRs are used for VCC */
num_sgprs = num_user_sgprs + 2;
}
assert(num_sgprs <= 104);
vgpr_comp_cnt = shader->shader.uses_instanceid ? 3 : 0;
@@ -235,10 +235,10 @@ static void si_pipe_shader_ps(struct pipe_context *ctx, struct si_pipe_shader *s
num_user_sgprs = SI_PS_NUM_USER_SGPR;
num_sgprs = shader->num_sgprs;
if (num_user_sgprs > num_sgprs)
num_sgprs = num_user_sgprs;
/* Last 2 reserved SGPRs are used for VCC */
num_sgprs += 2;
if (num_user_sgprs > num_sgprs) {
/* Last 2 reserved SGPRs are used for VCC */
num_sgprs = num_user_sgprs + 2;
}
assert(num_sgprs <= 104);
si_pm4_set_reg(pm4, R_00B028_SPI_SHADER_PGM_RSRC1_PS,

View File

@@ -183,6 +183,8 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
return 0;
case PIPE_CAP_MAX_VIEWPORTS:
return 1;
case PIPE_CAP_ENDIANNESS:
return PIPE_ENDIAN_NATIVE;
}
/* should only get here on unhandled cases */
debug_printf("Unexpected PIPE_CAP %d query\n", param);

View File

@@ -270,6 +270,8 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param)
return 1;
case PIPE_CAP_MAX_VIEWPORTS:
return 1;
case PIPE_CAP_ENDIANNESS:
return PIPE_ENDIAN_LITTLE;
}
debug_printf("Unexpected PIPE_CAP_ query %u\n", param);

View File

@@ -507,12 +507,22 @@ enum pipe_cap {
PIPE_CAP_QUERY_PIPELINE_STATISTICS = 81,
PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK = 82,
PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE = 83,
PIPE_CAP_MAX_VIEWPORTS = 84
PIPE_CAP_MAX_VIEWPORTS = 84,
PIPE_CAP_ENDIANNESS = 85
};
#define PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_NV50 (1 << 0)
#define PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_R600 (1 << 1)
enum pipe_endian {
PIPE_ENDIAN_LITTLE = 0,
PIPE_ENDIAN_BIG = 1,
#if defined(PIPE_ARCH_LITTLE_ENDIAN)
PIPE_ENDIAN_NATIVE = PIPE_ENDIAN_LITTLE
#elif defined(PIPE_ARCH_BIG_ENDIAN)
PIPE_ENDIAN_NATIVE = PIPE_ENDIAN_BIG
#endif
};
/**
* Implementation limits which are queried through

View File

@@ -239,8 +239,12 @@ struct st_visual
*/
struct st_config_options
{
boolean force_glsl_extensions_warn;
boolean disable_glsl_line_continuations;
boolean disable_blend_func_extended;
boolean disable_glsl_line_continuations;
boolean disable_shader_bit_encoding;
boolean force_glsl_extensions_warn;
unsigned force_glsl_version;
boolean force_s3tc_enable;
};
/**

View File

@@ -192,7 +192,8 @@ clGetDeviceInfo(cl_device_id dev, cl_device_info param,
return scalar_property<size_t>(buf, size, size_ret, 0);
case CL_DEVICE_ENDIAN_LITTLE:
return scalar_property<cl_bool>(buf, size, size_ret, CL_TRUE);
return scalar_property<cl_bool>(buf, size, size_ret,
dev->endianness() == PIPE_ENDIAN_LITTLE);
case CL_DEVICE_AVAILABLE:
case CL_DEVICE_COMPILER_AVAILABLE:

View File

@@ -192,3 +192,8 @@ _cl_device_id::ir_target() const {
PIPE_COMPUTE_CAP_IR_TARGET);
return { target.data() };
}
enum pipe_endian
_cl_device_id::endianness() const {
return (enum pipe_endian)pipe->get_param(pipe, PIPE_CAP_ENDIANNESS);
}

View File

@@ -66,6 +66,7 @@ public:
std::string vendor_name() const;
enum pipe_shader_ir ir_format() const;
std::string ir_target() const;
enum pipe_endian endianness() const;
friend struct _cl_command_queue;
friend class clover::root_resource;

View File

@@ -22,31 +22,32 @@
#include "core/kernel.hpp"
#include "core/resource.hpp"
#include "util/u_math.h"
#include "pipe/p_context.h"
using namespace clover;
_cl_kernel::_cl_kernel(clover::program &prog,
const std::string &name,
const std::vector<clover::module::argument> &args) :
const std::vector<clover::module::argument> &margs) :
prog(prog), __name(name), exec(*this) {
for (auto arg : args) {
if (arg.type == module::argument::scalar)
this->args.emplace_back(new scalar_argument(arg.size));
else if (arg.type == module::argument::global)
this->args.emplace_back(new global_argument(arg.size));
else if (arg.type == module::argument::local)
this->args.emplace_back(new local_argument());
else if (arg.type == module::argument::constant)
this->args.emplace_back(new constant_argument());
else if (arg.type == module::argument::image2d_rd ||
arg.type == module::argument::image3d_rd)
this->args.emplace_back(new image_rd_argument());
else if (arg.type == module::argument::image2d_wr ||
arg.type == module::argument::image3d_wr)
this->args.emplace_back(new image_wr_argument());
else if (arg.type == module::argument::sampler)
this->args.emplace_back(new sampler_argument());
for (auto marg : margs) {
if (marg.type == module::argument::scalar)
args.emplace_back(new scalar_argument(marg.size));
else if (marg.type == module::argument::global)
args.emplace_back(new global_argument);
else if (marg.type == module::argument::local)
args.emplace_back(new local_argument);
else if (marg.type == module::argument::constant)
args.emplace_back(new constant_argument);
else if (marg.type == module::argument::image2d_rd ||
marg.type == module::argument::image3d_rd)
args.emplace_back(new image_rd_argument);
else if (marg.type == module::argument::image2d_wr ||
marg.type == module::argument::image3d_wr)
args.emplace_back(new image_wr_argument);
else if (marg.type == module::argument::sampler)
args.emplace_back(new sampler_argument);
else
throw error(CL_INVALID_KERNEL_DEFINITION);
}
@@ -129,7 +130,6 @@ _cl_kernel::module(const clover::command_queue &q) const {
return prog.binaries().find(&q.dev)->second;
}
_cl_kernel::exec_context::exec_context(clover::kernel &kern) :
kern(kern), q(NULL), mem_local(0), st(NULL) {
}
@@ -143,8 +143,12 @@ void *
_cl_kernel::exec_context::bind(clover::command_queue *__q) {
std::swap(q, __q);
for (auto &arg : kern.args)
arg->bind(*this);
// Bind kernel arguments.
auto margs = kern.module(*q).sym(kern.name()).args;
for_each([=](std::unique_ptr<kernel::argument> &karg,
const module::argument &marg) {
karg->bind(*this, marg);
}, kern.args.begin(), kern.args.end(), margs.begin());
// Create a new compute state if anything changed.
if (!st || q != __q ||
@@ -176,8 +180,83 @@ _cl_kernel::exec_context::unbind() {
mem_local = 0;
}
_cl_kernel::argument::argument(size_t size) :
__size(size), __set(false) {
namespace {
template<typename T>
std::vector<uint8_t>
bytes(const T& x) {
return { (uint8_t *)&x, (uint8_t *)&x + sizeof(x) };
}
///
/// Transform buffer \a v from the native byte order into the byte
/// order specified by \a e.
///
template<typename T>
void
byteswap(T &v, pipe_endian e) {
if (PIPE_ENDIAN_NATIVE != e)
std::reverse(v.begin(), v.end());
}
///
/// Pad buffer \a v to the next multiple of \a n.
///
template<typename T>
void
align(T &v, size_t n) {
v.resize(util_align_npot(v.size(), n));
}
bool
msb(const std::vector<uint8_t> &s) {
if (PIPE_ENDIAN_NATIVE == PIPE_ENDIAN_LITTLE)
return s.back() & 0x80;
else
return s.front() & 0x80;
}
///
/// Resize buffer \a v to size \a n using sign or zero extension
/// according to \a ext.
///
template<typename T>
void
extend(T &v, enum clover::module::argument::ext_type ext, size_t n) {
const size_t m = std::min(v.size(), n);
const bool sign_ext = (ext == module::argument::sign_ext);
const uint8_t fill = (sign_ext && msb(v) ? ~0 : 0);
T w(n, fill);
if (PIPE_ENDIAN_NATIVE == PIPE_ENDIAN_LITTLE)
std::copy_n(v.begin(), m, w.begin());
else
std::copy_n(v.end() - m, m, w.end() - m);
std::swap(v, w);
}
///
/// Append buffer \a w to \a v.
///
template<typename T>
void
insert(T &v, const T &w) {
v.insert(v.end(), w.begin(), w.end());
}
///
/// Append \a n elements to the end of buffer \a v.
///
template<typename T>
size_t
allocate(T &v, size_t n) {
size_t pos = v.size();
v.resize(pos + n);
return pos;
}
}
_cl_kernel::argument::argument() : __set(false) {
}
bool
@@ -190,13 +269,12 @@ _cl_kernel::argument::storage() const {
return 0;
}
_cl_kernel::scalar_argument::scalar_argument(size_t size) :
argument(size) {
_cl_kernel::scalar_argument::scalar_argument(size_t size) : size(size) {
}
void
_cl_kernel::scalar_argument::set(size_t size, const void *value) {
if (size != __size)
if (size != this->size)
throw error(CL_INVALID_ARG_SIZE);
v = { (uint8_t *)value, (uint8_t *)value + size };
@@ -204,18 +282,20 @@ _cl_kernel::scalar_argument::set(size_t size, const void *value) {
}
void
_cl_kernel::scalar_argument::bind(exec_context &ctx) {
ctx.input.insert(ctx.input.end(), v.begin(), v.end());
_cl_kernel::scalar_argument::bind(exec_context &ctx,
const clover::module::argument &marg) {
auto w = v;
extend(w, marg.ext_type, marg.target_size);
byteswap(w, ctx.q->dev.endianness());
align(ctx.input, marg.target_align);
insert(ctx.input, w);
}
void
_cl_kernel::scalar_argument::unbind(exec_context &ctx) {
}
_cl_kernel::global_argument::global_argument(size_t size) :
argument(size) {
}
void
_cl_kernel::global_argument::set(size_t size, const void *value) {
if (size != sizeof(cl_mem))
@@ -229,27 +309,17 @@ _cl_kernel::global_argument::set(size_t size, const void *value) {
}
void
_cl_kernel::global_argument::bind(exec_context &ctx) {
size_t offset = ctx.input.size();
size_t idx = ctx.g_buffers.size();
ctx.input.resize(offset + __size);
ctx.g_buffers.resize(idx + 1);
ctx.g_buffers[idx] = obj->resource(ctx.q).pipe;
ctx.g_handles.resize(idx + 1);
ctx.g_handles[idx] = offset;
_cl_kernel::global_argument::bind(exec_context &ctx,
const clover::module::argument &marg) {
align(ctx.input, marg.target_align);
ctx.g_handles.push_back(allocate(ctx.input, marg.target_size));
ctx.g_buffers.push_back(obj->resource(ctx.q).pipe);
}
void
_cl_kernel::global_argument::unbind(exec_context &ctx) {
}
_cl_kernel::local_argument::local_argument() :
argument(sizeof(uint32_t)) {
}
size_t
_cl_kernel::local_argument::storage() const {
return __storage;
@@ -265,12 +335,14 @@ _cl_kernel::local_argument::set(size_t size, const void *value) {
}
void
_cl_kernel::local_argument::bind(exec_context &ctx) {
size_t offset = ctx.input.size();
size_t ptr = ctx.mem_local;
_cl_kernel::local_argument::bind(exec_context &ctx,
const clover::module::argument &marg) {
auto v = bytes(ctx.mem_local);
ctx.input.resize(offset + sizeof(uint32_t));
*(uint32_t *)&ctx.input[offset] = ptr;
extend(v, module::argument::zero_ext, marg.target_size);
byteswap(v, ctx.q->dev.endianness());
align(ctx.input, marg.target_align);
insert(ctx.input, v);
ctx.mem_local += __storage;
}
@@ -279,10 +351,6 @@ void
_cl_kernel::local_argument::unbind(exec_context &ctx) {
}
_cl_kernel::constant_argument::constant_argument() :
argument(sizeof(uint32_t)) {
}
void
_cl_kernel::constant_argument::set(size_t size, const void *value) {
if (size != sizeof(cl_mem))
@@ -296,15 +364,17 @@ _cl_kernel::constant_argument::set(size_t size, const void *value) {
}
void
_cl_kernel::constant_argument::bind(exec_context &ctx) {
size_t offset = ctx.input.size();
size_t idx = ctx.resources.size();
_cl_kernel::constant_argument::bind(exec_context &ctx,
const clover::module::argument &marg) {
auto v = bytes(ctx.resources.size() << 24);
ctx.input.resize(offset + sizeof(uint32_t));
*(uint32_t *)&ctx.input[offset] = idx << 24;
extend(v, module::argument::zero_ext, marg.target_size);
byteswap(v, ctx.q->dev.endianness());
align(ctx.input, marg.target_align);
insert(ctx.input, v);
ctx.resources.resize(idx + 1);
ctx.resources[idx] = st = obj->resource(ctx.q).bind_surface(*ctx.q, false);
st = obj->resource(ctx.q).bind_surface(*ctx.q, false);
ctx.resources.push_back(st);
}
void
@@ -312,10 +382,6 @@ _cl_kernel::constant_argument::unbind(exec_context &ctx) {
obj->resource(ctx.q).unbind_surface(*ctx.q, st);
}
_cl_kernel::image_rd_argument::image_rd_argument() :
argument(sizeof(uint32_t)) {
}
void
_cl_kernel::image_rd_argument::set(size_t size, const void *value) {
if (size != sizeof(cl_mem))
@@ -329,15 +395,17 @@ _cl_kernel::image_rd_argument::set(size_t size, const void *value) {
}
void
_cl_kernel::image_rd_argument::bind(exec_context &ctx) {
size_t offset = ctx.input.size();
size_t idx = ctx.sviews.size();
_cl_kernel::image_rd_argument::bind(exec_context &ctx,
const clover::module::argument &marg) {
auto v = bytes(ctx.sviews.size());
ctx.input.resize(offset + sizeof(uint32_t));
*(uint32_t *)&ctx.input[offset] = idx;
extend(v, module::argument::zero_ext, marg.target_size);
byteswap(v, ctx.q->dev.endianness());
align(ctx.input, marg.target_align);
insert(ctx.input, v);
ctx.sviews.resize(idx + 1);
ctx.sviews[idx] = st = obj->resource(ctx.q).bind_sampler_view(*ctx.q);
st = obj->resource(ctx.q).bind_sampler_view(*ctx.q);
ctx.sviews.push_back(st);
}
void
@@ -345,10 +413,6 @@ _cl_kernel::image_rd_argument::unbind(exec_context &ctx) {
obj->resource(ctx.q).unbind_sampler_view(*ctx.q, st);
}
_cl_kernel::image_wr_argument::image_wr_argument() :
argument(sizeof(uint32_t)) {
}
void
_cl_kernel::image_wr_argument::set(size_t size, const void *value) {
if (size != sizeof(cl_mem))
@@ -362,15 +426,17 @@ _cl_kernel::image_wr_argument::set(size_t size, const void *value) {
}
void
_cl_kernel::image_wr_argument::bind(exec_context &ctx) {
size_t offset = ctx.input.size();
size_t idx = ctx.resources.size();
_cl_kernel::image_wr_argument::bind(exec_context &ctx,
const clover::module::argument &marg) {
auto v = bytes(ctx.resources.size());
ctx.input.resize(offset + sizeof(uint32_t));
*(uint32_t *)&ctx.input[offset] = idx;
extend(v, module::argument::zero_ext, marg.target_size);
byteswap(v, ctx.q->dev.endianness());
align(ctx.input, marg.target_align);
insert(ctx.input, v);
ctx.resources.resize(idx + 1);
ctx.resources[idx] = st = obj->resource(ctx.q).bind_surface(*ctx.q, true);
st = obj->resource(ctx.q).bind_surface(*ctx.q, true);
ctx.resources.push_back(st);
}
void
@@ -378,10 +444,6 @@ _cl_kernel::image_wr_argument::unbind(exec_context &ctx) {
obj->resource(ctx.q).unbind_surface(*ctx.q, st);
}
_cl_kernel::sampler_argument::sampler_argument() :
argument(0) {
}
void
_cl_kernel::sampler_argument::set(size_t size, const void *value) {
if (size != sizeof(cl_sampler))
@@ -392,11 +454,10 @@ _cl_kernel::sampler_argument::set(size_t size, const void *value) {
}
void
_cl_kernel::sampler_argument::bind(exec_context &ctx) {
size_t idx = ctx.samplers.size();
ctx.samplers.resize(idx + 1);
ctx.samplers[idx] = st = obj->bind(*ctx.q);
_cl_kernel::sampler_argument::bind(exec_context &ctx,
const clover::module::argument &marg) {
st = obj->bind(*ctx.q);
ctx.samplers.push_back(st);
}
void

View File

@@ -68,14 +68,11 @@ private:
public:
class argument {
public:
argument(size_t size);
argument();
/// \a true if the argument has been set.
bool set() const;
/// Argument size in the input buffer.
size_t size() const;
/// Storage space required for the referenced object.
virtual size_t storage() const;
@@ -84,19 +81,19 @@ public:
/// Allocate the necessary resources to bind the specified
/// object to this argument, and update \a ctx accordingly.
virtual void bind(exec_context &ctx) = 0;
virtual void bind(exec_context &ctx,
const clover::module::argument &marg) = 0;
/// Free any resources that were allocated in bind().
virtual void unbind(exec_context &ctx) = 0;
protected:
size_t __size;
bool __set;
};
_cl_kernel(clover::program &prog,
const std::string &name,
const std::vector<clover::module::argument> &args);
const std::vector<clover::module::argument> &margs);
void launch(clover::command_queue &q,
const std::vector<size_t> &grid_offset,
@@ -122,19 +119,20 @@ private:
scalar_argument(size_t size);
virtual void set(size_t size, const void *value);
virtual void bind(exec_context &ctx);
virtual void bind(exec_context &ctx,
const clover::module::argument &marg);
virtual void unbind(exec_context &ctx);
private:
size_t size;
std::vector<uint8_t> v;
};
class global_argument : public argument {
public:
global_argument(size_t size);
virtual void set(size_t size, const void *value);
virtual void bind(exec_context &ctx);
virtual void bind(exec_context &ctx,
const clover::module::argument &marg);
virtual void unbind(exec_context &ctx);
private:
@@ -143,12 +141,11 @@ private:
class local_argument : public argument {
public:
local_argument();
virtual size_t storage() const;
virtual void set(size_t size, const void *value);
virtual void bind(exec_context &ctx);
virtual void bind(exec_context &ctx,
const clover::module::argument &marg);
virtual void unbind(exec_context &ctx);
private:
@@ -157,10 +154,9 @@ private:
class constant_argument : public argument {
public:
constant_argument();
virtual void set(size_t size, const void *value);
virtual void bind(exec_context &ctx);
virtual void bind(exec_context &ctx,
const clover::module::argument &marg);
virtual void unbind(exec_context &ctx);
private:
@@ -170,10 +166,9 @@ private:
class image_rd_argument : public argument {
public:
image_rd_argument();
virtual void set(size_t size, const void *value);
virtual void bind(exec_context &ctx);
virtual void bind(exec_context &ctx,
const clover::module::argument &marg);
virtual void unbind(exec_context &ctx);
private:
@@ -183,10 +178,9 @@ private:
class image_wr_argument : public argument {
public:
image_wr_argument();
virtual void set(size_t size, const void *value);
virtual void bind(exec_context &ctx);
virtual void bind(exec_context &ctx,
const clover::module::argument &marg);
virtual void unbind(exec_context &ctx);
private:
@@ -196,10 +190,9 @@ private:
class sampler_argument : public argument {
public:
sampler_argument();
virtual void set(size_t size, const void *value);
virtual void bind(exec_context &ctx);
virtual void bind(exec_context &ctx,
const clover::module::argument &marg);
virtual void unbind(exec_context &ctx);
private:

View File

@@ -68,11 +68,32 @@ namespace clover {
sampler
};
argument(enum type type, size_t size) : type(type), size(size) { }
argument() : type(scalar), size(0) { }
enum ext_type {
zero_ext,
sign_ext
};
argument(enum type type, size_t size,
size_t target_size, size_t target_align,
enum ext_type ext_type) :
type(type), size(size),
target_size(target_size), target_align(target_align),
ext_type(ext_type) { }
argument(enum type type, size_t size) :
type(type), size(size),
target_size(size), target_align(1),
ext_type(zero_ext) { }
argument() : type(scalar), size(0),
target_size(0), target_align(1),
ext_type(zero_ext) { }
type type;
size_t size;
size_t target_size;
size_t target_align;
ext_type ext_type;
};
struct symbol {

View File

@@ -304,14 +304,21 @@ namespace {
for (llvm::Function::arg_iterator I = kernel_func->arg_begin(),
E = kernel_func->arg_end(); I != E; ++I) {
llvm::Argument &arg = *I;
llvm::Type *arg_type = arg.getType();
#if HAVE_LLVM < 0x0302
llvm::TargetData TD(kernel_func->getParent());
#else
llvm::DataLayout TD(kernel_func->getParent()->getDataLayout());
#endif
llvm::Type *arg_type = arg.getType();
unsigned arg_size = TD.getTypeStoreSize(arg_type);
llvm::Type *target_type = arg_type->isIntegerTy() ?
TD.getSmallestLegalIntType(mod->getContext(), arg_size * 8) :
arg_type;
unsigned target_size = TD.getTypeStoreSize(target_type);
unsigned target_align = TD.getABITypeAlignment(target_type);
if (llvm::isa<llvm::PointerType>(arg_type) && arg.hasByValAttr()) {
arg_type =
llvm::dyn_cast<llvm::PointerType>(arg_type)->getElementType();
@@ -324,11 +331,24 @@ namespace {
unsigned address_space = llvm::cast<llvm::PointerType>(arg_type)->getAddressSpace();
switch (address_space) {
default:
args.push_back(module::argument(module::argument::global, arg_size));
args.push_back(
module::argument(module::argument::global, arg_size,
target_size, target_align,
module::argument::zero_ext));
break;
}
} else {
args.push_back(module::argument(module::argument::scalar, arg_size));
llvm::AttributeSet attrs = kernel_func->getAttributes();
enum module::argument::ext_type ext_type =
(attrs.hasAttribute(arg.getArgNo() + 1,
llvm::Attribute::SExt) ?
module::argument::sign_ext :
module::argument::zero_ext);
args.push_back(
module::argument(module::argument::scalar, arg_size,
target_size, target_align, ext_type));
}
}

View File

@@ -52,10 +52,18 @@ dri_pp_query(struct dri_context *ctx)
static void dri_fill_st_options(struct st_config_options *options,
const struct driOptionCache * optionCache)
{
options->force_glsl_extensions_warn =
driQueryOptionb(optionCache, "force_glsl_extensions_warn");
options->disable_blend_func_extended =
driQueryOptionb(optionCache, "disable_blend_func_extended");
options->disable_glsl_line_continuations =
driQueryOptionb(optionCache, "disable_glsl_line_continuations");
options->disable_shader_bit_encoding =
driQueryOptionb(optionCache, "disable_shader_bit_encoding");
options->force_glsl_extensions_warn =
driQueryOptionb(optionCache, "force_glsl_extensions_warn");
options->force_glsl_version =
driQueryOptioni(optionCache, "force_glsl_version");
options->force_s3tc_enable =
driQueryOptionb(optionCache, "force_s3tc_enable");
}
GLboolean

View File

@@ -41,6 +41,7 @@
#include "state_tracker/drm_driver.h"
#include "util/u_debug.h"
#include "util/u_format_s3tc.h"
#define MSAA_VISUAL_MAX_SAMPLES 32
@@ -48,14 +49,8 @@
PUBLIC const char __driConfigOptions[] =
DRI_CONF_BEGIN
DRI_CONF_SECTION_PERFORMANCE
DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS)
DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0)
DRI_CONF_SECTION_END
DRI_CONF_SECTION_QUALITY
/* DRI_CONF_FORCE_S3TC_ENABLE("false") */
DRI_CONF_ALLOW_LARGE_TEXTURES(1)
DRI_CONF_FORCE_S3TC_ENABLE("false")
DRI_CONF_PP_CELSHADE(0)
DRI_CONF_PP_NORED(0)
DRI_CONF_PP_NOGREEN(0)
@@ -67,6 +62,9 @@ PUBLIC const char __driConfigOptions[] =
DRI_CONF_SECTION_DEBUG
DRI_CONF_FORCE_GLSL_EXTENSIONS_WARN("false")
DRI_CONF_DISABLE_GLSL_LINE_CONTINUATIONS("false")
DRI_CONF_DISABLE_BLEND_FUNC_EXTENDED("false")
DRI_CONF_DISABLE_SHADER_BIT_ENCODING("false")
DRI_CONF_FORCE_GLSL_VERSION(0)
DRI_CONF_SECTION_END
DRI_CONF_SECTION_MISCELLANEOUS
@@ -76,7 +74,7 @@ PUBLIC const char __driConfigOptions[] =
#define false 0
static const uint __driNConfigOptions = 12;
static const uint __driNConfigOptions = 13;
static const __DRIconfig **
dri_fill_in_modes(struct dri_screen *screen)
@@ -416,6 +414,20 @@ dri_init_screen_helper(struct dri_screen *screen,
screen->sPriv->myNum,
driver_descriptor.name);
/* Handle force_s3tc_enable. */
if (!util_format_s3tc_enabled &&
driQueryOptionb(&screen->optionCache, "force_s3tc_enable")) {
/* Ensure libtxc_dxtn has been loaded if available.
* Forcing S3TC on before calling this would prevent loading
* the library.
* This is just a precaution, the driver should have called it
* already.
*/
util_format_s3tc_init();
util_format_s3tc_enabled = TRUE;
}
return dri_fill_in_modes(screen);
}

View File

@@ -543,6 +543,11 @@ OSMesaCreateContextExt(GLenum format, GLint depthBits, GLint stencilBits,
attribs.minor = 1;
attribs.flags = 0; /* ST_CONTEXT_FLAG_x */
attribs.options.force_glsl_extensions_warn = FALSE;
attribs.options.disable_blend_func_extended = FALSE;
attribs.options.disable_glsl_line_continuations = FALSE;
attribs.options.disable_shader_bit_encoding = FALSE;
attribs.options.force_s3tc_enable = FALSE;
attribs.options.force_glsl_version = 0;
osmesa_init_st_visual(&attribs.visual,
PIPE_FORMAT_R8G8B8A8_UNORM,

View File

@@ -404,7 +404,7 @@ static boolean do_winsys_init(struct radeon_drm_winsys *ws)
&ws->info.r600_ib_vm_max_size))
ws->info.r600_virtual_address = FALSE;
}
if (ws->gen == DRV_R600 && !debug_get_bool_option("RADEON_VA", TRUE))
if (ws->gen == DRV_R600 && !debug_get_bool_option("RADEON_VA", FALSE))
ws->info.r600_virtual_address = FALSE;
}

View File

@@ -24,6 +24,7 @@ libgbm_la_LIBADD = $(LIBUDEV_LIBS) $(LIBKMS_LIBS) $(DLOPEN_LIBS)
if HAVE_EGL_PLATFORM_WAYLAND
AM_CPPFLAGS = -DHAVE_WAYLAND_PLATFORM
AM_CFLAGS += $(WAYLAND_CFLAGS)
libgbm_la_LIBADD += $(top_builddir)/src/egl/wayland/wayland-drm/libwayland-drm.la $(WAYLAND_LIBS)
endif
if HAVE_DRI
@@ -38,7 +39,7 @@ libgbm_dri_la_CFLAGS = \
$(LIBDRM_CFLAGS)
libgbm_la_LIBADD += \
libgbm_dri.la $(top_builddir)/src/mapi/shared-glapi/libglapi.la
libgbm_dri.la $(top_builddir)/src/mapi/shared-glapi/libglapi.la $(LIBDRM_LIBS)
endif
all-local: libgbm.la

View File

@@ -1771,12 +1771,6 @@ process_array_type(YYLTYPE *loc, const glsl_type *base, ast_node *array_size,
}
}
}
} else if (state->es_shader) {
/* Section 10.17 of the GLSL ES 1.00 specification states that unsized
* array declarations have been removed from the language.
*/
_mesa_glsl_error(loc, state, "unsized array declarations are not "
"allowed in GLSL ES 1.00.");
}
const glsl_type *array_type = glsl_type::get_array_instance(base, length);
@@ -1963,6 +1957,21 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual,
_mesa_glsl_shader_target_name(state->target));
}
/* Section 6.1.1 (Function Calling Conventions) of the GLSL 1.10 spec says:
*
* "However, the const qualifier cannot be used with out or inout."
*
* The same section of the GLSL 4.40 spec further clarifies this saying:
*
* "The const qualifier cannot be used with out or inout, or a
* compile-time error results."
*/
if (is_parameter && qual->flags.q.constant && qual->flags.q.out) {
_mesa_glsl_error(loc, state,
"`const' may not be applied to `out' or `inout' "
"function parameters");
}
/* If there is no qualifier that changes the mode of the variable, leave
* the setting alone.
*/
@@ -2605,6 +2614,11 @@ ast_declarator_list::hir(exec_list *instructions,
* name of a known structure type. This is both invalid and weird.
* Emit an error.
*
* - The program text contained something like 'mediump float;'
* when the programmer probably meant 'precision mediump
* float;' Emit a warning with a description of what they
* probably meant to do.
*
* Note that if decl_type is NULL and there is a structure involved,
* there must have been some sort of error with the structure. In this
* case we assume that an error was already generated on this line of
@@ -2613,20 +2627,33 @@ ast_declarator_list::hir(exec_list *instructions,
*/
assert(this->type->specifier->structure == NULL || decl_type != NULL
|| state->error);
if (this->type->specifier->structure == NULL) {
if (decl_type != NULL) {
_mesa_glsl_warning(&loc, state, "empty declaration");
} else {
_mesa_glsl_error(&loc, state,
"invalid type `%s' in empty declaration",
type_name);
}
}
if (this->type->qualifier.precision != ast_precision_none &&
this->type->specifier->structure != NULL) {
_mesa_glsl_error(&loc, state, "Precision qualifiers can't be applied "
"to structures.\n");
if (decl_type == NULL) {
_mesa_glsl_error(&loc, state,
"invalid type `%s' in empty declaration",
type_name);
} else if (this->type->qualifier.precision != ast_precision_none) {
if (this->type->specifier->structure != NULL) {
_mesa_glsl_error(&loc, state,
"precision qualifiers can't be applied "
"to structures");
} else {
static const char *const precision_names[] = {
"highp",
"highp",
"mediump",
"lowp"
};
_mesa_glsl_warning(&loc, state,
"empty declaration with precision qualifier, "
"to set the default precision, use "
"`precision %s %s;'",
precision_names[this->type->qualifier.precision],
type_name);
}
} else {
_mesa_glsl_warning(&loc, state, "empty declaration");
}
}
@@ -2927,6 +2954,20 @@ ast_declarator_list::hir(exec_list *instructions,
"'centroid in' cannot be used in a vertex shader");
}
/* Section 4.3.6 of the GLSL 1.30 specification states:
* "It is an error to use centroid out in a fragment shader."
*
* The GL_ARB_shading_language_420pack extension specification states:
* "It is an error to use auxiliary storage qualifiers or interpolation
* qualifiers on an output in a fragment shader."
*/
if (state->target == fragment_shader &&
this->type->qualifier.flags.q.out &&
this->type->qualifier.has_auxiliary_storage()) {
_mesa_glsl_error(&loc, state,
"auxiliary storage qualifiers cannot be used on "
"fragment shader outputs");
}
/* Precision qualifiers exists only in GLSL versions 1.00 and >= 1.30.
*/
@@ -3001,6 +3042,33 @@ ast_declarator_list::hir(exec_list *instructions,
decl->identifier);
}
if (state->es_shader) {
const glsl_type *const t = (earlier == NULL)
? var->type : earlier->type;
if (t->is_array() && t->length == 0)
/* Section 10.17 of the GLSL ES 1.00 specification states that
* unsized array declarations have been removed from the language.
* Arrays that are sized using an initializer are still explicitly
* sized. However, GLSL ES 1.00 does not allow array
* initializers. That is only allowed in GLSL ES 3.00.
*
* Section 4.1.9 (Arrays) of the GLSL ES 3.00 spec says:
*
* "An array type can also be formed without specifying a size
* if the definition includes an initializer:
*
* float x[] = float[2] (1.0, 2.0); // declares an array of size 2
* float y[] = float[] (1.0, 2.0, 3.0); // declares an array of size 3
*
* float a[5];
* float b[] = a;"
*/
_mesa_glsl_error(& loc, state,
"unsized array declarations are not allowed in "
"GLSL ES");
}
/* If the declaration is not a redeclaration, there are a few additional
* semantic checks that must be applied. In addition, variable that was
* created for the declaration should be added to the IR stream.
@@ -3309,6 +3377,18 @@ ast_function::hir(exec_list *instructions,
"function `%s' return type has qualifiers", name);
}
/* Section 6.1 (Function Definitions) of the GLSL 1.20 spec says:
*
* "Arrays are allowed as arguments and as the return type. In both
* cases, the array must be explicitly sized."
*/
if (return_type->is_array() && return_type->length == 0) {
YYLTYPE loc = this->get_location();
_mesa_glsl_error(& loc, state,
"function `%s' return type array must be explicitly "
"sized", name);
}
/* From page 17 (page 23 of the PDF) of the GLSL 1.20 spec:
*
* "[Sampler types] can only be declared as function parameters
@@ -4249,6 +4329,34 @@ ast_struct_specifier::hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
YYLTYPE loc = this->get_location();
/* Section 4.1.8 (Structures) of the GLSL 1.10 spec says:
*
* "Anonymous structures are not supported; so embedded structures must
* have a declarator. A name given to an embedded struct is scoped at
* the same level as the struct it is embedded in."
*
* The same section of the GLSL 1.20 spec says:
*
* "Anonymous structures are not supported. Embedded structures are not
* supported.
*
* struct S { float f; };
* struct T {
* S; // Error: anonymous structures disallowed
* struct { ... }; // Error: embedded structures disallowed
* S s; // Okay: nested structures with name are allowed
* };"
*
* The GLSL ES 1.00 and 3.00 specs have similar langauge and examples. So,
* we allow embedded structures in 1.10 only.
*/
if (state->language_version != 110 && state->struct_specifier_depth != 0)
_mesa_glsl_error(&loc, state,
"embedded structure declartions are not allowed");
state->struct_specifier_depth++;
glsl_struct_field *fields;
unsigned decl_count =
ast_process_structure_or_interface_block(instructions,
@@ -4275,6 +4383,8 @@ ast_struct_specifier::hir(exec_list *instructions,
}
}
state->struct_specifier_depth--;
/* Structure type definitions do not have r-values.
*/
return NULL;

View File

@@ -1,4 +1,6 @@
#version 100
precision highp float;
vec4 texture2D (sampler2D sampler, vec2 coord, float bias);
vec4 texture2DProj (sampler2D sampler, vec3 coord, float bias);
vec4 texture2DProj (sampler2D sampler, vec4 coord, float bias);

View File

@@ -1,4 +1,5 @@
#version 300 es
precision highp float;
/* texture - bias variants */
vec4 texture( sampler2D sampler, vec2 P, float bias);

View File

@@ -1,5 +1,6 @@
#version 100
#extension GL_OES_EGL_image_external : enable
precision highp float;
vec4 texture2D(samplerExternalOES sampler, vec2 coord);
vec4 texture2DProj(samplerExternalOES sampler, vec3 coord);

View File

@@ -1,5 +1,6 @@
#version 100
#extension GL_OES_standard_derivatives : enable
precision highp float;
/*
* 8.8 - Fragment Processing Functions

View File

@@ -1,5 +1,6 @@
#version 100
#extension GL_OES_texture_3D : enable
precision highp float;
vec4 texture3D (sampler3D sampler, vec3 coord);
vec4 texture3DProj (sampler3D sampler, vec4 coord);

View File

@@ -149,7 +149,7 @@ literal_integer(char *text, int len, struct _mesa_glsl_parse_state *state,
%option bison-bridge bison-locations reentrant noyywrap
%option nounput noyy_top_state
%option never-interactive
%option prefix="_mesa_glsl_"
%option prefix="_mesa_glsl_lexer_"
%option extra-type="struct _mesa_glsl_parse_state *"
%x PP PRAGMA
@@ -324,30 +324,11 @@ sampler2DMSArray KEYWORD_WITH_ALT(150, 300, 150, 0, yyextra->ARB_texture_multi
isampler2DMSArray KEYWORD_WITH_ALT(150, 300, 150, 0, yyextra->ARB_texture_multisample_enable, ISAMPLER2DMSARRAY);
usampler2DMSArray KEYWORD_WITH_ALT(150, 300, 150, 0, yyextra->ARB_texture_multisample_enable, USAMPLER2DMSARRAY);
samplerCubeArray {
if (yyextra->ARB_texture_cube_map_array_enable)
return SAMPLERCUBEARRAY;
else
return IDENTIFIER;
}
isamplerCubeArray {
if (yyextra->ARB_texture_cube_map_array_enable)
return ISAMPLERCUBEARRAY;
else
return IDENTIFIER;
}
usamplerCubeArray {
if (yyextra->ARB_texture_cube_map_array_enable)
return USAMPLERCUBEARRAY;
else
return IDENTIFIER;
}
samplerCubeArrayShadow {
if (yyextra->ARB_texture_cube_map_array_enable)
return SAMPLERCUBEARRAYSHADOW;
else
return IDENTIFIER;
}
/* keywords available with ARB_texture_cube_map_array_enable extension on desktop GLSL */
samplerCubeArray KEYWORD_WITH_ALT(400, 0, 400, 0, yyextra->ARB_texture_cube_map_array_enable, SAMPLERCUBEARRAY);
isamplerCubeArray KEYWORD_WITH_ALT(400, 0, 400, 0, yyextra->ARB_texture_cube_map_array_enable, ISAMPLERCUBEARRAY);
usamplerCubeArray KEYWORD_WITH_ALT(400, 0, 400, 0, yyextra->ARB_texture_cube_map_array_enable, USAMPLERCUBEARRAY);
samplerCubeArrayShadow KEYWORD_WITH_ALT(400, 0, 400, 0, yyextra->ARB_texture_cube_map_array_enable, SAMPLERCUBEARRAYSHADOW);
samplerExternalOES {
if (yyextra->OES_EGL_image_external_enable)
@@ -371,7 +352,7 @@ layout {
return LAYOUT_TOK;
} else {
yylval->identifier = strdup(yytext);
return IDENTIFIER;
return classify_identifier(yyextra, yytext);
}
}

View File

@@ -31,14 +31,18 @@
#include "glsl_types.h"
#include "main/context.h"
#define YYLEX_PARAM state->scanner
#undef yyerror
static void yyerror(YYLTYPE *loc, _mesa_glsl_parse_state *st, const char *msg)
{
_mesa_glsl_error(loc, st, "%s", msg);
}
static int
_mesa_glsl_lex(YYSTYPE *val, YYLTYPE *loc, _mesa_glsl_parse_state *state)
{
return _mesa_glsl_lexer_lex(val, loc, state->scanner);
}
%}
%expect 0
@@ -55,7 +59,7 @@ static void yyerror(YYLTYPE *loc, _mesa_glsl_parse_state *st, const char *msg)
@$.source = 0;
}
%lex-param {void *scanner}
%lex-param {struct _mesa_glsl_parse_state *state}
%parse-param {struct _mesa_glsl_parse_state *state}
%union {

View File

@@ -71,10 +71,12 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx,
this->loop_nesting_ast = NULL;
this->switch_state.switch_nesting_ast = NULL;
this->struct_specifier_depth = 0;
this->num_builtins_to_link = 0;
/* Set default language version and extensions */
this->language_version = 110;
this->language_version = ctx->Const.ForceGLSLVersion ?
ctx->Const.ForceGLSLVersion : 110;
this->es_shader = false;
this->ARB_texture_rectangle_enable = true;

View File

@@ -158,6 +158,13 @@ struct _mesa_glsl_parse_state {
unsigned language_version;
enum _mesa_glsl_parser_targets target;
/**
* Number of nested struct_specifier levels
*
* Outside a struct_specifer, this is zero.
*/
unsigned struct_specifier_depth;
/**
* Default uniform layout qualifiers tracked during parsing.
* Currently affects uniform blocks and uniform buffer variables in
@@ -337,8 +344,8 @@ extern void _mesa_glsl_lexer_ctor(struct _mesa_glsl_parse_state *state,
extern void _mesa_glsl_lexer_dtor(struct _mesa_glsl_parse_state *state);
union YYSTYPE;
extern int _mesa_glsl_lex(union YYSTYPE *yylval, YYLTYPE *yylloc,
void *scanner);
extern int _mesa_glsl_lexer_lex(union YYSTYPE *yylval, YYLTYPE *yylloc,
void *scanner);
extern int _mesa_glsl_parse(struct _mesa_glsl_parse_state *);

View File

@@ -281,7 +281,7 @@ glsl_type::glsl_type(const glsl_type *array, unsigned length) :
}
const glsl_type *const
const glsl_type *
glsl_type::vec(unsigned components)
{
if (components == 0 || components > 4)
@@ -294,7 +294,7 @@ glsl_type::vec(unsigned components)
}
const glsl_type *const
const glsl_type *
glsl_type::ivec(unsigned components)
{
if (components == 0 || components > 4)
@@ -307,7 +307,7 @@ glsl_type::ivec(unsigned components)
}
const glsl_type *const
const glsl_type *
glsl_type::uvec(unsigned components)
{
if (components == 0 || components > 4)
@@ -320,7 +320,7 @@ glsl_type::uvec(unsigned components)
}
const glsl_type *const
const glsl_type *
glsl_type::bvec(unsigned components)
{
if (components == 0 || components > 4)

View File

@@ -170,10 +170,10 @@ struct glsl_type {
* Convenience accessors for vector types (shorter than get_instance()).
* @{
*/
static const glsl_type *const vec(unsigned components);
static const glsl_type *const ivec(unsigned components);
static const glsl_type *const uvec(unsigned components);
static const glsl_type *const bvec(unsigned components);
static const glsl_type *vec(unsigned components);
static const glsl_type *ivec(unsigned components);
static const glsl_type *uvec(unsigned components);
static const glsl_type *bvec(unsigned components);
/**@}*/
/**

View File

@@ -77,7 +77,7 @@ bool do_copy_propagation(exec_list *instructions);
bool do_copy_propagation_elements(exec_list *instructions);
bool do_constant_propagation(exec_list *instructions);
void do_dead_builtin_varyings(struct gl_context *ctx,
exec_list *producer, exec_list *consumer,
gl_shader *producer, gl_shader *consumer,
unsigned num_tfeedback_decls,
class tfeedback_decl *tfeedback_decls);
bool do_dead_code(exec_list *instructions, bool uniform_locations_assigned);

View File

@@ -58,6 +58,15 @@ public:
private:
virtual void visit_field(const glsl_type *type, const char *name,
bool row_major)
{
(void) type;
(void) name;
(void) row_major;
assert(!"Should not get here.");
}
virtual void visit_field(const glsl_type *type, const char *name,
bool row_major, const glsl_type *record_type)
{
assert(this->index < this->num_variables);
@@ -85,7 +94,9 @@ private:
v->IndexName = v->Name;
}
unsigned alignment = type->std140_base_alignment(v->RowMajor);
const unsigned alignment = record_type
? record_type->std140_base_alignment(v->RowMajor)
: type->std140_base_alignment(v->RowMajor);
unsigned size = type->std140_size(v->RowMajor);
this->offset = glsl_align(this->offset, alignment);
@@ -107,6 +118,10 @@ private:
virtual void visit_field(const glsl_struct_field *field)
{
/* FINISHME: When support for doubles (dvec4, etc.) is added to the
* FINISHME: compiler, this may be incorrect for a structure in a UBO
* FINISHME: like struct s { struct { float f } s1; dvec4 v; };.
*/
this->offset = glsl_align(this->offset,
field->type->std140_base_alignment(false));
}

View File

@@ -60,7 +60,7 @@ program_resource_visitor::process(const glsl_type *type, const char *name)
|| (type->is_array() && type->fields.array->is_interface()));
char *name_copy = ralloc_strdup(NULL, name);
recursion(type, &name_copy, strlen(name), false);
recursion(type, &name_copy, strlen(name), false, NULL);
ralloc_free(name_copy);
}
@@ -77,24 +77,25 @@ program_resource_visitor::process(ir_variable *var)
/* Only strdup the name if we actually will need to modify it. */
if (t->is_record() || (t->is_array() && t->fields.array->is_record())) {
char *name = ralloc_strdup(NULL, var->name);
recursion(var->type, &name, strlen(name), false);
recursion(var->type, &name, strlen(name), false, NULL);
ralloc_free(name);
} else if (t->is_interface()) {
char *name = ralloc_strdup(NULL, var->type->name);
recursion(var->type, &name, strlen(name), false);
recursion(var->type, &name, strlen(name), false, NULL);
ralloc_free(name);
} else if (t->is_array() && t->fields.array->is_interface()) {
char *name = ralloc_strdup(NULL, var->type->fields.array->name);
recursion(var->type, &name, strlen(name), false);
recursion(var->type, &name, strlen(name), false, NULL);
ralloc_free(name);
} else {
this->visit_field(t, var->name, false);
this->visit_field(t, var->name, false, NULL);
}
}
void
program_resource_visitor::recursion(const glsl_type *t, char **name,
size_t name_length, bool row_major)
size_t name_length, bool row_major,
const glsl_type *record_type)
{
/* Records need to have each field processed individually.
*
@@ -103,6 +104,9 @@ program_resource_visitor::recursion(const glsl_type *t, char **name,
* individually.
*/
if (t->is_record() || t->is_interface()) {
if (record_type == NULL && t->is_record())
record_type = t;
for (unsigned i = 0; i < t->length; i++) {
const char *field = t->fields.structure[i].name;
size_t new_length = name_length;
@@ -118,10 +122,18 @@ program_resource_visitor::recursion(const glsl_type *t, char **name,
}
recursion(t->fields.structure[i].type, name, new_length,
t->fields.structure[i].row_major);
t->fields.structure[i].row_major, record_type);
/* Only the first leaf-field of the record gets called with the
* record type pointer.
*/
record_type = NULL;
}
} else if (t->is_array() && (t->fields.array->is_record()
|| t->fields.array->is_interface())) {
if (record_type == NULL && t->fields.array->is_record())
record_type = t->fields.array;
for (unsigned i = 0; i < t->length; i++) {
size_t new_length = name_length;
@@ -129,13 +141,26 @@ program_resource_visitor::recursion(const glsl_type *t, char **name,
ralloc_asprintf_rewrite_tail(name, &new_length, "[%u]", i);
recursion(t->fields.array, name, new_length,
t->fields.structure[i].row_major);
t->fields.structure[i].row_major, record_type);
/* Only the first leaf-field of the record gets called with the
* record type pointer.
*/
record_type = NULL;
}
} else {
this->visit_field(t, *name, row_major);
this->visit_field(t, *name, row_major, record_type);
}
}
void
program_resource_visitor::visit_field(const glsl_type *type, const char *name,
bool row_major,
const glsl_type *record_type)
{
visit_field(type, name, row_major);
}
void
program_resource_visitor::visit_field(const glsl_struct_field *field)
{
@@ -376,6 +401,15 @@ private:
virtual void visit_field(const glsl_type *type, const char *name,
bool row_major)
{
(void) type;
(void) name;
(void) row_major;
assert(!"Should not get here.");
}
virtual void visit_field(const glsl_type *type, const char *name,
bool row_major, const glsl_type *record_type)
{
assert(!type->is_record());
assert(!(type->is_array() && type->fields.array->is_record()));
@@ -421,7 +455,9 @@ private:
if (this->ubo_block_index != -1) {
this->uniforms[id].block_index = this->ubo_block_index;
unsigned alignment = type->std140_base_alignment(ubo_row_major);
const unsigned alignment = record_type
? record_type->std140_base_alignment(ubo_row_major)
: type->std140_base_alignment(ubo_row_major);
this->ubo_byte_offset = glsl_align(this->ubo_byte_offset, alignment);
this->uniforms[id].offset = this->ubo_byte_offset;
this->ubo_byte_offset += type->std140_size(ubo_row_major);

View File

@@ -1906,7 +1906,7 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
goto done;
}
do_dead_builtin_varyings(ctx, sh->ir, NULL,
do_dead_builtin_varyings(ctx, sh, NULL,
num_tfeedback_decls, tfeedback_decls);
demote_shader_inputs_and_outputs(sh, ir_var_shader_out);
@@ -1921,7 +1921,7 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
*/
gl_shader *const sh = prog->_LinkedShaders[first];
do_dead_builtin_varyings(ctx, NULL, sh->ir,
do_dead_builtin_varyings(ctx, NULL, sh,
num_tfeedback_decls, tfeedback_decls);
demote_shader_inputs_and_outputs(sh, ir_var_shader_in);
@@ -1943,7 +1943,7 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
tfeedback_decls))
goto done;
do_dead_builtin_varyings(ctx, sh_i->ir, sh_next->ir,
do_dead_builtin_varyings(ctx, sh_i, sh_next,
next == MESA_SHADER_FRAGMENT ? num_tfeedback_decls : 0,
tfeedback_decls);

View File

@@ -118,6 +118,19 @@ public:
void process(const glsl_type *type, const char *name);
protected:
/**
* Method invoked for each leaf of the variable
*
* \param type Type of the field.
* \param name Fully qualified name of the field.
* \param row_major For a matrix type, is it stored row-major.
* \param record_type Type of the record containing the field.
*
* The default implementation just calls the other \c visit_field method.
*/
virtual void visit_field(const glsl_type *type, const char *name,
bool row_major, const glsl_type *record_type);
/**
* Method invoked for each leaf of the variable
*
@@ -144,7 +157,7 @@ private:
* terminating \c NUL character.
*/
void recursion(const glsl_type *t, char **name, size_t name_length,
bool row_major);
bool row_major, const glsl_type *record_type);
};
void

View File

@@ -503,7 +503,8 @@ is_loop_terminator(ir_if *ir)
ir_instruction *const inst =
(ir_instruction *) ir->then_instructions.get_head();
assert(inst != NULL);
if (inst == NULL)
return false;
if (inst->ir_type != ir_type_loop_jump)
return false;

View File

@@ -409,7 +409,7 @@ lower_texcoord_array(exec_list *ir, const varying_info_visitor *info)
void
do_dead_builtin_varyings(struct gl_context *ctx,
exec_list *producer, exec_list *consumer,
gl_shader *producer, gl_shader *consumer,
unsigned num_tfeedback_decls,
tfeedback_decl *tfeedback_decls)
{
@@ -431,44 +431,55 @@ do_dead_builtin_varyings(struct gl_context *ctx,
varying_info_visitor consumer_info(ir_var_shader_in);
if (producer) {
producer_info.get(producer, num_tfeedback_decls, tfeedback_decls);
producer_info.get(producer->ir, num_tfeedback_decls, tfeedback_decls);
if (!consumer) {
/* At least eliminate unused gl_TexCoord elements. */
if (producer_info.lower_texcoord_array) {
lower_texcoord_array(producer, &producer_info);
lower_texcoord_array(producer->ir, &producer_info);
}
return;
}
}
if (consumer) {
consumer_info.get(consumer, 0, NULL);
consumer_info.get(consumer->ir, 0, NULL);
if (!producer) {
/* At least eliminate unused gl_TexCoord elements. */
if (consumer_info.lower_texcoord_array) {
lower_texcoord_array(consumer, &consumer_info);
lower_texcoord_array(consumer->ir, &consumer_info);
}
return;
}
}
/* Eliminate the varyings unused by the other shader. */
/* Eliminate the outputs unused by the consumer. */
if (producer_info.lower_texcoord_array ||
producer_info.color_usage ||
producer_info.has_fog) {
replace_varyings_visitor(producer,
replace_varyings_visitor(producer->ir,
&producer_info,
consumer_info.texcoord_usage,
consumer_info.color_usage,
consumer_info.has_fog);
}
/* The gl_TexCoord fragment shader inputs can be initialized
* by GL_COORD_REPLACE, so we can't eliminate them.
*
* This doesn't prevent elimination of the gl_TexCoord elements which
* are not read by the fragment shader. We want to eliminate those anyway.
*/
if (consumer->Type == GL_FRAGMENT_SHADER) {
producer_info.texcoord_usage = (1 << MAX_TEXTURE_COORD_UNITS) - 1;
}
/* Eliminate the inputs uninitialized by the producer. */
if (consumer_info.lower_texcoord_array ||
consumer_info.color_usage ||
consumer_info.has_fog) {
replace_varyings_visitor(consumer,
replace_varyings_visitor(consumer->ir,
&consumer_info,
producer_info.texcoord_usage,
producer_info.color_usage,

View File

@@ -132,8 +132,6 @@ apple_glx_swap_buffers(void *ptr)
{
struct apple_glx_context *ac = ptr;
/* This may not be needed with CGLFlushDrawable: */
glFlush();
apple_cgl.flush_drawable(ac->context_obj);
}

View File

@@ -40,9 +40,10 @@
#ifdef GLX_USE_APPLEGL
#include <pthread.h>
#include "apple_glx_drawable.h"
#include "glx_error.h"
#endif
#include "glx_error.h"
#define WARN_ONCE_GLX_1_3(a, b) { \
static int warned=1; \
if(warned) { \
@@ -279,7 +280,16 @@ GetDrawableAttribute(Display * dpy, GLXDrawable drawable,
unsigned int num_attributes;
GLboolean use_glx_1_3;
if ((dpy == NULL) || (drawable == 0)) {
if (dpy == NULL)
return 0;
/* Page 38 (page 52 of the PDF) of glxencode1.3.pdf says:
*
* "If drawable is not a valid GLX drawable, a GLXBadDrawable error is
* generated."
*/
if (drawable == 0) {
__glXSendError(dpy, GLXBadDrawable, 0, X_GLXGetDrawableAttributes, false);
return 0;
}

View File

@@ -78,7 +78,7 @@
<return type="GLboolean"/>
</function>
<function name="BindRenderbufferEXT" offset="assign">
<function name="BindRenderbufferEXT" offset="assign" deprecated="3.1">
<param name="target" type="GLenum"/>
<param name="renderbuffer" type="GLuint"/>
<glx rop="4316"/>
@@ -112,7 +112,7 @@
<return type="GLboolean"/>
</function>
<function name="BindFramebufferEXT" offset="assign">
<function name="BindFramebufferEXT" offset="assign" deprecated="3.1">
<param name="target" type="GLenum"/>
<param name="framebuffer" type="GLuint"/>
<glx rop="4319"/>

View File

@@ -704,9 +704,14 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
_mesa_LoadIdentity();
_mesa_MatrixMode(GL_PROJECTION);
_mesa_LoadIdentity();
_mesa_Ortho(0.0, ctx->DrawBuffer->Width,
0.0, ctx->DrawBuffer->Height,
-1.0, 1.0);
/* glOrtho with width = 0 or height = 0 generates GL_INVALID_VALUE.
* This can occur when there is no draw buffer.
*/
if (ctx->DrawBuffer->Width != 0 && ctx->DrawBuffer->Height != 0)
_mesa_Ortho(0.0, ctx->DrawBuffer->Width,
0.0, ctx->DrawBuffer->Height,
-1.0, 1.0);
}
if (state & MESA_META_CLIP) {
@@ -1532,6 +1537,9 @@ setup_glsl_blit_framebuffer(struct gl_context *ctx,
"}\n";
fs_source = ralloc_asprintf(mem_ctx,
"#ifdef GL_ES\n"
"precision highp float;\n"
"#endif\n"
"uniform %s texSampler;\n"
"varying vec2 texCoords;\n"
"void main()\n"
@@ -1556,6 +1564,9 @@ setup_glsl_blit_framebuffer(struct gl_context *ctx,
_mesa_is_desktop_gl(ctx) ? "130" : "300 es");
fs_source = ralloc_asprintf(mem_ctx,
"#version %s\n"
"#ifdef GL_ES\n"
"precision highp float;\n"
"#endif\n"
"uniform %s texSampler;\n"
"in vec2 texCoords;\n"
"out vec4 out_color;\n"
@@ -1879,19 +1890,24 @@ _mesa_meta_BlitFramebuffer(struct gl_context *ctx,
const GLenum rb_base_format =
_mesa_base_tex_format(ctx, colorReadRb->InternalFormat);
newTex = alloc_texture(tex, srcW, srcH, rb_base_format);
setup_copypix_texture(ctx, tex, newTex, srcX, srcY, srcW, srcH,
/* Using the exact source rectangle to create the texture does incorrect
* linear filtering along the edges. So, allocate the texture extended along
* edges by one pixel in x, y directions.
*/
newTex = alloc_texture(tex, srcW + 2, srcH + 2, rb_base_format);
setup_copypix_texture(ctx, tex, newTex,
srcX - 1, srcY - 1, srcW + 2, srcH + 2,
rb_base_format, filter);
/* texcoords (after texture allocation!) */
{
verts[0].s = 0.0F;
verts[0].t = 0.0F;
verts[1].s = tex->Sright;
verts[1].t = 0.0F;
verts[2].s = tex->Sright;
verts[2].t = tex->Ttop;
verts[3].s = 0.0F;
verts[3].t = tex->Ttop;
verts[0].s = 1.0F;
verts[0].t = 1.0F;
verts[1].s = tex->Sright - 1.0F;
verts[1].t = 1.0F;
verts[2].s = tex->Sright - 1.0F;
verts[2].t = tex->Ttop - 1.0F;
verts[3].s = 1.0F;
verts[3].t = tex->Ttop - 1.0F;
/* upload new vertex data */
_mesa_BufferSubData(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts);
@@ -2129,6 +2145,9 @@ meta_glsl_clear_init(struct gl_context *ctx, struct clear_state *clear)
" gl_Position = position;\n"
"}\n";
const char *fs_source =
"#ifdef GL_ES\n"
"precision highp float;\n"
"#endif\n"
"uniform vec4 color;\n"
"void main()\n"
"{\n"
@@ -2188,6 +2207,9 @@ meta_glsl_clear_init(struct gl_context *ctx, struct clear_state *clear)
const char *fs_int_source =
ralloc_asprintf(shader_source_mem_ctx,
"#version %s\n"
"#ifdef GL_ES\n"
"precision highp float;\n"
"#endif\n"
"uniform ivec4 color;\n"
"out ivec4 out_color;\n"
"\n"
@@ -3416,6 +3438,9 @@ setup_glsl_generate_mipmap(struct gl_context *ctx,
fs_source = ralloc_asprintf(mem_ctx,
"#extension GL_EXT_texture_array : enable\n"
"#ifdef GL_ES\n"
"precision highp float;\n"
"#endif\n"
"uniform %s texSampler;\n"
"varying vec3 texCoords;\n"
"void main()\n"
@@ -3439,6 +3464,9 @@ setup_glsl_generate_mipmap(struct gl_context *ctx,
_mesa_is_desktop_gl(ctx) ? "130" : "300 es");
fs_source = ralloc_asprintf(mem_ctx,
"#version %s\n"
"#ifdef GL_ES\n"
"precision highp float;\n"
"#endif\n"
"uniform %s texSampler;\n"
"in vec3 texCoords;\n"
"out vec4 out_color;\n"
@@ -4095,10 +4123,29 @@ _mesa_meta_GetTexImage(struct gl_context *ctx,
_mesa_get_format_datatype(texImage->TexFormat)
== GL_UNSIGNED_NORMALIZED) {
struct gl_texture_object *texObj = texImage->TexObject;
const GLuint slice = 0; /* only 2D compressed textures for now */
GLuint slice;
/* Need to unlock the texture here to prevent deadlock... */
_mesa_unlock_texture(ctx, texObj);
decompress_texture_image(ctx, texImage, slice, format, type, pixels);
for (slice = 0; slice < texImage->Depth; slice++) {
void *dst;
if (texImage->TexObject->Target == GL_TEXTURE_2D_ARRAY) {
/* Setup pixel packing. SkipPixels and SkipRows will be applied
* in the decompress_texture_image() function's call to
* glReadPixels but we need to compute the dest slice's address
* here (according to SkipImages and ImageHeight).
*/
struct gl_pixelstore_attrib packing = ctx->Pack;
packing.SkipPixels = 0;
packing.SkipRows = 0;
dst = _mesa_image_address3d(&packing, pixels, texImage->Width,
texImage->Height, format, type,
slice, 0, 0);
}
else {
dst = pixels;
}
decompress_texture_image(ctx, texImage, slice, format, type, dst);
}
/* ... and relock it */
_mesa_lock_texture(ctx, texObj);
}

View File

@@ -1,33 +1,75 @@
<!--
============================================
Application bugs worked around in this file:
============================================
* Various Unigine products don't use the #version and #extension GLSL
directives, meaning they only get GLSL 1.10 and no extensions for their
shaders.
Enabling all extensions for Unigine fixes most issues, but the GLSL version
is still 1.10.
* Unigine Heaven 3.0 with ARB_texture_multisample uses a "ivec4 * vec4"
expression, which fails to compile with GLSL 1.10.
Adding "#version 130" fixes this.
* Unigine Heaven 3.0 with ARB_shader_bit_encoding uses the uint keyword, which
fails to compile with GLSL 1.10.
Adding "#version 130" fixes this.
* Unigine Heaven 3.0 with ARB_shader_bit_encoding uses a "uint & int"
expression, which fails (and should fail) to compile with any GLSL version.
Disabling ARB_shader_bit_encoding fixes this.
TODO: document the other workarounds.
-->
<driconf>
<device screen="0" driver="i965">
<!-- Please always enable app-specific workarounds for all drivers and
screens. -->
<device>
<application name="Unigine Sanctuary" executable="Sanctuary">
<option name="force_glsl_extensions_warn" value="true" />
<option name="disable_blend_func_extended" value="true" />
</application>
<application name="Unigine Tropics" executable="Tropics">
<option name="force_glsl_extensions_warn" value="true" />
<option name="disable_blend_func_extended" value="true" />
</application>
<application name="Unigine Heaven (32-bit)" executable="heaven_x86">
<option name="force_glsl_extensions_warn" value="true" />
<option name="disable_blend_func_extended" value="true" />
<option name="force_glsl_version" value="130" />
<option name="disable_shader_bit_encoding" value="true" />
</application>
<application name="Unigine Heaven (64-bit)" executable="heaven_x64">
<option name="force_glsl_extensions_warn" value="true" />
<option name="disable_blend_func_extended" value="true" />
<option name="force_glsl_version" value="130" />
<option name="disable_shader_bit_encoding" value="true" />
</application>
<application name="Unigine OilRush (32-bit)" executable="OilRush_x86">
<option name="disable_blend_func_extended" value="true" />
</application>
<application name="Unigine OilRush (64-bit)" executable="OilRush_x64">
<option name="disable_blend_func_extended" value="true" />
</application>
<application name="Savage 2" executable="savage2.bin">
<option name="disable_glsl_line_continuations" value="true" />
</application>
<application name="Topogun (32-bit)" executable="topogun32">
<option name="always_have_depth_buffer" value="true" />
</application>
<application name="Topogun (64-bit)" executable="topogun64">
<option name="always_have_depth_buffer" value="true" />
</application>

View File

@@ -812,7 +812,9 @@ static void parseOptConfAttr (struct OptConfData *data, const XML_Char **attr) {
driOptionCache *cache = data->cache;
GLuint opt = findOption (cache, name);
if (cache->info[opt].name == NULL)
XML_WARNING ("undefined option: %s.", name);
/* don't use XML_WARNING, drirc defines options for all drivers,
* but not all drivers support them */
return;
else if (getenv (cache->info[opt].name))
/* don't use XML_WARNING, we want the user to see this! */
fprintf (stderr, "ATTENTION: option value of option %s ignored.\n",

View File

@@ -95,6 +95,16 @@ DRI_CONF_OPT_BEGIN_B(disable_glsl_line_continuations, def) \
DRI_CONF_DESC(en,gettext("Disable backslash-based line continuations in GLSL source")) \
DRI_CONF_OPT_END
#define DRI_CONF_DISABLE_SHADER_BIT_ENCODING(def) \
DRI_CONF_OPT_BEGIN_B(disable_shader_bit_encoding, def) \
DRI_CONF_DESC(en,gettext("Disable GL_ARB_shader_bit_encoding")) \
DRI_CONF_OPT_END
#define DRI_CONF_FORCE_GLSL_VERSION(def) \
DRI_CONF_OPT_BEGIN_V(force_glsl_version, int, def, "0:999") \
DRI_CONF_DESC(en,gettext("Force a default GLSL version for shaders that lack an explicit #version line")) \
DRI_CONF_OPT_END
/**
@@ -266,15 +276,6 @@ DRI_CONF_OPT_BEGIN_V(texture_units,int,def, # min ":" # max ) \
DRI_CONF_DESC(en,gettext("Number of texture units used")) \
DRI_CONF_OPT_END
#define DRI_CONF_ALLOW_LARGE_TEXTURES(def) \
DRI_CONF_OPT_BEGIN_V(allow_large_textures,enum,def,"0:2") \
DRI_CONF_DESC_BEGIN(en,gettext("Support larger textures not guaranteed to fit into graphics memory")) \
DRI_CONF_ENUM(0,gettext("No")) \
DRI_CONF_ENUM(1,gettext("At least 1 texture must fit under worst-case assumptions")) \
DRI_CONF_ENUM(2,gettext("Announce hardware limits")) \
DRI_CONF_DESC_END \
DRI_CONF_OPT_END
#define DRI_CONF_TEXTURE_BLEND_QUALITY(def,range) \
DRI_CONF_OPT_BEGIN_V(texture_blend_quality,float,def,range) \
DRI_CONF_DESC(en,gettext("Texture filtering quality vs. speed, AKA “brilinear” texture filtering")) \

View File

@@ -39,7 +39,7 @@ intelNewTextureObject(struct gl_context * ctx, GLuint name, GLenum target)
if (obj == NULL)
return NULL;
_mesa_initialize_texture_object(&obj->base, name, target);
_mesa_initialize_texture_object(ctx, &obj->base, name, target);
obj->needs_validate = true;

View File

@@ -171,6 +171,7 @@ try_pbo_upload(struct gl_context *ctx,
0, 0, false,
image->Width, image->Height, GL_COPY)) {
DBG("%s: blit failed\n", __FUNCTION__);
intel_miptree_release(&pbo_mt);
return false;
}

View File

@@ -1239,6 +1239,8 @@ struct brw_context
__DRIcontext *driContext;
struct intel_screen *intelScreen;
void (*saved_viewport)(struct gl_context *ctx,
GLint x, GLint y, GLsizei width, GLsizei height);
};
/*======================================================================

View File

@@ -2427,7 +2427,7 @@ vec4_visitor::visit(ir_texture *ir)
}
} else /* brw->gen == 4 */ {
mrf = param_base;
writemask = WRITEMASK_Z;
writemask = WRITEMASK_W;
}
emit(MOV(dst_reg(MRF, mrf, lod_type, writemask), lod));
} else if (ir->op == ir_txf) {
@@ -2506,7 +2506,7 @@ vec4_visitor::swizzle_result(ir_texture *ir, src_reg orig_val, int sampler)
}
int zero_mask = 0, one_mask = 0, copy_mask = 0;
int swizzle[4];
int swizzle[4] = {0};
for (int i = 0; i < 4; i++) {
switch (GET_SWZ(s, i)) {

View File

@@ -138,11 +138,13 @@ brw_upload_vs_unit(struct brw_context *brw)
vs->thread4.max_threads = CLAMP(brw->urb.nr_vs_entries / 2,
1, brw->max_vs_threads) - 1;
/* No samplers for ARB_vp programs:
*/
/* It has to be set to 0 for Ironlake
*/
vs->vs5.sampler_count = 0;
if (brw->gen == 5)
vs->vs5.sampler_count = 0; /* hardware requirement */
else {
/* CACHE_NEW_SAMPLER */
vs->vs5.sampler_count = (brw->sampler.count + 3) / 4;
}
if (unlikely(INTEL_DEBUG & DEBUG_STATS))
vs->thread4.stats_enable = 1;
@@ -151,6 +153,19 @@ brw_upload_vs_unit(struct brw_context *brw)
*/
vs->vs6.vs_enable = 1;
/* Set the sampler state pointer, and its reloc
*/
if (brw->sampler.count) {
vs->vs5.sampler_state_pointer =
(brw->batch.bo->offset + brw->sampler.offset) >> 5;
drm_intel_bo_emit_reloc(brw->batch.bo,
brw->vs.state_offset +
offsetof(struct brw_vs_unit_state, vs5),
brw->batch.bo,
brw->sampler.offset | vs->vs5.sampler_count,
I915_GEM_DOMAIN_INSTRUCTION, 0);
}
/* Emit scratch space relocation */
if (brw->vs.prog_data->base.total_scratch != 0) {
drm_intel_bo_emit_reloc(brw->batch.bo,
@@ -172,7 +187,7 @@ const struct brw_tracked_state brw_vs_unit = {
BRW_NEW_CURBE_OFFSETS |
BRW_NEW_URB_FENCE |
BRW_NEW_VERTEX_PROGRAM),
.cache = CACHE_NEW_VS_PROG
.cache = CACHE_NEW_VS_PROG | CACHE_NEW_SAMPLER
},
.emit = brw_upload_vs_unit,
};

Some files were not shown because too many files have changed in this diff Show More