mesa.git
11 years agor300g/swtcl: fix geometry corruption by uploading indices to a buffer
Marek Olšák [Mon, 15 Jul 2013 00:42:44 +0000 (02:42 +0200)]
r300g/swtcl: fix geometry corruption by uploading indices to a buffer

The splitting of a draw call into several draw commands was broken, because
the split sometimes took place in the middle of a primitive. The splitting
was supposed to be dealing with the case when there are more indices than
the maximum size of a CS.

This commit throws that code away and uses a real index buffer instead.

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

Cc: mesa-stable@lists.freedesktop.org
11 years agoglsl: Reject C-style initializers with unknown types.
Matt Turner [Fri, 12 Jul 2013 18:05:38 +0000 (11:05 -0700)]
glsl: Reject C-style initializers with unknown types.

_mesa_ast_set_aggregate_type walks through declarations initialized with
C-style aggregate initializers and stops when it runs out of LHS
declarations or RHS expressions.

In the example

   vec4 v = {{{1, 2, 3, 4}}};

_mesa_ast_set_aggregate_type would not recurse into the subexpressions
(since vec4s do not contain types that can be initialized with an
aggregate initializer) to set their <constructor_type>s. Later in ::hir
we would dereference the NULL pointer and segfault.

If <constructor_type> is NULL in ::hir we know that the LHS and RHS
were unbalanced and the code is illegal.

Arrays, structs, and matrices were unaffected.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
11 years agoglsl: Rework builtin_variables.cpp to reduce code duplication.
Paul Berry [Sun, 7 Jul 2013 19:44:57 +0000 (12:44 -0700)]
glsl: Rework builtin_variables.cpp to reduce code duplication.

Previously, we had a separate function for setting up the built-in
variables for each combination of shader stage and GLSL version
(e.g. generate_110_vs_variables to generate the built-in variables for
GLSL 1.10 vertex shaders).  The functions called each other in ad-hoc
ways, leading to unexpected inconsistencies (for example,
generate_120_fs_variables was called for GLSL versions 1.20 and above,
but generate_130_fs_variables was called only for GLSL version 1.30).
In addition, it led to a lot of code duplication, since many varyings
had to be duplicated in both the FS and VS code paths.  With the
advent of geometry shaders (and later, tessellation control and
tessellation evaluation shaders), this code duplication was going to
get a lot worse.

So this patch reworks things so that instead of having a separate
function for each shader type and GLSL version, we have a function for
constants, one for uniforms, one for varyings, and one for the special
variables that are specific to each shader type.

In addition, we use a class, builtin_variable_generator, to keep track
of the instruction exec_list, the GLSL parse state, commonly-used
types, and a few other variables, so that we don't have to pass them
around as function arguments.  This makes the code a lot more compact.

Where it was feasible to do so without introducing compilation errors,
I've also gone ahead and introduced the variables needed for
{ARB,EXT}_geometry_shader4 style geometry shaders.  This patch takes
care of everything except the GS variable gl_VerticesIn, the FS
variable gl_PrimitiveID, and GLSL 1.50 style geometry shader inputs
(using the gl_in interface block).  Those remaining features will be
added later.

I've also made a slight nomenclature change: previously we used the
word "deprecated" to refer to variables which are marked in GLSL 1.40
as requiring the ARB_compatibility extension, and are marked in GLSL
1.50 onward as requiring the compatibilty profile.  This was
misleading, since not all deprecated variables require the
compatibility profile (for example gl_FragData and gl_FragColor, which
have been deprecated since GLSL 1.30, but do not require the
compatibility profile until GLSL 4.20).  We now consistently use the
word "compatibility" to refer to these variables.

This patch doesn't introduce any functional changes (since geometry
shaders haven't been enabled yet).

Reviewed-by: Matt Turner <mattst88@gmail.com>
v2: Rename "typ" -> "type".  Add blank line between inline functions
and declarations in builtin_variable_generator class.  Use the
standard comment "/* FALLTHROUGH */" for compatibility with static
code analysis tools.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Fix lower_named_interface_blocks to account for dereferences of consts.
Paul Berry [Sun, 14 Jul 2013 15:57:49 +0000 (08:57 -0700)]
glsl: Fix lower_named_interface_blocks to account for dereferences of consts.

In certain rare cases (such as those involving dereference of a
literal constant array of structs),
flatten_named_interface_blocks_declarations's rvalue visitor may be
invoked on an ir_dereference_record whose variable_referenced() method
returns NULL.

Check for this case to avoid a segfault.

Prevents crashes in piglit tests
{vs,fs}-deref-literal-array-of-structs.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
11 years agoglsl: Don't allow vertex shader input arrays until GLSL 1.50.
Paul Berry [Thu, 11 Jul 2013 22:40:11 +0000 (15:40 -0700)]
glsl: Don't allow vertex shader input arrays until GLSL 1.50.

Vertex shader inputs are not allowed to be arrays until GLSL 1.50.  We
were accidentally enabling them for GLSL 1.40 (although we haven't
written any tests for them, so it's not clear whether they actually
work).

NOTE: although this is a simple bug fix, it probably isn't sensible to
cherry-pick it to stable release branches, since its only effect is to
cause incorrectly-written shaders to fail to compile.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Gen4/5: use IEEE floating point mode for GLSL shaders.
Chris Forbes [Sun, 9 Jun 2013 20:01:41 +0000 (08:01 +1200)]
i965: Gen4/5: use IEEE floating point mode for GLSL shaders.

Fixes isinf(), isnan() from GLSL 1.30

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965/vs: Gen4/5: enable front colors if back colors are written
Chris Forbes [Sun, 7 Jul 2013 11:13:07 +0000 (23:13 +1200)]
i965/vs: Gen4/5: enable front colors if back colors are written

Fixes undefined results if a back color is written, but the
corresponding front color is not, and only backfacing primitives are
drawn. Results are still undefined if a frontfacing primitive is drawn,
but that's OK.

The other reasonable way to fix this would have been to just pick
the one color slot that was populated, but that dilutes the value of
the tests.

On Gen6+, the fixed function clipper and triangle setup already take
care of this.

Fixes 11 piglits:
spec/glsl-1.10/execution/interpolation/interpolation-none-gl_Back*Color-*

NOTE: This is a candidate for stable branches.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agogallivm: (trivial) use constant instead of exp2f() function
Roland Scheidegger [Sun, 14 Jul 2013 00:38:13 +0000 (02:38 +0200)]
gallivm: (trivial) use constant instead of exp2f() function

Some lame compilers can't do exp2f() and as far as I can tell they can't do
exp2() (with doubles) neither so instead of providing some workaround for
that (wouldn't actually be too bad just replace with pow) and since it is
used with a constant only just use the precalculated constant.

11 years agoilo: skip 3DSTATE_INDEX_BUFFER when possible
Chia-I Wu [Sat, 13 Jul 2013 19:56:44 +0000 (03:56 +0800)]
ilo: skip 3DSTATE_INDEX_BUFFER when possible

When only the offset to the index buffer is changed, we can skip the
3DSTATE_INDEX_BUFFER if we always use 0 for the offset, and add
(offset / index_size) to Start Vertex Location in 3DPRIMITIVE.

11 years agogallivm: handle srgb-to-linear and linear-to-srgb conversions
Roland Scheidegger [Sat, 13 Jul 2013 15:31:52 +0000 (17:31 +0200)]
gallivm: handle srgb-to-linear and linear-to-srgb conversions

srgb-to-linear is using 3rd degree polynomial for now which should be _just_
good enough. Reverse is using some rational polynomials and is quite accurate,
though not hooked into llvmpipe's blend code yet and hence unused (untested).
Using a table might also be an option (for srgb-to-linear especially).
This does not enable any new features yet because EXT_texture_srgb was already
supported via util_format fallbacks, but performance was lacking probably due
to the external function call (the table used by the util_format_srgb code may
not be all that much slower on its own).
Some performance figures (taken from modified gloss, replaced both base and
sphere texture to use GL_SRGB instead of GL_RGB, measured on 1Ghz Sandy Bridge,
the numbers aren't terribly accurate):

normal gloss, aos, 8-wide: 47 fps
normal gloss, aos, 4-wide: 48 fps

normal gloss, forced to soa, 8-wide: 48 fps
normal gloss, forced to soa, 4-wide: 47 fps

patched gloss, old code, soa, 8-wide: 21 fps
patched gloss, old code, soa, 4-wide: 24 fps

patched gloss, new code, soa, 8-wide: 41 fps
patched gloss, new code, soa, 4-wide: 38 fps

So there's a performance hit but it seems acceptable, certainly better
than using the fallback.
Note the new code only works for 4x8bit srgb formats, others (L8/L8A8) will
continue to use the old util_format fallback, because I can't be bothered
to write code for formats noone uses anyway (as decoding is done as part of
lp_build_unpack_rgba_soa which can only handle block type width of 32).
Compressed srgb formats should get their own path though eventually (it is
going to be expensive in any case, first decompress, then convert).
No piglit regressions.

v2: use lp_build_polynomial instead of ad-hoc polynomial construction, also
since keeping both linear to srgb functions for now make sure both are
compiled (since they share quite some code just integrate into the same
function).

v3: formatting fixes and bugfix in the complicated (disabled) linear-to-srgb
path.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agogallivm: better support for fast rsqrt
Roland Scheidegger [Thu, 11 Jul 2013 21:15:44 +0000 (23:15 +0200)]
gallivm: better support for fast rsqrt

We had to disable fast rsqrt before because it wasn't precise enough etc.
However in situations when we know we're not going to need more precision
we can still use a fast rsqrt (which can be several times faster than
the quite expensive sqrt). Hence introduce a new helper which does exactly
that - it is probably not useful calling it in some situations if there's
no fast rsqrt available so make it queryable if it's available too.

v2: use fast_rsqrt consistently instead of rsqrt_fast, fix indentation,
let rsqrt use fast_rsqrt.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agoconfigure.ac: better detection of LLVM version
Klemens Baum [Thu, 27 Jun 2013 21:13:37 +0000 (23:13 +0200)]
configure.ac: better detection of LLVM version

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
11 years agor600g/sb: Initialize ra_constraint::cost.
Vinson Lee [Sat, 13 Jul 2013 02:21:41 +0000 (19:21 -0700)]
r600g/sb: Initialize ra_constraint::cost.

Fixes "Uninitialized scalar field" reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
11 years agoglsl: Initialize ast_aggregate_initializer::constructor_type.
Vinson Lee [Sat, 13 Jul 2013 00:16:47 +0000 (17:16 -0700)]
glsl: Initialize ast_aggregate_initializer::constructor_type.

Fixes "Uninitialized pointer field" defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agoglsl: Make gl_TexCoord compatibility-only
Paul Berry [Sun, 7 Jul 2013 18:49:22 +0000 (11:49 -0700)]
glsl: Make gl_TexCoord compatibility-only

gl_TexCoord was deprecated in GLSL 1.30.  In GLSL 1.40 it was marked
as ARB_compatibility-only, and in GLSL 1.50 and above it was marked as
only appearing in the compatibility profile.  It has never appeared in
GLSL ES.

However, Mesa erroneously included it in all desktop versions of GLSL,
even versions 1.40 and 1.50 (which do not currently support the
compatibility profile).  This patch makes gl_TexCoord available in the
compatibility profile (and GLSL versions 1.30 and prior) only.

NOTE: although this is a simple bug fix, it probably isn't sensible to
cherry-pick it to stable release branches, since its only effect is to
cause incorrectly-written shaders to fail to compile.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agoglsl ES: Fix magnitude of gl_MaxVertexUniformVectors.
Paul Berry [Sun, 7 Jul 2013 18:47:22 +0000 (11:47 -0700)]
glsl ES: Fix magnitude of gl_MaxVertexUniformVectors.

Previously, we set it equal to MaxVertexUniformComponents.  It should
be MaxVertexUniformComponents / 4.

NOTE: This is a candidate for the stable branches.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agowinsys/radeon: allow a NULL cs pointer in radeon_bo_map to fix a segfault
Marek Olšák [Fri, 12 Jul 2013 22:19:55 +0000 (00:19 +0200)]
winsys/radeon: allow a NULL cs pointer in radeon_bo_map to fix a segfault

The original idea was that cs=NULL should be allowed here, but we never used
NULL until 862f69fbe1e54e0e9a3c439450a14f. This fixes a segfault in CoreBreach.

11 years agoilo: move a santiy check into its assert()
Chia-I Wu [Fri, 12 Jul 2013 23:22:24 +0000 (07:22 +0800)]
ilo: move a santiy check into its assert()

The compiler does not know that ilo_3d_pipeline_estimate_size() is pure and
can be eliminated in a release build in gen6_pipeline_end().  Move the call
into the assert().

11 years agoilo: mark some states dirty when they are really changed
Chia-I Wu [Fri, 12 Jul 2013 21:54:20 +0000 (05:54 +0800)]
ilo: mark some states dirty when they are really changed

The checks may seem redundant because cso_context handles them, but
util_blitter does not have access to cso_context.

11 years agoilo: clean up ilo_blitter_pipe_begin()
Chia-I Wu [Fri, 12 Jul 2013 21:54:25 +0000 (05:54 +0800)]
ilo: clean up ilo_blitter_pipe_begin()

Document why certain states need to be saved, and fix a bug when blitting with
scissor enabled.

11 years agor600g: don't use the CB/DB CP COHER logic on r6xx
Alex Deucher [Fri, 12 Jul 2013 13:31:28 +0000 (09:31 -0400)]
r600g: don't use the CB/DB CP COHER logic on r6xx

There are hw bugs.  Flush and inv event is sufficient.

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

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agoconfigure: Avoid use of AC_CHECK_FILE for cross compiling
Jonathan Liu [Tue, 4 Jun 2013 13:04:44 +0000 (23:04 +1000)]
configure: Avoid use of AC_CHECK_FILE for cross compiling

The AC_CHECK_FILE macro can't be used for cross compiling as it will
result in "error: cannot check for file existence when cross compiling".
Replace it with the AS_IF macro.

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
Signed-off-by: Jonathan Liu <net147@gmail.com>
11 years agonv30: fix KILL_IF breakage
Brian Paul [Fri, 12 Jul 2013 15:59:38 +0000 (09:59 -0600)]
nv30: fix KILL_IF breakage

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

11 years agogallium: fixup definitions of the rsq and sqrt
Zack Rusin [Thu, 11 Jul 2013 16:16:06 +0000 (12:16 -0400)]
gallium: fixup definitions of the rsq and sqrt

GLSL spec says that rsq is undefined for src<=0, but the D3D10
spec says it needs to be a NaN, so lets stop taking an absolute
value of the source which completely breaks that behavior. For
the gl program we can simply insert an extra abs instrunction
which produces the desired behavior there.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agoutil/u_format: Comment out half float denormal test case.
José Fonseca [Fri, 12 Jul 2013 14:48:38 +0000 (15:48 +0100)]
util/u_format: Comment out half float denormal test case.

So that lp_test_format doesn't fail until we decide what should be done.

11 years agogallivm: Eliminate redundant lp_build_select calls.
José Fonseca [Fri, 5 Jul 2013 10:53:09 +0000 (11:53 +0100)]
gallivm: Eliminate redundant lp_build_select calls.

lp_build_cmp already returns 0 / ~0, so the lp_build_select call is
unnecessary.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agotgsi: rename the TGSI fragment kill opcodes
Brian Paul [Thu, 11 Jul 2013 23:02:37 +0000 (17:02 -0600)]
tgsi: rename the TGSI fragment kill opcodes

TGSI_OPCODE_KIL and KILP had confusing names.  The former was conditional
kill (if any src component < 0).  The later was unconditional kill.
At one time KILP was supposed to work with NV-style condition
codes/predicates but we never had that in TGSI.

This patch renames both opcodes:
  TGSI_OPCODE_KIL -> KILL_IF   (kill if src.xyzw < 0)
  TGSI_OPCODE_KILP -> KILL     (unconditional kill)

Note: I didn't just transpose the opcode names to help ensure that I
didn't miss updating any code anywhere.

I believe I've updated all the relevant code and comments but I'm
not 100% sure that some drivers had this right in the first place.
For example, the radeon driver might have llvm.AMDGPU.kill and
llvm.AMDGPU.kilp mixed up.  Driver authors should review their code.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agotgsi: fix-up KILP comments
Brian Paul [Thu, 11 Jul 2013 22:00:45 +0000 (16:00 -0600)]
tgsi: fix-up KILP comments

KILP is really unconditional fragment kill.

We've had KIL and KILP transposed forever.  I'll fix that next.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agotgsi: exec TGSI_OPCODE_SQRT as a scalar instruction, not vector
Brian Paul [Thu, 11 Jul 2013 21:52:37 +0000 (15:52 -0600)]
tgsi: exec TGSI_OPCODE_SQRT as a scalar instruction, not vector

To align with the docs and the state tracker.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agotgsi: use X component of the second operand in exec_scalar_binary()
Brian Paul [Tue, 9 Jul 2013 19:30:15 +0000 (13:30 -0600)]
tgsi: use X component of the second operand in exec_scalar_binary()

The code happened to work in the past since the (scalar) src args
effectively always have a swizzle of .xxxx, .yyyy, .zzzz, or .wwww so
whether you grab the X or Y component doesn't really matter.  Just
fixing the code to make it look right.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agomesa: update glext.h to version 20130708
Brian Paul [Mon, 8 Jul 2013 15:22:48 +0000 (09:22 -0600)]
mesa: update glext.h to version 20130708

This update fixes the problem with duplicated typedefs for
GLclampf and GLclampd in the previous version.

It also changes some parameter types for glDebugMessageCallbackARB()
and glTransformFeedbackVaryingsEXT().

Note we should someday update the glapi-gen code so that it
understands void pointer parameters.  Currently, the Python code
only understands "GLvoid *" but not "void *".  Luckily, the
compilers don't seem to complain about mixing GLvoid and void.

11 years agomesa: fix Address Sanitizer (ASan) issue in _mesa_add_parameter()
Brian Paul [Tue, 2 Jul 2013 20:51:30 +0000 (14:51 -0600)]
mesa: fix Address Sanitizer (ASan) issue in _mesa_add_parameter()

If the size argument isn't a multiple of four, we would have read/
copied uninitialized memory.

Fixes an issue reported by Myles C. Maxfield <myles.maxfield@gmail.com>

11 years agomesa: simplify some _mesa_IsEnabled() queries
Brian Paul [Fri, 28 Jun 2013 21:46:36 +0000 (15:46 -0600)]
mesa: simplify some _mesa_IsEnabled() queries

No need to test array->Enabled != 0 since the Enabled field can
only be 0 or 1.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
11 years agoos: add os_get_process_name() function
Brian Paul [Thu, 27 Jun 2013 14:38:35 +0000 (08:38 -0600)]
os: add os_get_process_name() function

v2: explicitly test for BSD/APPLE, #warning for unexpected
environments.

11 years agomesa: whitespace, formatting, 80-column wrapping
Brian Paul [Fri, 12 Jul 2013 14:32:22 +0000 (08:32 -0600)]
mesa: whitespace, formatting, 80-column wrapping

11 years agosoftpipe: silence some MSVC warnings
Brian Paul [Mon, 8 Jul 2013 16:02:14 +0000 (10:02 -0600)]
softpipe: silence some MSVC warnings

11 years agohud: silence some MSVC warnings
Brian Paul [Mon, 8 Jul 2013 16:01:44 +0000 (10:01 -0600)]
hud: silence some MSVC warnings

11 years agoutil: add casts to silence MSVC warnings in u_blit.c
Brian Paul [Mon, 8 Jul 2013 16:01:22 +0000 (10:01 -0600)]
util: add casts to silence MSVC warnings in u_blit.c

11 years agotgsi: s/unsigned/int/ to silence MSVC warning
Brian Paul [Mon, 8 Jul 2013 16:00:54 +0000 (10:00 -0600)]
tgsi: s/unsigned/int/ to silence MSVC warning

11 years agomesa: s/unsigned/int/ to fix MSVC warning in uniforms.c
Brian Paul [Mon, 8 Jul 2013 16:00:29 +0000 (10:00 -0600)]
mesa: s/unsigned/int/ to fix MSVC warning in uniforms.c

11 years agomesa: s/GLuint/GLint/ to silence MSVC warning in textore.c
Brian Paul [Mon, 8 Jul 2013 16:00:01 +0000 (10:00 -0600)]
mesa: s/GLuint/GLint/ to silence MSVC warning in textore.c

11 years agomesa: add casts to fix MSVC warnings in multisample.c
Brian Paul [Mon, 8 Jul 2013 15:59:40 +0000 (09:59 -0600)]
mesa: add casts to fix MSVC warnings in multisample.c

11 years agomesa: s/GLint/GLuint/ to fix MSVC warnings in mipmap.c
Brian Paul [Mon, 8 Jul 2013 15:59:20 +0000 (09:59 -0600)]
mesa: s/GLint/GLuint/ to fix MSVC warnings in mipmap.c

11 years agomesa: fix inconsistent function declaration, definitions
Brian Paul [Mon, 8 Jul 2013 15:58:12 +0000 (09:58 -0600)]
mesa: fix inconsistent function declaration, definitions

To silence MSVC warnings that the declaration and definitions
were different.

11 years agomesa: add cast to silence MSVC warning
Brian Paul [Mon, 8 Jul 2013 15:55:38 +0000 (09:55 -0600)]
mesa: add cast to silence MSVC warning

11 years agoradeon/uvd: fall back to shader based decoding for MPEG2 on UVD 2.x v2
Christian König [Wed, 10 Jul 2013 13:43:16 +0000 (15:43 +0200)]
radeon/uvd: fall back to shader based decoding for MPEG2 on UVD 2.x v2

UVD 2.x doesn't support hardware decoding of MPEG2, just use shader
based decoding for those chipsets.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=66450
v2: fix interlacing as well

Signed-off-by: Christian König <christian.koenig@amd.com>
11 years agoglsl: Avoid variable length arrays.
José Fonseca [Fri, 12 Jul 2013 08:27:22 +0000 (09:27 +0100)]
glsl: Avoid variable length arrays.

They are a non-standard GCC extension that's not widely supported by
other C/C++ compilers.

Use a dynamic array instead.

Trivial. Should fix the MSVC build.

11 years agoglsl: Add support for C-style initializers.
Matt Turner [Sun, 30 Jun 2013 02:29:16 +0000 (19:29 -0700)]
glsl: Add support for C-style initializers.

Required by GL_ARB_shading_language_420pack.

Parts based on work done by Todd Previte and Ken Graunke, implementing
basic support for C-style initializers of arrays.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoglsl: Add infrastructure for aggregate initializers.
Matt Turner [Sun, 30 Jun 2013 02:27:50 +0000 (19:27 -0700)]
glsl: Add infrastructure for aggregate initializers.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoglsl: Add an is_declaration field to ast_struct_specifier.
Matt Turner [Wed, 26 Jun 2013 22:53:12 +0000 (15:53 -0700)]
glsl: Add an is_declaration field to ast_struct_specifier.

Will be used in a later commit to differentiate between a structure type
declaration and a variable declaration of a struct type. I.e., the
difference between

   struct S { float x; }; (is_declaration = true)

and

   S s;                   (is_declaration = false)

Also note that is_declaration = true for

   struct S { float x; } s;

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoglsl: Track structs' ast_type_specifiers in symbol table.
Matt Turner [Tue, 25 Jun 2013 07:27:41 +0000 (00:27 -0700)]
glsl: Track structs' ast_type_specifiers in symbol table.

Will be used in a future commit. An ast_type_specifier is stored (rather
than an ast_struct_specifier) with the idea that we may have more
general uses for this in the future. struct names are prefixed with
'#ast.' to avoid collisions with the glsl_types in the symbol table.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoglsl: Add process_vec_mat_constructor() function.
Matt Turner [Sat, 29 Jun 2013 22:45:46 +0000 (15:45 -0700)]
glsl: Add process_vec_mat_constructor() function.

Based largely on process_array_constructor().

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoglsl: Separate code into process_record_constructor().
Matt Turner [Thu, 13 Jun 2013 19:05:21 +0000 (12:05 -0700)]
glsl: Separate code into process_record_constructor().

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoglsl: Add copy-constructor for ast_struct_specifier.
Matt Turner [Wed, 26 Jun 2013 22:52:28 +0000 (15:52 -0700)]
glsl: Add copy-constructor for ast_struct_specifier.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoglsl: Add a constructor for ast_type_specifier.
Matt Turner [Tue, 25 Jun 2013 04:38:30 +0000 (21:38 -0700)]
glsl: Add a constructor for ast_type_specifier.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoglsl: Clean up and clarify comment explaining initializer rules.
Matt Turner [Mon, 10 Jun 2013 20:28:40 +0000 (13:28 -0700)]
glsl: Clean up and clarify comment explaining initializer rules.

Reviewed-by: Ian Romanick <ian.d.romainck@intel.com>
11 years agoglsl: Change type of is_array to bool.
Matt Turner [Mon, 10 Jun 2013 22:59:55 +0000 (15:59 -0700)]
glsl: Change type of is_array to bool.

Reviewed-by: Ian Romanick <ian.d.romainck@intel.com>
11 years agoglsl: Add a comment to note what an exec_list is a list of.
Matt Turner [Wed, 26 Jun 2013 22:58:08 +0000 (15:58 -0700)]
glsl: Add a comment to note what an exec_list is a list of.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Ian Romanick <ian.d.romainck@intel.com>
11 years agoglsl: Fix inverted conditional in error message.
Matt Turner [Mon, 10 Jun 2013 20:28:40 +0000 (13:28 -0700)]
glsl: Fix inverted conditional in error message.

The code float a[2] = float[2]( 3.4, 4.2, 5.0 ); previously generated
this:

   error: array constructor must have at least 2 parameters

when in fact it requires exactly two.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Ian Romanick <ian.d.romainck@intel.com>
11 years agoglsl: Add missing return error_value(ctx) in error path.
Matt Turner [Sat, 29 Jun 2013 22:32:09 +0000 (15:32 -0700)]
glsl: Add missing return error_value(ctx) in error path.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Ian Romanick <ian.d.romainck@intel.com>
11 years agoglsl: Remove unnecessary #include from ast_type.cpp.
Matt Turner [Thu, 20 Jun 2013 19:03:44 +0000 (12:03 -0700)]
glsl: Remove unnecessary #include from ast_type.cpp.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Ian Romanick <ian.d.romainck@intel.com>
11 years agoglsl/build: build builtin_compiler with VISIBILITY_CFLAGS
Chia-I Wu [Thu, 11 Jul 2013 01:14:16 +0000 (09:14 +0800)]
glsl/build: build builtin_compiler with VISIBILITY_CFLAGS

libglslcore.la and libglcpp.la that are built with builtin_compiler are also
linked to by drivers not using libdricore.  Since there is no public symbol in
them, it is better to mark all symbols hidden.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agoglsl: Add comment explaining "row_major" parsing.
Matt Turner [Thu, 11 Jul 2013 18:28:58 +0000 (11:28 -0700)]
glsl: Add comment explaining "row_major" parsing.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Mark "row_major" as not a reserved word in GLSL ES 3.0.
Matt Turner [Thu, 11 Jul 2013 17:11:18 +0000 (10:11 -0700)]
glsl: Mark "row_major" as not a reserved word in GLSL ES 3.0.

We mark ARB_uniform_buffer_object as enabled under ES 3 since it
contains that functionality, which tricked the compiler into tokenizing
"row_major".

Acked-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoglsl: Remove outdated FINISHME comment.
Matt Turner [Wed, 10 Jul 2013 18:12:10 +0000 (11:12 -0700)]
glsl: Remove outdated FINISHME comment.

Explicit index support was added by commit 1256a5dc.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoradeon: bump libdrm_radeon requirement for CIK support
Alex Deucher [Thu, 11 Jul 2013 22:51:32 +0000 (18:51 -0400)]
radeon: bump libdrm_radeon requirement for CIK support

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agor600g: x/y coordinates must be divided by block dim in dma blit
Christoph Bumiller [Fri, 5 Jul 2013 18:55:36 +0000 (20:55 +0200)]
r600g: x/y coordinates must be divided by block dim in dma blit

Note: this is a candidate for the 9.1 branch.

Reviewed-by: Marek Olšák <maraeo@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agor600g/sb: Fix Android build v2
Chih-Wei Huang [Thu, 27 Jun 2013 21:31:05 +0000 (14:31 -0700)]
r600g/sb: Fix Android build v2

Add the sb CXX files to the Android Makefile and also stop using some
c++11 features.

v2 (Vadim Girlin): use &bc[0] instead of bc.begin()

11 years agor600g/sb: improve math optimizations v2
Vadim Girlin [Wed, 5 Jun 2013 16:55:31 +0000 (20:55 +0400)]
r600g/sb: improve math optimizations v2

This patch adds support for some math optimizations that are generally
considered unsafe, that's why they are currently disabled for compute
shaders.

GL requirements are less strict, so they are enabled for
for GL shaders by default. In case of any issues with
applications that rely on higher precision than guaranteed by GL,
'sbsafemath' option in R600_DEBUG allows to disable them.

v2 - always set proper src vector size for transformed instructions
   - check for clamp modifier in the expr_handler::fold_assoc

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
11 years agost/xvmc/tests: avoid non portable error.h functions
Jonathan Gray [Thu, 11 Jul 2013 07:52:00 +0000 (09:52 +0200)]
st/xvmc/tests: avoid non portable error.h functions

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Reviewed-by: Christian König <christian.koenig@amd.com>
11 years agoi965/blorp: Fix clear rectangle alignment in fast color clear
Anuj Phogat [Tue, 9 Jul 2013 23:09:14 +0000 (16:09 -0700)]
i965/blorp: Fix clear rectangle alignment in fast color clear

From BSpec: 3D-Media-GPGPU Engine > 3D Pipeline > Pixel >
Pixel Backend > MCS Buffer for Render Target(s) [DevIVB+]:
[DevHSW:GT3]: Clear rectangle must be aligned to two times
the number of pixels in the table shown below...
Observed no piglit, gles3conform regressions with this patch.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=65744

11 years agowinsys/intel: build with VISIBILITY_CFLAGS
Chia-I Wu [Thu, 11 Jul 2013 01:01:42 +0000 (09:01 +0800)]
winsys/intel: build with VISIBILITY_CFLAGS

There is no public symbol in this winsys.

11 years agoilo: reduce PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS to 12
Chia-I Wu [Thu, 11 Jul 2013 00:02:19 +0000 (08:02 +0800)]
ilo: reduce PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS to 12

So that there are at most (2^22 * 6) texels, lower than the 2^26 limit.

11 years agoilo: correctly initialize undefined registers in fs
Chia-I Wu [Wed, 10 Jul 2013 22:39:05 +0000 (06:39 +0800)]
ilo: correctly initialize undefined registers in fs

Initialize all 4 channels of undefined registers (that is, TEMPs that are used
before being assigned) in FS.

11 years agoradeonsi: Handle TGSI_OPCODE_DDX/Y using local memory
Michel Dänzer [Wed, 19 Jun 2013 16:14:01 +0000 (18:14 +0200)]
radeonsi: Handle TGSI_OPCODE_DDX/Y using local memory

16 more little piglits.

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
11 years agoradeonsi: Handle TGSI_OPCODE_TXD
Michel Dänzer [Thu, 21 Feb 2013 15:10:55 +0000 (16:10 +0100)]
radeonsi: Handle TGSI_OPCODE_TXD

One more little piglit.

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
11 years agoutil/u_math: Use xmmintrin.h whenever possible.
José Fonseca [Wed, 10 Jul 2013 06:56:17 +0000 (07:56 +0100)]
util/u_math: Use xmmintrin.h whenever possible.

It seems  __builtin_ia32_ldmxcsr is only available on gcc and only when
-msse is used. xmmintrin.h/pmmintrin.h provide portable intrinsics, but
these too are only available with gcc when -msse/-msse3 are set.

scons build always sets -msse on x86 builds, but autotools doesn't seem
to.

We could try to get this working on gcc x86 without -msse by emitting
assembly, but I believe that in this day and age we really should be
building Mesa with -msse and -msse2.

11 years agoilo: honor surface padding requirements
Chia-I Wu [Wed, 10 Jul 2013 04:05:37 +0000 (12:05 +0800)]
ilo: honor surface padding requirements

The PRM specifies several padding requirements that we failed to honor.

11 years agoutil: treat denorm'ed floats like zero
Zack Rusin [Tue, 9 Jul 2013 03:45:55 +0000 (23:45 -0400)]
util: treat denorm'ed floats like zero

The D3D10 spec is very explicit about treatment of denorm floats and
the behavior is exactly the same for them as it would be for -0 or
+0. This makes our shading code match that behavior, since OpenGL
doesn't care and on a few cpu's it's faster (worst case the same).
Float16 conversions will likely break but we'll fix them in a follow
up commit.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agomesa: Set ProfileMask properly for core profile.
Matt Turner [Mon, 8 Jul 2013 23:07:36 +0000 (16:07 -0700)]
mesa: Set ProfileMask properly for core profile.

Fixes MESA_GL_VERSION_OVERRIDE=3.2 egl-create-context-verify-gl-flavor.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Delete intel_context entirely.
Kenneth Graunke [Sat, 6 Jul 2013 07:46:38 +0000 (00:46 -0700)]
i965: Delete intel_context entirely.

This makes brw_context inherit directly from gl_context; that was the
only thing left in intel_context.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Chris Forbes <chrisf@ijw.co.nz>
Acked-by: Paul Berry <stereotype441@gmail.com>
Acked-by: Anuj Phogat <anuj.phogat@gmail.com>
11 years agoi965: Move intel_context::gen and gt fields to brw_context.
Kenneth Graunke [Sat, 6 Jul 2013 07:36:46 +0000 (00:36 -0700)]
i965: Move intel_context::gen and gt fields to brw_context.

Most functions no longer use intel_context, so this patch additionally
removes the local "intel" variables to avoid compiler warnings.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Chris Forbes <chrisf@ijw.co.nz>
Acked-by: Paul Berry <stereotype441@gmail.com>
Acked-by: Anuj Phogat <anuj.phogat@gmail.com>
11 years agoi965: Move intel_context::has_llc to brw_context.
Kenneth Graunke [Sat, 6 Jul 2013 07:20:25 +0000 (00:20 -0700)]
i965: Move intel_context::has_llc to brw_context.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Chris Forbes <chrisf@ijw.co.nz>
Acked-by: Paul Berry <stereotype441@gmail.com>
Acked-by: Anuj Phogat <anuj.phogat@gmail.com>
11 years agoi965: Move intel_context::is_<platform> flags to brw_context.
Kenneth Graunke [Sat, 6 Jul 2013 07:15:44 +0000 (00:15 -0700)]
i965: Move intel_context::is_<platform> flags to brw_context.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Chris Forbes <chrisf@ijw.co.nz>
Acked-by: Paul Berry <stereotype441@gmail.com>
Acked-by: Anuj Phogat <anuj.phogat@gmail.com>
11 years agoi965: Move must_use/has_separate_stencil fields to brw_context.
Kenneth Graunke [Sat, 6 Jul 2013 06:43:36 +0000 (23:43 -0700)]
i965: Move must_use/has_separate_stencil fields to brw_context.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Chris Forbes <chrisf@ijw.co.nz>
Acked-by: Paul Berry <stereotype441@gmail.com>
Acked-by: Anuj Phogat <anuj.phogat@gmail.com>
11 years agoi965: Move intel_context::has_hiz to brw_context.
Kenneth Graunke [Thu, 4 Jul 2013 19:45:39 +0000 (12:45 -0700)]
i965: Move intel_context::has_hiz to brw_context.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Chris Forbes <chrisf@ijw.co.nz>
Acked-by: Paul Berry <stereotype441@gmail.com>
Acked-by: Anuj Phogat <anuj.phogat@gmail.com>
11 years agoi965: Free brw, not intel.
Kenneth Graunke [Thu, 4 Jul 2013 17:37:31 +0000 (10:37 -0700)]
i965: Free brw, not intel.

Things worked out in the past because both brw and intel share the same
memory address (by virtue of intel being the first member of brw).

However, brw is what actually gets rzalloc'd (brw_context.c:285), so
freeing that seems safer and more obvious.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Chris Forbes <chrisf@ijw.co.nz>
Acked-by: Paul Berry <stereotype441@gmail.com>
Acked-by: Anuj Phogat <anuj.phogat@gmail.com>
11 years agoi965: Shorten context base class dereference chains.
Kenneth Graunke [Thu, 4 Jul 2013 06:32:20 +0000 (23:32 -0700)]
i965: Shorten context base class dereference chains.

ctx->DrawBuffer is much more sensible than brw->intel.ctx.DrawBuffer.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Chris Forbes <chrisf@ijw.co.nz>
Acked-by: Paul Berry <stereotype441@gmail.com>
Acked-by: Anuj Phogat <anuj.phogat@gmail.com>
11 years agoi965: Move intel_context::has_swizzling to brw_context.
Kenneth Graunke [Wed, 3 Jul 2013 22:00:34 +0000 (15:00 -0700)]
i965: Move intel_context::has_swizzling to brw_context.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Chris Forbes <chrisf@ijw.co.nz>
Acked-by: Paul Berry <stereotype441@gmail.com>
Acked-by: Anuj Phogat <anuj.phogat@gmail.com>
11 years agoi965: Move intel_context::intelScreen to brw_context.
Kenneth Graunke [Wed, 3 Jul 2013 21:55:19 +0000 (14:55 -0700)]
i965: Move intel_context::intelScreen to brw_context.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Chris Forbes <chrisf@ijw.co.nz>
Acked-by: Paul Berry <stereotype441@gmail.com>
Acked-by: Anuj Phogat <anuj.phogat@gmail.com>
11 years agoi965: Delete unused intel_context::driFd field.
Kenneth Graunke [Wed, 3 Jul 2013 21:52:34 +0000 (14:52 -0700)]
i965: Delete unused intel_context::driFd field.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Chris Forbes <chrisf@ijw.co.nz>
Acked-by: Paul Berry <stereotype441@gmail.com>
Acked-by: Anuj Phogat <anuj.phogat@gmail.com>
11 years agoi965: Store brw_context as the DRI driver private, not intel_context.
Kenneth Graunke [Thu, 4 Jul 2013 17:30:47 +0000 (10:30 -0700)]
i965: Store brw_context as the DRI driver private, not intel_context.

Right now, they're interchangeable.  In the future, intel_context will
either go away or change purpose.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Chris Forbes <chrisf@ijw.co.nz>
Acked-by: Paul Berry <stereotype441@gmail.com>
Acked-by: Anuj Phogat <anuj.phogat@gmail.com>
11 years agoi965: Move intel_context::driContext to brw_context.
Kenneth Graunke [Thu, 4 Jul 2013 17:30:01 +0000 (10:30 -0700)]
i965: Move intel_context::driContext to brw_context.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Chris Forbes <chrisf@ijw.co.nz>
Acked-by: Paul Berry <stereotype441@gmail.com>
Acked-by: Anuj Phogat <anuj.phogat@gmail.com>
11 years agoi965: Move intel_context::NewGLState to brw_context.
Kenneth Graunke [Thu, 4 Jul 2013 17:29:50 +0000 (10:29 -0700)]
i965: Move intel_context::NewGLState to brw_context.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Chris Forbes <chrisf@ijw.co.nz>
Acked-by: Paul Berry <stereotype441@gmail.com>
Acked-by: Anuj Phogat <anuj.phogat@gmail.com>
11 years agoi965: Move intel_context::upload to brw_context.
Kenneth Graunke [Wed, 3 Jul 2013 21:46:44 +0000 (14:46 -0700)]
i965: Move intel_context::upload to brw_context.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Chris Forbes <chrisf@ijw.co.nz>
Acked-by: Paul Berry <stereotype441@gmail.com>
Acked-by: Anuj Phogat <anuj.phogat@gmail.com>
11 years agoi965: Move intel_context::max_gtt_map_object_size to brw_context.
Kenneth Graunke [Wed, 3 Jul 2013 21:44:07 +0000 (14:44 -0700)]
i965: Move intel_context::max_gtt_map_object_size to brw_context.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Chris Forbes <chrisf@ijw.co.nz>
Acked-by: Paul Berry <stereotype441@gmail.com>
Acked-by: Anuj Phogat <anuj.phogat@gmail.com>
11 years agoi965: Move intel_context::perf_debug to brw_context.
Kenneth Graunke [Wed, 3 Jul 2013 21:41:58 +0000 (14:41 -0700)]
i965: Move intel_context::perf_debug to brw_context.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Chris Forbes <chrisf@ijw.co.nz>
Acked-by: Paul Berry <stereotype441@gmail.com>
Acked-by: Anuj Phogat <anuj.phogat@gmail.com>
11 years agoi965: Move intel_context::no_batch_wrap to brw_context.
Kenneth Graunke [Wed, 3 Jul 2013 21:29:56 +0000 (14:29 -0700)]
i965: Move intel_context::no_batch_wrap to brw_context.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Chris Forbes <chrisf@ijw.co.nz>
Acked-by: Paul Berry <stereotype441@gmail.com>
Acked-by: Anuj Phogat <anuj.phogat@gmail.com>
11 years agoi965: Move intel_context's framerate throttling fields to brw_context.
Kenneth Graunke [Wed, 3 Jul 2013 21:28:29 +0000 (14:28 -0700)]
i965: Move intel_context's framerate throttling fields to brw_context.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Chris Forbes <chrisf@ijw.co.nz>
Acked-by: Paul Berry <stereotype441@gmail.com>
Acked-by: Anuj Phogat <anuj.phogat@gmail.com>
11 years agoi965: Move intel_context::stats_wm to brw_context.
Kenneth Graunke [Wed, 3 Jul 2013 21:26:01 +0000 (14:26 -0700)]
i965: Move intel_context::stats_wm to brw_context.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Chris Forbes <chrisf@ijw.co.nz>
Acked-by: Paul Berry <stereotype441@gmail.com>
Acked-by: Anuj Phogat <anuj.phogat@gmail.com>