mesa.git
11 years agodocs: Mark a few things as in progress.
Kenneth Graunke [Tue, 14 May 2013 19:22:09 +0000 (12:22 -0700)]
docs: Mark a few things as in progress.

11 years agodraw: try to prevent overflows on index buffers
Zack Rusin [Tue, 14 May 2013 03:07:14 +0000 (23:07 -0400)]
draw: try to prevent overflows on index buffers

Pass in the size of the index buffer, when available, and use it
to handle out of bounds conditions. The behavior in the case of
an overflow needs to be the same as with other overflows in the
vertex processing pipeline meaning that a vertex should still
be generated but all attributes in it set to zero.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agodraw: use the total number of vertices for statistics
Zack Rusin [Tue, 14 May 2013 02:41:25 +0000 (22:41 -0400)]
draw: use the total number of vertices for statistics

the number of vertices to fetch doesn't necessarily equal the
total number of input vertices, e.g. we might want to fetch
a single vertex but then draw it twice. Lets use the correct
number of input vertices in the statistics.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agodraw: don't crash on vertex buffer overflow
Zack Rusin [Thu, 9 May 2013 03:48:20 +0000 (23:48 -0400)]
draw: don't crash on vertex buffer overflow

We would crash when stride was bigger than the size of the buffer.
The correct behavior is to just fetch zero's in this case.
Unfortunatly with user_buffer's there's no way to validate the size
because currently we're just not getting it. Adjust the draw interface
to pass the size along the mapped buffer, which works perfectly
for buffer backed vertex_buffers and, in future, it will allow
us to plumb user_buffer sizes through the same interface.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agogallivm/soa: implement indirect addressing in immediates
Zack Rusin [Tue, 7 May 2013 19:59:56 +0000 (15:59 -0400)]
gallivm/soa: implement indirect addressing in immediates

The support is analogous to the way we handle indirect addressing
in temporaries, except that we don't have to worry about storing
(after declarations) and thus we'll able to keep using the old
code when indirect addressing isn't used. In other words we're
still using constants directly, unless the instruction has
immediate register with indirect addressing.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agodraw/gs: don't bind the tgsi state if we're using llvm paths
Zack Rusin [Fri, 3 May 2013 16:22:08 +0000 (12:22 -0400)]
draw/gs: don't bind the tgsi state if we're using llvm paths

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agogallivm: Fix build with LLVM >= 3.4 r181680.
Vinson Lee [Mon, 13 May 2013 03:37:17 +0000 (20:37 -0700)]
gallivm: Fix build with LLVM >= 3.4 r181680.

Tested-by: Laurent Carlier <lordheavym@gmail.com>
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
11 years agomesa/st: Temporary workaround for fdo bug 64568.
José Fonseca [Tue, 14 May 2013 15:55:56 +0000 (16:55 +0100)]
mesa/st: Temporary workaround for fdo bug 64568.

Effectively reverting the problematic hunk of
commit 614ee25077b7ffafeb87b22563d01856824fb4bc

11 years agoradeonsi: add Hainan pci ids
Alex Deucher [Mon, 13 May 2013 20:25:51 +0000 (16:25 -0400)]
radeonsi: add Hainan pci ids

Note: this is a candidate for the 9.1 branch

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
11 years agoradeonsi: update r600_get_llvm_processor_name for hainan
Alex Deucher [Mon, 13 May 2013 20:44:40 +0000 (16:44 -0400)]
radeonsi: update r600_get_llvm_processor_name for hainan

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
11 years agoradeonsi: add support for hainan chips
Alex Deucher [Mon, 13 May 2013 20:24:02 +0000 (16:24 -0400)]
radeonsi: add support for hainan chips

Note: this is a candidate for the 9.1 branch

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
11 years agodraw: Fix io_ptr/num_prims name in IR.
José Fonseca [Tue, 14 May 2013 13:18:42 +0000 (14:18 +0100)]
draw: Fix io_ptr/num_prims name in IR.

Trivial.

11 years agograw/tgsi_dump: Fix gdb macro.
José Fonseca [Mon, 13 May 2013 14:15:59 +0000 (15:15 +0100)]
graw/tgsi_dump: Fix gdb macro.

The macro was relying on "tokens" local variable to exist.

11 years agor600g/sb: add missing cases for ARUBA chips
Vadim Girlin [Tue, 14 May 2013 13:11:38 +0000 (17:11 +0400)]
r600g/sb: add missing cases for ARUBA chips

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
11 years agor600g/sb: get rid of standard c++ streams
Vadim Girlin [Tue, 14 May 2013 13:08:38 +0000 (17:08 +0400)]
r600g/sb: get rid of standard c++ streams

Static initialization of internal libstdc++ data related to iostream
causes segfaults with some apps.

This patch replaces all uses of std::ostream and std::ostringstream in sb
with custom lightweight classes.

Prevents segfaults with ut2004demo and probably some other old apps.

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
11 years agor600g/sb: separate bytecode decoding and parsing
Vadim Girlin [Sat, 11 May 2013 14:30:30 +0000 (18:30 +0400)]
r600g/sb: separate bytecode decoding and parsing

Parsing and ir construction is required for optimization only,
it's unnecessary if we only need to print shader dump.
This should make new disassembler more tolerant to any new
features in the bytecode.

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
11 years agovl/vdpau: fix PresentationQueueQuerySurfaceStatus
Christian König [Wed, 8 May 2013 15:03:01 +0000 (17:03 +0200)]
vl/vdpau: fix PresentationQueueQuerySurfaceStatus

The last queued surface always keeps displaying.

Fixing a problem with XBMC.

Signed-off-by: Christian König <christian.koenig@amd.com>
11 years agoilo: rework ilo_texture
Chia-I Wu [Mon, 13 May 2013 07:19:55 +0000 (15:19 +0800)]
ilo: rework ilo_texture

Use ilo_buffer for buffer resources and ilo_texture for texture resources.  A
major cleanup is necessitated by the separation.

11 years agoilo: rename ilo_resource to ilo_texture
Chia-I Wu [Mon, 13 May 2013 07:10:34 +0000 (15:10 +0800)]
ilo: rename ilo_resource to ilo_texture

In preparation for the introduction of ilo_buffer.

11 years agoilo: move transfer-related functions to a new file
Chia-I Wu [Mon, 13 May 2013 06:29:09 +0000 (14:29 +0800)]
ilo: move transfer-related functions to a new file

Resource mapping is distinct from resource allocation, and is going to get
more and more complex.  Move the related functions to a new file to make the
separation clear.

11 years agoi965: Add missing Haswell GT3 Desktop to IS_HSW_GT3 check.
Rodrigo Vivi [Mon, 13 May 2013 20:53:38 +0000 (17:53 -0300)]
i965: Add missing Haswell GT3 Desktop to IS_HSW_GT3 check.

NOTE: This is a candidate for stable branches.

Signed-off-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: write layer if gl_Layer is used in VS
Jordan Justen [Wed, 17 Apr 2013 23:17:50 +0000 (16:17 -0700)]
i965: write layer if gl_Layer is used in VS

This is enabled by the AMD_vertex_shader_layer extension.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoglsl: add AMD_vertex_shader_layer support
Jordan Justen [Wed, 27 Mar 2013 20:58:04 +0000 (13:58 -0700)]
glsl: add AMD_vertex_shader_layer support

This GLSL extension requires that AMD_vertex_shader_layer be
enabled by the driver.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoextensions: add AMD_vertex_shader_layer
Jordan Justen [Wed, 27 Mar 2013 20:53:21 +0000 (13:53 -0700)]
extensions: add AMD_vertex_shader_layer

This extension will require driver support, so it must
be enabled by the driver.

http://www.opengl.org/registry/specs/AMD/vertex_shader_layer.txt

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agomesa: Expose GL_OES_texture_npot on GLES1
Chad Versace [Wed, 8 May 2013 16:46:21 +0000 (09:46 -0700)]
mesa: Expose GL_OES_texture_npot on GLES1

Mesa's extension table incorrectly lists this GL_OES_texture_npot as
ES2-only. It's also an ES1 extension. This patch adds ES1 to the
extensions API mask.

From the GL_OES_texture_npot spec:
    OpenGL ES 1.0 or OpenGL ES 2.0 is required. This extension is
    written against OpenGL ES 1.1.12 and OpenGL ES 2.0.25.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Death to array dereferences of vectors!
Ian Romanick [Sat, 23 Mar 2013 00:49:27 +0000 (17:49 -0700)]
glsl: Death to array dereferences of vectors!

Now that all the places that used to generate array derefeneces of
vectors have been changed to generate either ir_binop_vector_extract or
ir_triop_vector_insert (or both), remove all support for dealing with
this deprecated construct.

As an added safeguard, modify ir_validate to reject ir_dereference_array
of a vector.

v2: Convert tabs to spaces.  Suggested by Eric.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Generate correct ir_binop_vector_extract code for out and inout parameters
Ian Romanick [Sat, 23 Mar 2013 00:45:52 +0000 (17:45 -0700)]
glsl: Generate correct ir_binop_vector_extract code for out and inout parameters

Like with type conversions on out parameters, some extra copies need to
occur to handle these cases.  The fundamental problem is that
ir_binop_vector_extract is not an lvalue, but out and inout parameters
must be lvalues.  A previous patch delt with a similar problem in the
LHS of ir_assignment.

v2: Convert tabs to spaces.  Suggested by Eric.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Use vector-insert and vector-extract on elements of gl_ClipDistanceMESA
Ian Romanick [Sat, 23 Mar 2013 00:42:38 +0000 (17:42 -0700)]
glsl: Use vector-insert and vector-extract on elements of gl_ClipDistanceMESA

Variable indexing into vectors using ir_dereference_array is being
removed, so this lowering pass has to generate something different.

v2: Convert tabs to spaces.  Suggested by Eric.

v3: Simplify code slightly by assuming that elements of
gl_ClipDistanceMESA will always be vec4.  Suggested by Paul.

v4: Fairly substantial rewrite based on the rewrite of "glsl: Convert
lower_clip_distance_visitor to be an ir_rvalue_visitor"

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoglsl: Remove some stale comments about ir_call
Ian Romanick [Wed, 8 May 2013 17:59:47 +0000 (10:59 -0700)]
glsl: Remove some stale comments about ir_call

ir_call was changed long ago to be a statement rather than an
expression.  That makes this comment no longer valid.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoglsl: Convert lower_clip_distance_visitor to be an ir_rvalue_visitor
Ian Romanick [Wed, 8 May 2013 17:48:55 +0000 (10:48 -0700)]
glsl: Convert lower_clip_distance_visitor to be an ir_rvalue_visitor

Right now the lower_clip_distance_visitor lowers variable indexing into
gl_ClipDistance into variable indexing into both the array
gl_ClipDistanceMESA and the vectors of that array.  For example,

    gl_ClipDistance[i] = f;

becomes

    gl_ClipDistanceMESA[i >> 2][i & 3] = f;

However, variable indexing into vectors using ir_dereference_array is
being removed.  Instead, ir_expression with ir_triop_vector_insert will
be used.  The above code will become

    gl_ClipDistanceMESA[i >> 2] =
        vector_insert(gl_ClipDistanceMESA[i >> 2], i & 3, f);

In order to do this, an ir_rvalue_visitor will need to be used.  This
commit is really just a refactor to get ready for that.

v4: Split the least amount of refactor from the rest of the code
changes.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoglsl: Generate ir_binop_vector_extract for indexing of vectors
Ian Romanick [Sat, 16 Mar 2013 01:08:22 +0000 (18:08 -0700)]
glsl: Generate ir_binop_vector_extract for indexing of vectors

Now ir_dereference_array of a vector will never occur in the RHS of an
expression.

v2: Add back the { } around the if-statement body to make it more
readable.  Suggested by Eric.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Convert ir_binop_vector_extract in the LHS to ir_triop_vector_insert
Ian Romanick [Sat, 16 Mar 2013 01:06:11 +0000 (18:06 -0700)]
glsl: Convert ir_binop_vector_extract in the LHS to ir_triop_vector_insert

The ast_array_index code can't know whether to generate an
ir_binop_vector_extract or an ir_triop_vector_insert.  Instead it will
always generate ir_binop_vector_extract, and the LHS and RHS have to be
re-written.

v2: Convert tabs to spaces.  Suggested by Eric.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Add lowering pass for ir_triop_vector_insert
Ian Romanick [Mon, 18 Mar 2013 21:45:53 +0000 (14:45 -0700)]
glsl: Add lowering pass for ir_triop_vector_insert

This will eventually replace do_vec_index_to_cond_assign.  This lowering
pass is called in all the places where do_vec_index_to_cond_assign or
do_vec_index_to_swizzle is called.

v2: Use WRITEMASK_* instead of integer literals.  Use a more concise
method of generating broadcast_index.  Both suggested by Eric.

v3: Use a series of scalar compares instead of a single vector compare.
Suggested by Eric and Ken.  It still uses 'if (cond) v.x = y;' instead
of conditional assignments because ir_builder doesn't do conditional
assignments, and I'd rather keep the code simple.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Lower ir_binop_vector_extract to conditional moves
Ian Romanick [Tue, 26 Mar 2013 21:22:03 +0000 (14:22 -0700)]
glsl: Lower ir_binop_vector_extract to conditional moves

Lower ir_binop_vector_extract with a non-constant index to a series of
conditional moves.  This is exactly like ir_dereference_array of a
vector with a non-constant index.

v2: Convert tabs to spaces.  Suggested by Eric.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Lower ir_binop_vector_extract to swizzle
Ian Romanick [Fri, 15 Mar 2013 21:36:46 +0000 (14:36 -0700)]
glsl: Lower ir_binop_vector_extract to swizzle

Lower ir_binop_vector_extract with a constant index to a swizzle.  This
is exactly like ir_dereference_array of a vector with a constant index.

v2: Convert tabs to spaces.  Suggested by Eric.

v3: Correctly call convert_vector_extract_to_swizzle in
ir_vec_index_to_swizzle_visitor::visit_enter(ir_call *ir).  Suggested by
Ken.

v4: Use CLAMP instead of MIN2(MAX2()).  Suggested by Ken.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Refactor part of convert_vec_index_to_cond_assign
Ian Romanick [Wed, 6 Mar 2013 01:47:35 +0000 (17:47 -0800)]
glsl: Refactor part of convert_vec_index_to_cond_assign

Use a first function that extract the vector being indexed and the index
from the deref.  Call the second function that does the real work.

Coming patches will add a new ir_expression for variable indexing into a
vector.  Having the lowering pass split into two functions will make it
much easier to lower the new ir_expression.

v2: Convert tabs to spaces.  Suggested by Eric.

v3: Move some bits from a later patch back to this patch so that it
actually compiles.  Suggested by Ken.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Add ir_triop_vector_insert
Ian Romanick [Tue, 12 Mar 2013 19:42:51 +0000 (12:42 -0700)]
glsl: Add ir_triop_vector_insert

The new opcode is used to generate a new vector with a single field from
the source vector replaced.  This will eventually replace
ir_dereference_array of vectors in the LHS of assignments.

v2: Convert tabs to spaces.  Suggested by Eric.

v3: Add constant expression handling for ir_triop_vector_insert.  This
prevents the constant matrix inversion tests from regressing.  Duh.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Add ir_binop_vector_extract
Ian Romanick [Wed, 6 Mar 2013 19:05:14 +0000 (11:05 -0800)]
glsl: Add ir_binop_vector_extract

The new opcode is used to get a single field from a vector.  The field
index may not be constant.  This will eventually replace
ir_dereference_array of vectors.  This is similar to the extractelement
instruction in LLVM IR.

http://llvm.org/docs/LangRef.html#extractelement-instruction

v2: Convert tabs to spaces.  Suggested by Eric.

v3: Add array index range checking to ir_binop_vector_extract constant
expression handling.  Suggested by Ken.

v4: Use CLAMP instead of MIN2(MAX2()).  Suggested by Ken.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Fix "make check" breakage after adding options to do_common_optimization.
Paul Berry [Mon, 13 May 2013 14:52:08 +0000 (07:52 -0700)]
glsl: Fix "make check" breakage after adding options to do_common_optimization.

Commit b765740 (glsl: Pass struct shader_compiler_options into
do_common_optimization.) added a new parameter to
do_common_optimization() but didn't update test_optpass.cpp, causing
"make check" to break.

This patch makes the proper updates to test_optpass.cpp so that the
build succeeds again.

11 years agoglsl: Add a pass to flip matrix/vector multiplies to use dot products.
Kenneth Graunke [Thu, 18 Apr 2013 00:30:25 +0000 (17:30 -0700)]
glsl: Add a pass to flip matrix/vector multiplies to use dot products.

This pass flips (matrix * vector) operations to (vector *
matrixTranspose) for certain built-in matrices (currently
gl_ModelViewProjectionMatrix and gl_TextureMatrix).

This is equivalent, but results in dot products rather than multiplies
and adds.  On some hardware, this is more efficient.

This pass is conditionalized on ctx->mvp_with_dp4, the flag drivers set
to indicate they prefer dot products.

Improves performance in Lightsmark by 1.01131% +/- 0.162069% (n = 10)
on a Haswell GT2 system.  Passes Piglit on Ivybridge.

v2: Use struct gl_shader_compiler_options instead of plumbing through
    another boolean flag for this purpose.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965/vs: Set the PreferDP4 shader compiler option.
Kenneth Graunke [Thu, 18 Apr 2013 00:30:24 +0000 (17:30 -0700)]
i965/vs: Set the PreferDP4 shader compiler option.

Doing matrix multiplies with DP4s is fewer instructions than MUL/ADD,
especially since we don't support MAD in the vertex shader.

Not observed to improve performance in any fixed function applications,
but is useful for the next patch.

I've left this unset for the fragment shader because the scalar backend
can't use DP4 and does have MAD support.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agomesa: Move the mvp_with_dp4 flag to ShaderCompilerOptions.
Kenneth Graunke [Thu, 18 Apr 2013 00:30:23 +0000 (17:30 -0700)]
mesa: Move the mvp_with_dp4 flag to ShaderCompilerOptions.

This flag essentially tells the compiler whether it prefers
dot products or multiply/adds for matrix operations.  As such,
ShaderCompilerOptions seems like the right place for it.

This also lets us specify it on a per-stage basis.  This patch makes all
existing users set the flag for the Vertex Shader stage only, as it's
currently only used for fixed-function vertex programs.  That will
change soon, and I wanted to preserve the existing behavior.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoglsl: Pass struct shader_compiler_options into do_common_optimization.
Kenneth Graunke [Thu, 18 Apr 2013 00:30:22 +0000 (17:30 -0700)]
glsl: Pass struct shader_compiler_options into do_common_optimization.

do_common_optimization may need to make choices about whether to emit
certain kinds of instructions.  gl_context::ShaderCompilerOptions
contains exactly that information, so it makes sense to pass it in.

Rather than passing the whole array, pass the structure for the stage
that's currently being worked on.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoglsl: Initialize ctx->ShaderCompilerOptions in standalone scaffolding.
Kenneth Graunke [Thu, 18 Apr 2013 00:30:21 +0000 (17:30 -0700)]
glsl: Initialize ctx->ShaderCompilerOptions in standalone scaffolding.

This code is copied from _mesa_init_shader_state().

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoglsl: Copy _mesa_shader_type_to_index() to standalone scaffolding.
Kenneth Graunke [Thu, 18 Apr 2013 00:30:20 +0000 (17:30 -0700)]
glsl: Copy _mesa_shader_type_to_index() to standalone scaffolding.

We can't include shaderobj.h from the standalone utilities, so we
unfortunately have to copy this function.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agomesa: Add comments about bit-ordering of new XRGB/XBGR formats.
Kenneth Graunke [Mon, 29 Apr 2013 06:33:39 +0000 (23:33 -0700)]
mesa: Add comments about bit-ordering of new XRGB/XBGR formats.

Marek added these new formats in commit f9fa725690c470daf308, but
without comments relating to the packing.  Sometimes the naming is
confusing, so these comments are helpful in determining whether two
formats are compatible.

The new comments are based on my reading of format_unpack.c.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
11 years agost/mesa: remove dependency on _NEW_BUFFER_OBJECT for vertex arrays
Marek Olšák [Fri, 26 Apr 2013 12:45:06 +0000 (14:45 +0200)]
st/mesa: remove dependency on _NEW_BUFFER_OBJECT for vertex arrays

_NEW_BUFFER_OBJECT means glBufferData was called. We can just set our own
flag in BufferData.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agost/mesa: don't check for _NEW_PROGRAM when binding UBOs
Marek Olšák [Fri, 26 Apr 2013 12:42:10 +0000 (14:42 +0200)]
st/mesa: don't check for _NEW_PROGRAM when binding UBOs

Probably copied from i965. However st/mesa has its flags ST_NEW_xxx_PROGRAM.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agost/mesa: fix a couple of issues in st_bind_ubos
Marek Olšák [Thu, 25 Apr 2013 23:54:41 +0000 (01:54 +0200)]
st/mesa: fix a couple of issues in st_bind_ubos

- don't reference a buffer for a local variable
  (that's never useful unless it can be the only reference to the buffer)
- check if the buffer is not NULL
- set buffer_size as specified with BindBufferRange

NOTE: This is a candidate for the 9.1 branch.

Reviewed-by: Fredrik Höglund <fredrik@kde.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agost/mesa: restore the transfer_inline_write path for BufferData
Marek Olšák [Thu, 25 Apr 2013 20:12:47 +0000 (22:12 +0200)]
st/mesa: restore the transfer_inline_write path for BufferData

Version 2 that shouldn't crash.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agost/mesa: initialize Const.MaxColorAttachments
Marek Olšák [Thu, 2 May 2013 01:29:47 +0000 (03:29 +0200)]
st/mesa: initialize Const.MaxColorAttachments

NOTE: This is a candidate for the stable branches.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agogallium: add PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE for GL
Marek Olšák [Thu, 2 May 2013 01:24:33 +0000 (03:24 +0200)]
gallium: add PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE for GL

v2: fix typo 65535 -> 65536

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agost/mesa: consolidate setting MaxTextureImageUnits
Marek Olšák [Thu, 2 May 2013 00:41:11 +0000 (02:41 +0200)]
st/mesa: consolidate setting MaxTextureImageUnits

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agost/mesa: initialize all program constants and UBO limits
Marek Olšák [Thu, 2 May 2013 00:38:43 +0000 (02:38 +0200)]
st/mesa: initialize all program constants and UBO limits

Also simplify UBO support checking.

NOTE: This is a candidate for the 9.1 branch.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agoglsl: fix the value of gl_MaxFragmentUniformVectors
Marek Olšák [Wed, 1 May 2013 23:44:14 +0000 (01:44 +0200)]
glsl: fix the value of gl_MaxFragmentUniformVectors

NOTE: This is a candidate for the 9.1 branch.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agomesa: add & use a new driver flag for UBO updates instead of _NEW_BUFFER_OBJECT
Marek Olšák [Fri, 26 Apr 2013 12:21:09 +0000 (14:21 +0200)]
mesa: add & use a new driver flag for UBO updates instead of _NEW_BUFFER_OBJECT

v2: move the flagging from intel_bufferobj_data to intel_bufferobj_alloc_buffer

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agomesa: skip _MaxElement computation unless driver needs strict bounds checking
Marek Olšák [Thu, 25 Apr 2013 23:17:47 +0000 (01:17 +0200)]
mesa: skip _MaxElement computation unless driver needs strict bounds checking

If Const.CheckArrayBounds is false, the only code using _MaxElement is
glDrawRangeElements, so I changed it and explained in the code why
_MaxElement is not very useful there.

BTW, the big magic number was copied to the letter
from _mesa_update_array_max_element.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agomesa: remove unused gl_array_object::NewArray
Marek Olšák [Thu, 25 Apr 2013 22:50:55 +0000 (00:50 +0200)]
mesa: remove unused gl_array_object::NewArray

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agomesa: remove unused gl_constants::MaxColorTableSize
Marek Olšák [Thu, 2 May 2013 02:09:04 +0000 (04:09 +0200)]
mesa: remove unused gl_constants::MaxColorTableSize

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agomesa: unify MaxVertexVaryingComponents and MaxGeometryVaryingComponents
Marek Olšák [Thu, 2 May 2013 01:44:35 +0000 (03:44 +0200)]
mesa: unify MaxVertexVaryingComponents and MaxGeometryVaryingComponents

The limits should not be different and OpenGL requires both to be at least 32,
which is also the maximum limit on radeon.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agomesa: move max texture image unit constants to gl_program_constants
Marek Olšák [Thu, 2 May 2013 00:30:44 +0000 (02:30 +0200)]
mesa: move max texture image unit constants to gl_program_constants

Const.MaxTextureImageUnits -> Const.FragmentProgram.MaxTextureImageUnits
Const.MaxVertexTextureImageUnits -> Const.VertexProgram.MaxTextureImageUnits
etc.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agomesa: consolidate definitions of max texture image units
Marek Olšák [Wed, 1 May 2013 23:22:48 +0000 (01:22 +0200)]
mesa: consolidate definitions of max texture image units

Shaders are unified on most hardware (= same limits in all stages).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agoilo: Initialize read_back in transfer_map_sys.
Vinson Lee [Fri, 10 May 2013 05:42:10 +0000 (22:42 -0700)]
ilo: Initialize read_back in transfer_map_sys.

Fixes "Uninitialized scalar variable" defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
11 years agor600g: increase array size for shader inputs and outputs
Marek Olšák [Thu, 2 May 2013 03:08:08 +0000 (05:08 +0200)]
r600g: increase array size for shader inputs and outputs

and add assertions to prevent buffer overflow. This fixes corruption
of the r600_shader struct.

NOTE: This is a candidate for the stable branches.

11 years agotargets/dri-i915: Force c++ linker in all cases
Chí-Thanh Christopher Nguyễn [Mon, 6 May 2013 18:29:37 +0000 (20:29 +0200)]
targets/dri-i915: Force c++ linker in all cases

NOTE: This is a candidate for the 9.1 branch.
Bugzilla: https://bugs.gentoo.org/show_bug.cgi?id=461696
Reviewed-by: Andreas Boll <andreas.boll.dev@gmail.com>
11 years agoi965: Actually use the user timeout in glClientWaitSync.
Ben Widawsky [Wed, 8 May 2013 05:42:39 +0000 (22:42 -0700)]
i965: Actually use the user timeout in glClientWaitSync.

Use the new libdrm functionality to actually do timed waits on the sync
object.

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965: make GT3 machines work as GT3 instead of GT2
Paulo Zanoni [Fri, 10 Aug 2012 15:06:37 +0000 (12:06 -0300)]
i965: make GT3 machines work as GT3 instead of GT2

We were not allowed to say the "GT3" name, but we really needed to
have the PCI IDs because too many people had such machines, so we had
to make the GT3 machines work as GT2.

Let's just say that GT2_PLUS was a short for GT2_PLUS_1 :)

NOTE: This is a candidate for stable branches.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Add chipset limits for the Haswell GT3 variant.
Kenneth Graunke [Wed, 7 Mar 2012 17:58:15 +0000 (09:58 -0800)]
i965: Add chipset limits for the Haswell GT3 variant.

NOTE: This is a candidate for stable branches.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
11 years agoi965: Update URB partitioning code for Haswell's GT3 variant.
Kenneth Graunke [Sat, 24 Sep 2011 07:12:58 +0000 (00:12 -0700)]
i965: Update URB partitioning code for Haswell's GT3 variant.

Haswell's GT3 variant offers 32kB of URB space for push constants, while
GT1 and GT2 match Ivybridge, providing 16kB.  Update the code to reserve
the full 32kB on GT3.

v2: Specify push constant size correctly.  I thought GT3 reinterpreted
    the value as multiples of 2kB, but it doesn't.  You simply have to
    program an even number.

NOTE: This is a candidate for stable branches.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Delete dead intel_span.c symlink.
Kenneth Graunke [Wed, 8 May 2013 23:45:24 +0000 (16:45 -0700)]
i965: Delete dead intel_span.c symlink.

11 years agoi965/vs: Make virtual grf live intervals actually cover their used range.
Eric Anholt [Tue, 30 Apr 2013 22:15:21 +0000 (15:15 -0700)]
i965/vs: Make virtual grf live intervals actually cover their used range.

This is the same change as the previous commit to the FS.  A very few VSes
are regressed by 1 or 2 instructions, which look recoverable with a bit
more dead code elimination.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoi965/fs: Make virtual grf live intervals actually cover their used range.
Eric Anholt [Tue, 30 Apr 2013 22:00:40 +0000 (15:00 -0700)]
i965/fs: Make virtual grf live intervals actually cover their used range.

Previously, we would sometimes not consider a write to a register to
extend the end of the interval, nor would we consider a read before a
write to extend the start.  This made for a bunch of complicated logic
related to how to treat the results when dead code might be present.
Instead, just extend the interval and fix dead code elimination to know
how to remove it.

Interestingly, this actually results in a tiny bit more optimization:
total instructions in shared programs: 1391220 -> 1390799 (-0.03%)
instructions in affected programs:     14037 -> 13616 (-3.00%)

v2: Fix a theoretical problem with the simd16 workaround if dst == src,
    where we would revert the bump of the live range.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> (v1)
11 years agodocs: document GALLIUM_HUD and LIBGL_SHOW_FPS
Marek Olšák [Tue, 26 Mar 2013 02:19:10 +0000 (03:19 +0100)]
docs: document GALLIUM_HUD and LIBGL_SHOW_FPS

11 years agoilo: Add support for HW primitive restart.
Courtney Goeltzenleuchter [Wed, 8 May 2013 20:52:13 +0000 (14:52 -0600)]
ilo: Add support for HW primitive restart.

Now tells Gallium that ilo supports primitive restart.
Updated ilo_draw_vbo to be able to check that the indexed
primitive being rendered can actually be supported in HW. If not,
will break up into individual prims similar to what Mesa does.

[olv: a minor fix after rebasing and formatting]

11 years agosvga: misc whitespace and comment fixes in svga_cmd.c
Brian Paul [Wed, 8 May 2013 17:08:33 +0000 (11:08 -0600)]
svga: misc whitespace and comment fixes in svga_cmd.c

11 years agodocs: remove ^M chars from GL3.txt
Brian Paul [Wed, 8 May 2013 17:07:46 +0000 (11:07 -0600)]
docs: remove ^M chars from GL3.txt

11 years agost/mesa: generate GL_OUT_OF_MEMORY if we can't create the index buffer
Brian Paul [Wed, 8 May 2013 16:18:49 +0000 (10:18 -0600)]
st/mesa: generate GL_OUT_OF_MEMORY if we can't create the index buffer

Before, if we failed to allocate the index buffer we'd silently
return from st_draw_vbo() without drawing anything.  We should
raise GL_OUT_OF_MEMORY to give some indication that something went
wrong.

Note: This is a candidate for the stable branches.

Reviewed-by: Marek Olšák <maraeo@gmail.com>
11 years agoilo: add support for PIPE_FORMAT_ETC1_RGB8
Chia-I Wu [Thu, 9 May 2013 07:14:11 +0000 (15:14 +0800)]
ilo: add support for PIPE_FORMAT_ETC1_RGB8

It is decompressed to and stored as PIPE_FORMAT_R8G8B8X8_UNORM on-the-fly.

11 years agoilo: support mapping with a staging system buffer
Chia-I Wu [Thu, 9 May 2013 06:21:25 +0000 (14:21 +0800)]
ilo: support mapping with a staging system buffer

It can be used for unpacking compressed texture on-the-fly or to support
explicit transfer flushing.

11 years agoilo: allow for different mapping methods
Chia-I Wu [Thu, 9 May 2013 06:07:58 +0000 (14:07 +0800)]
ilo: allow for different mapping methods

We want to or need to use a different mapping method when when the resource is
busy, the bo format differs from the requested format, and etc.

11 years agoilo: allow bo format to differ from that requested
Chia-I Wu [Thu, 9 May 2013 04:10:41 +0000 (12:10 +0800)]
ilo: allow bo format to differ from that requested

For separate stencil buffer or formats not supported natively, the real format
of the bo may differ from that requested.

11 years agodraw/llvm: Add additional llvm optimization passes
Stéphane Marchesin [Sun, 5 May 2013 11:34:40 +0000 (04:34 -0700)]
draw/llvm: Add additional llvm optimization passes

It helps a bit with vertex shader performance on i915g
(a couple percent faster with openarena).

I have tried most other passes, and they weren't showing
any measurable improvement. Note that my vertex shaders
didn't have loops, so maybe the loop optimizations could
still be useful in the future.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agoi965: Sync brw_format_for_mesa_format() table with new Mesa formats.
Eric Anholt [Thu, 21 Mar 2013 16:59:31 +0000 (09:59 -0700)]
i965: Sync brw_format_for_mesa_format() table with new Mesa formats.

I'm not filling them all in, to prevent any breakage in this commit.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Update the surface formats table from the current specs.
Eric Anholt [Thu, 21 Mar 2013 21:21:10 +0000 (14:21 -0700)]
i965: Update the surface formats table from the current specs.

Unfortunately the surface formats table is now splattered across multiple
chapters.  All surface format enums from brw_defines.h are present, but
only support for them that is mentioned in the public specs is included
here.

v2 (from Ken): Mark R32G32B32A32_SFIXED as unsupported on Ivybridge.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Add surface format defines from the public specs.
Eric Anholt [Wed, 17 Apr 2013 00:21:16 +0000 (17:21 -0700)]
i965: Add surface format defines from the public specs.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agomesa/program: Don't copy propagate from swizzles.
Fabian Bieler [Wed, 24 Apr 2013 23:30:15 +0000 (01:30 +0200)]
mesa/program: Don't copy propagate from swizzles.

Do not propagate a copy if source and destination are identical.

Otherwise code like

MOV TEMP[0].xyzw, TEMP[0].wzyx
MOV TEMP[1].xyzw, TEMP[0].xyzw

is changed to

MOV TEMP[0].xyzw, TEMP[0].wzyx
MOV TEMP[1].xyzw, TEMP[0].wzyx

This fixes Piglit test shaders/glsl-copy-propagation-self-2 for drivers that
use Mesa IR.

NOTE: This is a candidate for the stable branches.
Signed-off-by: Fabian Bieler <fabianbieler@fastmail.fm>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agomesa/st: Don't copy propagate from swizzles.
Fabian Bieler [Sat, 20 Apr 2013 17:40:11 +0000 (19:40 +0200)]
mesa/st: Don't copy propagate from swizzles.

Do not propagate a copy if source and destination are identical.

Otherwise code like

MOV TEMP[0].xyzw, TEMP[0].wzyx
MOV TEMP[1].xyzw, TEMP[0].xyzw

is changed to

MOV TEMP[0].xyzw, TEMP[0].wzyx
MOV TEMP[1].xyzw, TEMP[0].wzyx

This fixes Piglit test shaders/glsl-copy-propagation-self-2 for gallium drivers.

NOTE: This is a candidate for the stable branches.
Signed-off-by: Fabian Bieler <fabianbieler@fastmail.fm>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agoi965: Fix hangs on HSW since the gen6 blorp fix.
Eric Anholt [Tue, 7 May 2013 03:44:21 +0000 (20:44 -0700)]
i965: Fix hangs on HSW since the gen6 blorp fix.

The constant packets for gen6 are too small for gen7, and while IVB seems
happy with them HSW blows up.  Fix it by emitting the correct packets on
gen7, for all stages.

v2: Include the packets instead of just skipping them.
NOTE: This is a candidate for the stable branches.
Reviewed-and-tested-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoegl/android: Fix error condition for EGL_ANDROID_image_native_buffer
Chad Versace [Mon, 6 May 2013 14:41:11 +0000 (07:41 -0700)]
egl/android: Fix error condition for EGL_ANDROID_image_native_buffer

Emit EGL_BAD_CONTEXT if the user passes a context to
eglCreateImageKHR(type=EGL_ANDROID_image_native_buffer).

From the EGL_ANDROID_image_native_buffer spec:
  * If <target> is EGL_NATIVE_BUFFER_ANDROID and <ctx> is not
    EGL_NO_CONTEXT, the error EGL_BAD_CONTEXT is generated.

Note: This is a candidate for the stable branches.
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
11 years agoi915: Use Y tiling for textures
Stéphane Marchesin [Sat, 4 May 2013 21:06:12 +0000 (14:06 -0700)]
i915: Use Y tiling for textures

This basically reverts commit
2acc7193743199701f8f6d1877a59ece0ec4fa5b.

With the previous change, we're not batchbuffer limited any
longer. So we actually start seeing a performance difference
between X and Y tiling. X tiling is funny because it is
faster for screen-aligned quads but slower in games. So let's
use Y tiling which is 10% faster overall.

11 years agoi915g: Optimize batchbuffer sizes
Stéphane Marchesin [Sun, 5 May 2013 01:59:35 +0000 (18:59 -0700)]
i915g: Optimize batchbuffer sizes

Now that we don't throttle at every batchbuffer, we can shrink
the size of batchbuffers to achieve early flushing. This gives
a significant speed boost in a lot of games (on the order of
20%).

11 years agoi915g: Add more PIPE_CAP_* support
Stéphane Marchesin [Sun, 11 Nov 2012 10:10:29 +0000 (02:10 -0800)]
i915g: Add more PIPE_CAP_* support

11 years agoilo: remove our own type inference
Chia-I Wu [Wed, 8 May 2013 03:32:22 +0000 (11:32 +0800)]
ilo: remove our own type inference

tgsi_opcode_infer_{src,dst}_type() works just fine.

11 years agoilo: use tgsi_util_get_texture_coord_dim()
Chia-I Wu [Wed, 8 May 2013 03:07:27 +0000 (11:07 +0800)]
ilo: use tgsi_util_get_texture_coord_dim()

And remove toy_tgsi_get_texture_coord_dim().

11 years agotgsi: fix operand type of TGSI_OPCODE_NOT
Chia-I Wu [Sat, 4 May 2013 10:06:39 +0000 (18:06 +0800)]
tgsi: fix operand type of TGSI_OPCODE_NOT

It should be TGSI_TYPE_UNSIGNED, not TGSI_TYPE_FLOAT.

Fixed also gallivm not_emit_cpu() to use uint build context.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Acked-by: Roland Scheidegger <sroland@vmware.com>
11 years agotgsi: refactor tgsi_opcode_infer_src_type()
Chia-I Wu [Sat, 4 May 2013 09:54:16 +0000 (17:54 +0800)]
tgsi: refactor tgsi_opcode_infer_src_type()

Call tgsi_opcode_infer_type() from tgsi_opcode_infer_src_type().

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Acked-by: Roland Scheidegger <sroland@vmware.com>
11 years agotgsi: refactor tgsi_opcode_infer_dst_type()
Chia-I Wu [Sat, 4 May 2013 05:27:59 +0000 (13:27 +0800)]
tgsi: refactor tgsi_opcode_infer_dst_type()

Move the body of tgsi_opcode_infer_dst_type() to a new helper function,
tgsi_opcode_infer_type(), and call the helper function from
tgsi_opcode_infer_dst_type().  The diff looks complicated simply because the
code is moved around.

A following commit will make tgsi_opcode_infer_src_type() call
tgsi_opcode_infer_type().

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Acked-by: Roland Scheidegger <sroland@vmware.com>
11 years agotgsi: reorder opcodes in opcode type inference
Chia-I Wu [Sat, 4 May 2013 01:44:39 +0000 (09:44 +0800)]
tgsi: reorder opcodes in opcode type inference

Reorder opcodes by their assigned numbers.  This makes it easier to see the
differences between tgsi_opcode_infer_src_type() and
tgsi_opcode_infer_dst_type().

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Acked-by: Roland Scheidegger <sroland@vmware.com>
11 years agotgsi: clean up exec_tex()
Chia-I Wu [Tue, 7 May 2013 06:50:02 +0000 (14:50 +0800)]
tgsi: clean up exec_tex()

Make use of tgsi_util_get_texture_coord_dim() to replace the big switch table.

There is a subtle difference with this change.  When TXP is used with an array
texture, the layer is now also projected.  This behavior matches the TGSI doc.
Since GLSL does not allow TXP on an array texture, I am not sure which
behavior is correct or preferred.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Acked-by: Roland Scheidegger <sroland@vmware.com>
11 years agotgsi: add tgsi_util_get_texture_coord_dim()
Chia-I Wu [Tue, 7 May 2013 07:32:35 +0000 (15:32 +0800)]
tgsi: add tgsi_util_get_texture_coord_dim()

This util function returns the dimension of the texture coordinates for a
texture target, and the location of the shadow reference value.

For example, when the texture target is TGSI_TEXTURE_SHADOW2D, the dimension
of the texture coordinates is 2, and the location of the ref value is 2
(that is, the Z channel).

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Acked-by: Roland Scheidegger <sroland@vmware.com>