mesa.git
11 years agoi965/fs: Fix register unspills from a reg_offset.
Eric Anholt [Wed, 16 Oct 2013 19:39:07 +0000 (12:39 -0700)]
i965/fs: Fix register unspills from a reg_offset.

We were clearing the reg_offset before trying to use it.  Oops.  Fixes
glsl-fs-texture2drect with the reg spilling debug enabled.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoi965/fs: Fix register spilling for 16-wide.
Eric Anholt [Wed, 16 Oct 2013 19:16:51 +0000 (12:16 -0700)]
i965/fs: Fix register spilling for 16-wide.

Things blew up when I enabled the debug register spill code without
disabling 16-wide, so I decided to just fix 16-wide spilling.

We still don't generate 16-wide when register spilling happens as part of
allocation (since we expect it to be slower), but now we can experiment
with allowing it in some cases in the future.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoi965/fs: Exit the compile if spilling would overwrite in-use MRFs.
Eric Anholt [Tue, 29 Oct 2013 19:46:18 +0000 (12:46 -0700)]
i965/fs: Exit the compile if spilling would overwrite in-use MRFs.

I believe this will never happen in SIMD8 mode, but it could for SIMD16
when we fix it.

v2: Fix off-by-one in my register counting comment (caught by Paul).

Reviewed-by: Paul Berry <stereotype441@gmail.com> (v1)
11 years agoi965/fs: Fix broken register spilling debug code.
Eric Anholt [Wed, 16 Oct 2013 19:02:41 +0000 (12:02 -0700)]
i965/fs: Fix broken register spilling debug code.

Now that reg spilling generates new vgrfs, we were looping forever if you
ever turned it on.

Instead, move the debug code into the register allocator right near where
we'd be doing spilling anyway, which should more accurately reflect how
register spilling occurs in the wild.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoi965/fs: Split "find what MRFs were used" to a helper function.
Eric Anholt [Tue, 29 Oct 2013 19:18:10 +0000 (12:18 -0700)]
i965/fs: Split "find what MRFs were used" to a helper function.

I'm going to need to reuse this for fixing register spilling on SIMD16.
Note that BRW_MAX_MRF is 16, which is the same as BRW_MAX_GRF -
GEN7_MRF_HACK_START.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoi965/fs: Update an ancient, wrong comment about reg_offset.
Eric Anholt [Tue, 29 Oct 2013 08:06:09 +0000 (01:06 -0700)]
i965/fs: Update an ancient, wrong comment about reg_offset.

This hasn't been true since SIMD16 mode was added.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoradeonsi: Allow longer intrinsic names
Kai Wasserbäch [Sun, 27 Oct 2013 18:36:07 +0000 (19:36 +0100)]
radeonsi: Allow longer intrinsic names

Fixes a boat load of Piglit tests for me, which crashed like fdo#70913
before.

Thanks to Michel Dänzer for the tip.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70913
Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
11 years agoclover: Don't install headers when using the icd
Tom Stellard [Tue, 29 Oct 2013 16:48:37 +0000 (12:48 -0400)]
clover: Don't install headers when using the icd

The ICD loader should be responsible for installing headers.

Reviewed and Tested-by: Aaron Watry <awatry@gmail.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
11 years agoradeon/llvm: Specify the DataLayout when running optimizations
Tom Stellard [Tue, 22 Oct 2013 16:26:12 +0000 (09:26 -0700)]
radeon/llvm: Specify the DataLayout when running optimizations

Without DataLayout, a lot of optimization passes aren't run and the ones
that are don't work as well.

11 years agoi965/fs: Prefer more-critical instructions of the same age in LIFO scheduling.
Eric Anholt [Mon, 28 Oct 2013 22:17:07 +0000 (15:17 -0700)]
i965/fs: Prefer more-critical instructions of the same age in LIFO scheduling.

When faced with a million instructions that all became candidates at the
same time (none of which individually reduce register pressure), the ones
on the critical path are more likely to be the ones that will free up some
candidates soon.

shader-db:
total instructions in shared programs: 1681070 -> 1681070 (0.00%)
instructions in affected programs:     0 -> 0
GAINED:                                40
LOST:                                  74

Fixes indistinguishable-from-hanging behavior in GLES3conform's
uniform_buffer_object_max_uniform_block_size test, regressed by
c3c9a8c85758796a26b48e484286e6b6f5a5299a.  Given that
93bd627d5a6c485948b94488e6cd53a06b7ebdcf was unlocked by that commit, the
net effect on 16-wide program count is still quite positive, and I think
this should give us more stable scheduling (less dependency on original
instruction emit order).

v2: Comment suggestions by Paul

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70943
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoi965: Compute the node's delay time for scheduling.
Eric Anholt [Mon, 28 Oct 2013 07:11:45 +0000 (00:11 -0700)]
i965: Compute the node's delay time for scheduling.

This is a step in doing scheduling as described in Muchnick (p538).  A
difference is that our latency function is only specific to one
instruction (it doesn't describe, for example, the different latency
between WAR of a send's arguments and RAW of a send's destination), but
that's changeable later.  We also don't separately compute the postorder
traversal of the graph, since we can use the setting of the delay field as
the "visited" flag.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoautomake: handle expat version pre 2.1
Emil Velikov [Wed, 30 Oct 2013 00:03:43 +0000 (00:03 +0000)]
automake: handle expat version pre 2.1

Commit aec20d66d9d13e0acd6a7199b63e1383e1e9900a
(automake: properly handle non-default expat installation),
assumed that up-to date distributions use a recent version
of expat that handles security vunerabilities CVE-2012-1147
and CVE-2012-1148. Seems like this is not always the case
and they prefer to backport only the fix, rather than use
the updated library.

This commit adds a default case -lexpat whenever expat is
not found, while properly handling expat.pc if present.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71022
Reported-By: Bryce Harrington <b.harrington@samsung.com>
Reported-By: Vinson Lee <vlee@freedesktop.org>
Tested-by: Bryce Harrington <b.harrington@samsung.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
11 years agoglsl: Move layout(location) checks to AST-to-HIR conversion
Ian Romanick [Wed, 25 Sep 2013 21:36:27 +0000 (14:36 -0700)]
glsl: Move layout(location) checks to AST-to-HIR conversion

This will simplify the addition of layout(location) qualifiers for
separate shader objects.  This was validated with new piglit tests
arb_explicit_attrib_location/1.30/compiler/not-enabled-01.vert and
arb_explicit_attrib_location/1.30/compiler/not-enabled-02.vert.

v2: Refactor error checking to check_explicit_attrib_location_allowed
and eliminate the gotos.  Suggested by Paul.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoglsl: Slightly restructure error generation in validate_explicit_location
Ian Romanick [Wed, 25 Sep 2013 20:53:56 +0000 (13:53 -0700)]
glsl: Slightly restructure error generation in validate_explicit_location

Use mode_string to get the name of the variable mode.  Slightly change
the control flow.  Both of these changes make it easier to support
separate shader object location layouts.

The format of the message changed because mode_string can return a
string like "shader output".  This would result in an awkward message
like "vertex shader shader output..."

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoglsl: Make mode_string function globally available
Ian Romanick [Wed, 25 Sep 2013 18:44:41 +0000 (11:44 -0700)]
glsl: Make mode_string function globally available

I made this a function (instead of a method of ir_variable) because it
made the change set smaller, and I expect that there will be an overload
that takes an ir_var_mode enum.  Having both functions used the same way
seemed better.

v2: Add missing case for ir_var_system_value.

v3: Change the ir_var_mode_count case to just break.  Move the assertion
and the return outside the switch-statment.  In the unlikely event that
var->mode is an invalid value other than ir_var_mode_count, the
assertion will still fire, and in release builds we won't wind up
returning a garbage pointer.  Suggested by Paul.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoglsl: Eliminate the global check in validate_explicit_location
Ian Romanick [Wed, 25 Sep 2013 18:01:07 +0000 (11:01 -0700)]
glsl: Eliminate the global check in validate_explicit_location

Since the separation of ir_var_function_in and ir_var_shader_in (similar
for out), this check is no longer necessary.  Previously, global_scope
was the only way to tell which was which.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoglsl: Extract explicit location code from apply_type_qualifier_to_variable
Ian Romanick [Wed, 25 Sep 2013 17:48:18 +0000 (10:48 -0700)]
glsl: Extract explicit location code from apply_type_qualifier_to_variable

Future patches will add some extra code to this path, and some of that
code will want to exit from the explicit location code early.

v2: Change a geometry shader "break" to a "return" so that try to apply
a bogus geometry shader location qualifier (which could cause cascading
errors).  Suggested by Paul.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agomesa: Drop unused return value from use_shader_program
Gregory Hainaut [Fri, 28 Jun 2013 23:32:35 +0000 (16:32 -0700)]
mesa: Drop unused return value from use_shader_program

The return value has been unused since commit d348b0c.  This was
originally included in another patch, but it was split out by Ian
Romanick.

v2: Drop unnecessary final return.  Suggested by Paul.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Cc: Eric Anholt <eric@anholt.net>
11 years agowayland: silence unused var warning
Fabio Pedretti [Wed, 30 Oct 2013 14:22:03 +0000 (15:22 +0100)]
wayland: silence unused var warning

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
11 years agoilo: Fix out-of-tree build.
Johannes Obermayr [Wed, 11 Sep 2013 22:32:39 +0000 (00:32 +0200)]
ilo: Fix out-of-tree build.

[olv: use $(srcdir) instead of $(top_srcdir)]

11 years agoscons: Add missing dependencies to src/mapi/glapi/gen/*.xml
José Fonseca [Wed, 30 Oct 2013 12:21:54 +0000 (12:21 +0000)]
scons: Add missing dependencies to src/mapi/glapi/gen/*.xml

Incremental builds were failing because not all generated source files
were missing dependencies to src/mapi/glapi/gen/*.xml.

Hopefully this change will be the end of these incremental build
failures.

11 years agoglsl: fix crash introduced by the previous commit
Marek Olšák [Tue, 29 Oct 2013 23:11:57 +0000 (00:11 +0100)]
glsl: fix crash introduced by the previous commit

11 years agoglsl: break the gl_FragData array into separate gl_FragData[i] variables
Marek Olšák [Sun, 20 Oct 2013 03:15:42 +0000 (05:15 +0200)]
glsl: break the gl_FragData array into separate gl_FragData[i] variables

This avoids a defect in lower_output_reads.

The problem is lower_output_reads treats the gl_FragData array as a single
variable. It first redirects all output writes to a temporary variable (array)
and then writes the whole temporary variable to the output, generating
assignments to all elements of gl_FragData.

BTW this pass can be modified to lower all arrays, not just inputs and outputs.
The question is whether it is worth it.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
v2: addressed Paul Berry's comments

11 years agoautomake: properly handle non-default expat installation
Emil Velikov [Tue, 29 Oct 2013 21:14:41 +0000 (21:14 +0000)]
automake: properly handle non-default expat installation

Use PKG_CHECK_MODULE over requesting the user to setup the
option at configure time. Drop unused EXPAT_INCLUDE and
update all targets.

NOTE: The this commit removes the --with-expat configure
option. One should ensure that the expat they wish to use
has expat.pc file accessible by pkg-config.

v2:
* Add note about the removal of --with-expat
(per Tom Stellard)
* Drop EXPAT_CFLAGS for targets that do not build DRI_COMMON
(spotted by Matt Turner)
v3:
* Rebase on top of megadrivers (drop EXPAT_CFLAGS from swrast)

Acked-by: Matt Turner <mattst88@gmail.com> (v2)
Reviewed-by: Tom Stellard <thomas.stellard@amd.com> (v2)
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Conflicts:
configure.ac
src/mesa/drivers/dri/common/Makefile.am

11 years agoconfigure: use PKG_CONFIG variable over hardcoded pkg-config
Emil Velikov [Sat, 28 Sep 2013 02:20:14 +0000 (03:20 +0100)]
configure: use PKG_CONFIG variable over hardcoded pkg-config

Already available and used in other places of configure.ac.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agotargets/xorg-nouveau: drop usage of dri1 function DRICreatePCIBusID
Emil Velikov [Sat, 21 Sep 2013 16:41:57 +0000 (17:41 +0100)]
targets/xorg-nouveau: drop usage of dri1 function DRICreatePCIBusID

The function should have never used it in the first place as it was
a left over from the DRI1 days of the nouveau ddx. While we're around
check if KMS is supported before opening the nouveau device, and
add support for Fermi & Kepler cards.

Compile tested only due to the lack of a Fermi/Kepler card.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
11 years agogallium/targets/xorg: drop set but unused variable entity
Emil Velikov [Sat, 28 Sep 2013 14:08:24 +0000 (15:08 +0100)]
gallium/targets/xorg: drop set but unused variable entity

The function xf86GetEntityInfo() retrieves the entity rather than
doing any changes. Remove this no-op code.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
11 years agost/xorg: drop set but unsused variables dxo, dyo
Emil Velikov [Sat, 28 Sep 2013 14:17:29 +0000 (15:17 +0100)]
st/xorg: drop set but unsused variables dxo, dyo

Commit a9f8baf00b264 removed the first and only use of the variables
but forgot to remove them.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agost/xorg: add sanity checks after malloc
Emil Velikov [Sat, 21 Sep 2013 16:53:43 +0000 (17:53 +0100)]
st/xorg: add sanity checks after malloc

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agost/xorg: remove unnecessary headers
Emil Velikov [Sat, 28 Sep 2013 02:03:39 +0000 (03:03 +0100)]
st/xorg: remove unnecessary headers

v2: Remove xf86PciInfo.h, all drivers provide their own PCI ID list

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agofreedreno: emulated unsupported primitive types
Rob Clark [Fri, 25 Oct 2013 19:33:09 +0000 (15:33 -0400)]
freedreno: emulated unsupported primitive types

Use u_primconvert to convert unsupported primitives into supported
primitive plus index buffer.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
11 years agogallium/auxiliary/indices: add u_primconvert
Rob Clark [Fri, 25 Oct 2013 19:26:12 +0000 (15:26 -0400)]
gallium/auxiliary/indices: add u_primconvert

A convenient front end to indices generate/translate code, for emulating
primitives which are not supported natively by the driver.

This handles saving/restoring index buffer state, etc.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agogallium/auxiliary/indices: add start param
Rob Clark [Fri, 25 Oct 2013 19:22:06 +0000 (15:22 -0400)]
gallium/auxiliary/indices: add start param

Add 'start' parameter to generator/translator.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agofreedreno: update generated headers
Rob Clark [Fri, 25 Oct 2013 14:45:15 +0000 (10:45 -0400)]
freedreno: update generated headers

pull in some fixes to draw-initiator/prim-type.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
11 years agoi965/fs: Drop our dead push constants before overflowing to pull constants.
Eric Anholt [Tue, 29 Oct 2013 00:00:23 +0000 (17:00 -0700)]
i965/fs: Drop our dead push constants before overflowing to pull constants.

The idea of the original order was that you'd dead code eliminate accesses
to push constants.  But I've never seen a case of that (nor has
shader-db), while we frequently see sparse accesses of large constant
arrays that would overflow into pull constants.

Cuts pull constant use on csgo, serious sam, planeshift, and the cave:

total instructions in shared programs: 1695103 -> 1688795 (-0.37%)
instructions in affected programs:     92024 -> 85716 (-6.85%)
GAINED:                                339
LOST:                                  0

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agohaiku-softpipe: Minor cleanup and color space fixes
Alexander von Gluck IV [Mon, 28 Oct 2013 17:56:43 +0000 (12:56 -0500)]
haiku-softpipe: Minor cleanup and color space fixes

* Use more consistant data sources
* Fix improper color space assignments
* Remove unnecessary comments and code
* Drop unnecessary round_up function (this was leftover
  from moving winsys code out of renderer)

Acked-by: Brian Paul <brianp@vmware.com>
11 years agowinsys: Correct Haiku winsys display target code
Alexander von Gluck IV [Mon, 28 Oct 2013 16:38:27 +0000 (11:38 -0500)]
winsys: Correct Haiku winsys display target code

* Instead of assuming the displaytarget is the same
  stride / colorspace as the destination, lets
  actually check the source bitmap.
* Fixes random stride issues in rendering

Acked-by: Brian Paul <brianp@vmware.com>
11 years agoclover: Use context device list for error checking in clGetProgramBuildInfo.
Francisco Jerez [Tue, 29 Oct 2013 18:21:09 +0000 (11:21 -0700)]
clover: Use context device list for error checking in clGetProgramBuildInfo.

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

Reported-by: Bruno Jiménez <brunojimen@gmail.com>
11 years agoi965: Simplify the shader time code by using atomic counter helpers.
Francisco Jerez [Sun, 20 Oct 2013 21:05:24 +0000 (14:05 -0700)]
i965: Simplify the shader time code by using atomic counter helpers.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoi965: Add brw_reg constructors taking a dynamically determined vector width.
Francisco Jerez [Wed, 11 Sep 2013 21:19:47 +0000 (14:19 -0700)]
i965: Add brw_reg constructors taking a dynamically determined vector width.

The MRF variant is going to be used extensively by the atomic counter
intrinsics to assemble untyped atomic and surface read messages
easily.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoi965/gen7: Implement code generation for untyped surface read instructions.
Francisco Jerez [Wed, 11 Sep 2013 21:03:13 +0000 (14:03 -0700)]
i965/gen7: Implement code generation for untyped surface read instructions.

11 years agoi965/gen7: Implement code generation for untyped atomic instructions.
Francisco Jerez [Wed, 11 Sep 2013 21:01:50 +0000 (14:01 -0700)]
i965/gen7: Implement code generation for untyped atomic instructions.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoi965: Implement ABO surface state emission.
Francisco Jerez [Sun, 20 Oct 2013 20:09:57 +0000 (13:09 -0700)]
i965: Implement ABO surface state emission.

The maximum number of atomic buffer objects is somewhat arbitrary, we
can change it in the future easily if it turns out it's not enough...

v2: Add comments with the relevant mesa dirty bits.  Fix usage of
    BRW_NEW_UNIFORM_BUFFER in the GS ABO state atom.
v3: Update binding table layout diagrams.
v4: Resolve conflicts with the recent dynamic surface index assignment changes.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoi965: Define vtbl method that initializes an untyped R/W surface.
Francisco Jerez [Sun, 22 Sep 2013 22:33:49 +0000 (15:33 -0700)]
i965: Define vtbl method that initializes an untyped R/W surface.

And add Gen7 implementation.

v2: Fix off by one error in buffer size calculation.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoglsl: Fix the function inlining pass to deal with general opaque arguments.
Francisco Jerez [Mon, 30 Sep 2013 19:54:57 +0000 (12:54 -0700)]
glsl: Fix the function inlining pass to deal with general opaque arguments.

Almost a trivial change, it boils down to renaming a few identifiers
so their names still make sense for opaque types other than sampler.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoglsl: Add built-in functions and constants required for ARB_shader_atomic_counters.
Francisco Jerez [Sun, 20 Oct 2013 19:39:16 +0000 (12:39 -0700)]
glsl: Add built-in functions and constants required for ARB_shader_atomic_counters.

v2: Represent atomics as GLSL intrinsics.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoglsl: Basic support for built-in intrinsics.
Francisco Jerez [Wed, 25 Sep 2013 18:55:06 +0000 (11:55 -0700)]
glsl: Basic support for built-in intrinsics.

Fix the linker to deal with intrinsic functions which are undefined
all the way down to the driver back-end, and introduce intrinsic
definition helpers in the built-in generator.

We still need to figure out what kind of interface we want for drivers
to communicate to the GLSL front-end which of the supported intrinsics
should use a default GLSL implementation and which should use a
hardware-specific override.  As there's no default GLSL implementation
for atomic ops, this seems like something we can worry about later on.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
v2: Define local helper function to generate ir_call nodes in the
    builtin generator.

11 years agoglsl: Add type predicate to check whether a type contains any opaque types.
Francisco Jerez [Fri, 20 Sep 2013 21:58:03 +0000 (14:58 -0700)]
glsl: Add type predicate to check whether a type contains any opaque types.

And use it to forbid comparisons of opaque operands.  According to the
GL 4.2 specification:

> Except for array indexing, structure member selection, and
> parentheses, opaque variables are not allowed to be operands in
> expressions.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoglsl: Add new atomic_uint built-in GLSL type.
Francisco Jerez [Sun, 20 Oct 2013 19:35:47 +0000 (12:35 -0700)]
glsl: Add new atomic_uint built-in GLSL type.

v2: Fix GLSL version in which the type became available.  Add
    contains_atomic() convenience method.  Split off atomic counter
    comparison error checking to a separate patch that will handle all
    opaque types.  Include new ir_variable fields for atomic types.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoglsl: Add extension enables for ARB_shader_atomic_counters.
Francisco Jerez [Tue, 8 Oct 2013 01:55:18 +0000 (18:55 -0700)]
glsl: Add extension enables for ARB_shader_atomic_counters.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agomesa: Add support for ARB_shader_atomic_counters.
Francisco Jerez [Tue, 8 Oct 2013 01:53:40 +0000 (18:53 -0700)]
mesa: Add support for ARB_shader_atomic_counters.

This patch implements the common support code required for the
ARB_shader_atomic_counters extension.  It defines the necessary data
structures for tracking atomic counter buffer objects (from now on
"ABOs") associated with some specific context or shader program, it
implements support for binding buffers to an ABO binding point and
querying the existing atomic counters and buffers declared by GLSL
shaders.

v2: Fix extension checks.  Drop unused MAX_ATOMIC_BUFFERS constant.

Acked-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoglapi: Add support for ARB_shader_atomic_counters.
Francisco Jerez [Wed, 11 Sep 2013 18:31:01 +0000 (11:31 -0700)]
glapi: Add support for ARB_shader_atomic_counters.

Add XML file for the dispatch code generator, update the
dispatch_sanity test and add stub definition for the new entry point.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoi965: Handle deallocation of some private ralloc contexts explicitly.
Francisco Jerez [Wed, 23 Oct 2013 18:16:26 +0000 (11:16 -0700)]
i965: Handle deallocation of some private ralloc contexts explicitly.

These ralloc contexts belong to a specific object and are being
deallocated manually from the class destructor.  Now that we've hooked
up destructors to ralloc there's no reason for them to be children of
any other context, and doing so might to lead to double frees under
some circumstances.  The class destructor has all the responsibility
of freeing class memory resources now.

11 years agoralloc: Hook up C++ destructors to ralloc when necessary.
Francisco Jerez [Wed, 9 Oct 2013 18:02:51 +0000 (11:02 -0700)]
ralloc: Hook up C++ destructors to ralloc when necessary.

This patch makes sure that class destructors are called as they should
be when a C++ object allocated by ralloc is released.

Based on a previous patch by Kenneth Graunke, but it doesn't exhibit
the ~0.8% performance regression in shader compilation times because
we now use the HAS_TRIVIAL_DESTRUCTOR() macro to detect the typical
case where the indirect function call can be avoided because the
object's destructor doesn't need to do anything.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agomesa: Define introspection macro to determine whether a type is trivially destructible.
Francisco Jerez [Wed, 9 Oct 2013 17:37:21 +0000 (10:37 -0700)]
mesa: Define introspection macro to determine whether a type is trivially destructible.

Only implemented on GCC and Clang for now.  Other compilers use a
dummy implementation that always returns false, which should be a safe
[but slightly inefficient] assumption in all cases.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoglsl: Generalize MSVC fix for strcasecmp().
Paul Berry [Sat, 26 Oct 2013 17:25:46 +0000 (10:25 -0700)]
glsl: Generalize MSVC fix for strcasecmp().

This will let us use strcasecmp() from anywhere inside Mesa without
having to worry about the fact that it doesn't exist in MSVC.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agollvmpipe: fix bogus layer clamping in setup
Roland Scheidegger [Sat, 26 Oct 2013 02:22:55 +0000 (04:22 +0200)]
llvmpipe: fix bogus layer clamping in setup

The layer coming from GS needs to be clamped (not sure if that's actually
the correct error behavior but we need something) as the number can be higher
than the amount of layers in the fb. However, this code was using the layer
calculation from the scene, and this was actually calculated in
lp_scene_begin_rasterization() hence too late (so setup was using the value
from the _previous_ scene or just zero if it was the first scene).
Since the value is used in both rasterization and setup, move calculation up
to lp_scene_begin_binning() though it's a bit more inconvenient to calculate
there. (Theoretically could move _all_ code which was in
lp_scene_begin_rasterization() to there, because ever since we got rid of
swizzled render/depth buffers our "map" functions preparing the fb data for
render don't actually change the data in there at all, but it feels like
it would be a hack.)

v2: improve comments

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agoutil,llvmpipe: correctly set the minimum representable depth value
Matthew McClure [Tue, 22 Oct 2013 22:48:00 +0000 (15:48 -0700)]
util,llvmpipe: correctly set the minimum representable depth value

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agost/mesa: move out of memory check in st_draw_vbo()
Brian Paul [Tue, 29 Oct 2013 00:33:32 +0000 (18:33 -0600)]
st/mesa: move out of memory check in st_draw_vbo()

Before we were only checking the st->vertex_array_out_of_memory flag
after updating array state.  But if there's two consecutive glDrawArrays
calls and the first one is skipped because of OOM, the second one should
be skipped too.

Cc: 9.2 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
11 years agosvga: reindent drawing code
Brian Paul [Mon, 28 Oct 2013 15:43:08 +0000 (09:43 -0600)]
svga: reindent drawing code

11 years agoi965/vec4: Reduce working set size of live variables computation.
Eric Anholt [Mon, 21 Oct 2013 17:57:29 +0000 (10:57 -0700)]
i965/vec4: Reduce working set size of live variables computation.

Orbital Explorer was generating a 4000 instruction geometry shader, which
was taking 275 trips through dead code elimination and register
coalescing, each of which updated live variables to get its work done, and
invalidated those live variables afterwards.

By using bitfields instead of bools (reducing the working set size by a
factor of 8) in live variables analysis, it drops from 88% of the profile
to 57%, and reduces overall runtime from I-got-bored-and-killed-it (Paul
says 3+ minutes) to 10.5 seconds.

Compare to f179f419d1d0a03fad36c2b0a58e8b853bae6118 on the FS side.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agor600g/sb: fix value::is_fixed()
Vadim Girlin [Tue, 29 Oct 2013 01:49:21 +0000 (05:49 +0400)]
r600g/sb: fix value::is_fixed()

This prevents unnecessary (and wrong) register allocation in the
scheduler for preloaded values in fixed registers.

Fixes interpolation-mixed.shader_test on rv770
(and probably on all other pre-evergreen chips).

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
Tested-by: Andreas Boll <andreas.boll.dev@gmail.com>
11 years agoglsl: Drop no-op shifts involving 0.
Eric Anholt [Tue, 22 Oct 2013 00:01:49 +0000 (17:01 -0700)]
glsl: Drop no-op shifts involving 0.

I noticed this in a shader in Unigine Heaven that was spilling.  While it
doesn't really reduce register pressure, it shaves a few instructions
anyway (7955 -> 7882).

v2: Fix turning "0 >> x" into "x" instead of "0" (caught by Erik
    Faye-Lund).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agoglsl: Use ir_builder more in opt_algebraic.
Eric Anholt [Thu, 24 Oct 2013 22:03:45 +0000 (15:03 -0700)]
glsl: Use ir_builder more in opt_algebraic.

While ir_builder is slightly less efficient, we're only increasing the
work when there's actual optimization being done, and it's way more
readable code.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agoglsl: Move common code out of opt_algebraic's handle_expression().
Eric Anholt [Thu, 24 Oct 2013 21:55:50 +0000 (14:55 -0700)]
glsl: Move common code out of opt_algebraic's handle_expression().

Matt and I had each screwed up these common required patterns recently, in
ways that wouldn't have been noticed for a long time if not for code
review.  Just enforce it in the caller so that we don't rely on code
review catching these bugs.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agoRemove error when calling glGenQueries/glDeleteQueries while a query is active
Carl Worth [Thu, 17 Oct 2013 17:54:56 +0000 (10:54 -0700)]
Remove error when calling glGenQueries/glDeleteQueries while a query is active

There is nothing in the OpenGL specification which prevents the user from
calling glGenQueries to generate a new query object while another object is
active. Neither is there anything in the Mesa implementation which prevents
this. So remove the INVALID_OPERATION errors in this case.

Similarly, it is explicitly allowed by the OpenGL specification to delete an
active query, so remove the assertion for that case, replacing it with the
necesssary state updates to end the query, (clear the bindpt pointer and call
into the driver's EndQuery hook).

CC: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Tested-by: Brian Paul <brianp@vmware.com>
11 years agoi965: Also emit HiZ and Stencil packets when disabling depth on Gen6.
Kenneth Graunke [Tue, 13 Aug 2013 20:57:13 +0000 (13:57 -0700)]
i965: Also emit HiZ and Stencil packets when disabling depth on Gen6.

The normal drawing path does this, and it's necessary on Ivybridge,
so let's try it on Sandybridge too.  It's not explicitly documented
as necessary, but might help with hangs.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: Xinkai Chen <yeled.nova@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Cc: "9.2" <mesa-stable@lists.freedesktop.org>
11 years agoi965: Also emit HIER_DEPTH and STENCIL packets when disabling depth.
Kenneth Graunke [Tue, 13 Aug 2013 20:54:37 +0000 (13:54 -0700)]
i965: Also emit HIER_DEPTH and STENCIL packets when disabling depth.

From the documentation:
"[DevIVB] 3DSTATE_DEPTH_BUFFER must always be programmed along with the
 other Depth/Stencil state commands(i.e. 3DSTATE_CLEAR_PARAMS,
 3DSTATE_STENCIL_BUFFER, or 3DSTATE_HIER_DEPTH_BUFFER)."

We normally do this, but BLORP was failing to do so in the case where it
disables depth.

Not observed to fix anything yet.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: Xinkai Chen <yeled.nova@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Cc: "9.2" <mesa-stable@lists.freedesktop.org>
11 years agoi965: Move post-sync non-zero flush for 3DSTATE_MULTISAMPLE.
Kenneth Graunke [Thu, 24 Oct 2013 07:38:27 +0000 (00:38 -0700)]
i965: Move post-sync non-zero flush for 3DSTATE_MULTISAMPLE.

For some reason, we put the flush in the caller, rather than just before
emitting the packet.  This is more than a cosmetic problem: BLORP calls
gen6_emit_3dstate_multisample() directly, and so it missed the flush.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: Xinkai Chen <yeled.nova@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Cc: "9.2" <mesa-stable@lists.freedesktop.org>
11 years agoi965: Also guard 3DSTATE_DRAWING_RECTANGLE with a flush in blorp.
Kenneth Graunke [Thu, 24 Oct 2013 07:45:56 +0000 (00:45 -0700)]
i965: Also guard 3DSTATE_DRAWING_RECTANGLE with a flush in blorp.

Non-pipelined commands need this flush.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: Xinkai Chen <yeled.nova@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Cc: "9.2" <mesa-stable@lists.freedesktop.org>
11 years agoi965: Emit post-sync non-zero flush before 3DSTATE_DRAWING_RECTANGLE.
Kenneth Graunke [Thu, 24 Oct 2013 07:36:42 +0000 (00:36 -0700)]
i965: Emit post-sync non-zero flush before 3DSTATE_DRAWING_RECTANGLE.

This is another non-pipelined command that needs a flush on Sandybridge.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: Xinkai Chen <yeled.nova@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Cc: "9.2" <mesa-stable@lists.freedesktop.org>
11 years agoi965: Emit post-sync non-zero flush before 3DSTATE_GS_SVB_INDEX.
Kenneth Graunke [Thu, 24 Oct 2013 07:32:52 +0000 (00:32 -0700)]
i965: Emit post-sync non-zero flush before 3DSTATE_GS_SVB_INDEX.

From the comments above intel_emit_post_sync_nonzero_flush:
"[DevSNB-C+{W/A}] Before any depth stall flush (including those
 produced by non-pipelined state commands), software needs to first
 send a PIPE_CONTROL with no bits set except Post-Sync Operation != 0."

This suggests that every non-pipelined (0x79xx) command needs a
post-sync non-zero flush before it.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: Xinkai Chen <yeled.nova@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Cc: "9.2" <mesa-stable@lists.freedesktop.org>
11 years agoi965: CS writes/reads should use I915_GEM_INSTRUCTION
Daniel Vetter [Wed, 9 Oct 2013 13:49:11 +0000 (15:49 +0200)]
i965: CS writes/reads should use I915_GEM_INSTRUCTION

Otherwise the gen6 w/a in the kernel won't kick in and the write will
land nowhere.

Inspired by a patch Ken pointed me at which had the same issue (but
isn't yet merged and also for a gen7+ feature). An audit of the entire
driver didn't reveal any other case than the one in in the write_reg
helper used by the gen6 queryobj code.

Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Tested-by: Xinkai Chen <yeled.nova@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Cc: "9.2" <mesa-stable@lists.freedesktop.org>
11 years agoi965: Do not set bilinear_filter flag in case of multisample blits
Anuj Phogat [Fri, 18 Oct 2013 23:07:42 +0000 (16:07 -0700)]
i965: Do not set bilinear_filter flag in case of multisample blits

Setting bilinear_filter flag in case of multisample blits with
GL_LINEAR filter causes incorrect behavior in translate_dst_to_src()
function. This broke Modern Warfare (1, 2 and 3) on SNB, IVB and HSW.

Tested on SNB and IVB, no Piglit regressions. Trace file of the game
(taken with apitrace) works fine with this patch.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=69078
Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reported-by: Armin K <krejzi@email.com>
Tested-by: Armin K <krejzi@email.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agomesa: Remove trailing whitespace in texparam.c
Rico Schüller [Sun, 27 Oct 2013 14:02:00 +0000 (08:02 -0600)]
mesa: Remove trailing whitespace in texparam.c

Signed-off-by: Rico Schüller <kgbricola@web.de>
Signed-off-by: Brian Paul <brianp@vmware.com>
11 years agomesa: use void in _mesa_VDPAUFiniNV() as in the header file
Brian Paul [Sat, 26 Oct 2013 14:11:46 +0000 (08:11 -0600)]
mesa: use void in _mesa_VDPAUFiniNV() as in the header file

11 years agoglsl: Add check for unsized arrays to glsl types
Timothy Arceri [Wed, 23 Oct 2013 10:31:27 +0000 (21:31 +1100)]
glsl: Add check for unsized arrays to glsl types

The main purpose of this patch is to increase readability of
the array code by introducing is_unsized_array() to glsl_types.
Some redundent is_array() checks are also removed, and small number
of other related clean ups.

The introduction of is_unsized_array() should also make the
ARB_arrays_of_arrays code simpler and more readable when it arrives.

V2: Also replace code that checks for unsized arrays directly with the
length variable

Signed-off-by: Timothy Arceri <t_arceri@yahoo.com.au>
v3 (Paul Berry <stereotype441@gmail.com>): clean up formatting.
Separate whitespace cleanups to their own patch.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoglsl: whitespace cleanups.
Timothy Arceri [Wed, 23 Oct 2013 10:31:27 +0000 (21:31 +1100)]
glsl: whitespace cleanups.

Signed-off-by: Timothy Arceri <t_arceri@yahoo.com.au>
v2 (Paul Berry <stereotype441@gmail.com>): Separate from "glsl: Add
check for unsized arrays to glsl types".

Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoglsl: Fix comment
Timothy Arceri [Tue, 22 Oct 2013 11:38:12 +0000 (22:38 +1100)]
glsl: Fix comment

Signed-off-by: Timothy Arceri <t_arceri@yahoo.com.au>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agovl/h264: split fields into SPS/PPS
Christian König [Tue, 24 Sep 2013 09:03:33 +0000 (03:03 -0600)]
vl/h264: split fields into SPS/PPS

Add alot of missing fields as well.

Signed-off-by: Christian König <christian.koenig@amd.com>
11 years agoradeon/uvd: fix H264 chroma format handling
Christian König [Thu, 24 Oct 2013 11:12:58 +0000 (05:12 -0600)]
radeon/uvd: fix H264 chroma format handling

Signed-off-by: Christian König <christian.koenig@amd.com>
11 years agovl: add 400 chroma format as well
Christian König [Thu, 24 Oct 2013 11:47:08 +0000 (05:47 -0600)]
vl: add 400 chroma format as well

Signed-off-by: Christian König <christian.koenig@amd.com>
11 years agoilo: minor cleanups for recent interface changes
Chia-I Wu [Mon, 28 Oct 2013 03:18:43 +0000 (11:18 +0800)]
ilo: minor cleanups for recent interface changes

Kill ilo_bind_sampler_states2 and ilo_set_sampler_views2.  Map
PIPE_FORMAT_R10G10B10A2_UINT to BRW_SURFACEFORMAT_R10G10B10A2_UINT.

11 years agoglsl: Move error message inside validation check reducing duplicate message handling
Timothy Arceri [Thu, 17 Oct 2013 11:42:18 +0000 (22:42 +1100)]
glsl: Move error message inside validation check reducing duplicate message handling

v2 (Paul Berry <stereotype441@gmail.com): Fix precedence error in call
to _mesa_glsl_error().

Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoi965: Make fs gl_PrimitiveID input work even when there's no gs.
Paul Berry [Wed, 23 Oct 2013 03:34:30 +0000 (20:34 -0700)]
i965: Make fs gl_PrimitiveID input work even when there's no gs.

When a geometry shader is present, the fragment shader gl_PrimitiveID
input acts like an ordinary varying, receiving data from the gs
gl_PrimitiveID output.  When there's no geometry shader, we have to
ask the fixed function SF hardware to provide the primitive ID to the
fragment shader instead.

Previously, the SF setup code would handle this situation by
recognizing that the FS gl_PrimitiveID input didn't match to any VS
output; since normally an FS input with no corresponding VS output
leads to undefined data, the SF setup code used to just arbitrarily
assign it to receive data from attribute 0.

This patch changes the SF setup code so that instead of arbitrarily
using attribute 0, it assigns the unmatched FS input to receive
gl_PrimitiveID.  In the case where the FS input really is
gl_PrimitiveID, this produces the intended result.  In all other
cases, no harm is done since GL specifies that the behaviour is
undefined.

Fixes piglit test primitive-id-no-gs.

v2: If an attribute is already being overridden with point
coordinates, don't try to also override it with gl_PrimitiveID.  This
is necessary to avoid regressing piglit tests such as
shaders/glsl-fs-pointcoord.

Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agomesa: Add GL_NV_vdpau_interop functions to dispatch_sanity.cpp.
Vinson Lee [Sun, 27 Oct 2013 06:09:30 +0000 (23:09 -0700)]
mesa: Add GL_NV_vdpau_interop functions to dispatch_sanity.cpp.

Fixes 'make check' failures introduced with commit
80964226e9b8a05c39157f9305c06c0b2861e080.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70900
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
11 years agomesa: add vdpau.c and st_vdpau.c to src/mesa/SConscript
Brian Paul [Sat, 26 Oct 2013 13:17:53 +0000 (07:17 -0600)]
mesa: add vdpau.c and st_vdpau.c to src/mesa/SConscript

Fixes SCons build.

11 years agoimplement NV_vdpau_interop v7
Christian König [Wed, 15 May 2013 13:10:11 +0000 (15:10 +0200)]
implement NV_vdpau_interop v7

v2: Actually implement interop between the gallium
    state tracker and the VDPAU backend.

v3: Make it also available in non legacy contexts,
    fix video buffer sharing.

v4: deny interop if we don't have the same screen object

v5: rebased on upstream changes

v6: implemented VDPAUGetSurfaceivNV, improved error handling,
    unregister all surfaces in VDPAUFiniNV

v7: squash merge with Mareks changes

Signed-off-by: Christian König <christian.koenig@amd.com>
11 years agowinsys/radeon: make radeon_drm_winsys_create public
Christian König [Fri, 11 Oct 2013 09:07:44 +0000 (11:07 +0200)]
winsys/radeon: make radeon_drm_winsys_create public

Otherwise OpenGL/VDPAU interop won't work as expected.

Signed-off-by: Christian König <christian.koenig@amd.com>
11 years agoi965: Remove ir_txf coord+offset special case in visitors
Chris Forbes [Sat, 12 Oct 2013 11:02:04 +0000 (00:02 +1300)]
i965: Remove ir_txf coord+offset special case in visitors

Just let it be handled by the lowering pass.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Generalize coord+offset lowering pass for ir_txf
Chris Forbes [Sat, 12 Oct 2013 11:02:55 +0000 (00:02 +1300)]
i965: Generalize coord+offset lowering pass for ir_txf

ir_txf expects an ivec* coordinate, and may be larger than ivec2;
shuffle things around so that this will work.

V2: Fix style nits, use ir_builder

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Add lowering pass to fold offset into unnormalized coords
Chris Forbes [Sat, 12 Oct 2013 10:14:15 +0000 (23:14 +1300)]
i965: Add lowering pass to fold offset into unnormalized coords

It turns out that nonzero offsets with gsampler2DRect don't work -- they
just return garbage. Work around this by folding the offset into the
coord.

Done as an IR pass rather than yet another hack in the visitors because
it's clear what's going on this way. Can possibly reuse this to replace
the existing txf coord+offset hacks.

V2: Use ir_builder

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Add lowering pass for splitting textureGatherOffsets
Chris Forbes [Thu, 10 Oct 2013 09:15:14 +0000 (22:15 +1300)]
i965: Add lowering pass for splitting textureGatherOffsets

Rewrites textureGatherOffsets(s, p, offsets) into

   gvec4(
      textureGatherOffset(s, p, offsets[0]).w,
      textureGatherOffset(s, p, offsets[1]).w,
      textureGatherOffset(s, p, offsets[2]).w,
      textureGatherOffset(s, p, offsets[3]).w
      )

V2: Use ir_builder to be slightly clearer.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Add asserts to ensure that ir_tg4 offset arrays are lowered
Chris Forbes [Thu, 10 Oct 2013 08:40:46 +0000 (21:40 +1300)]
i965: Add asserts to ensure that ir_tg4 offset arrays are lowered

We don't have a message that does 4 independent offsets; a lowering
pass needs to lower it to 4 normal gather4s before reaching this
point.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: add signatures for textureGatherOffsets()
Chris Forbes [Thu, 10 Oct 2013 08:38:43 +0000 (21:38 +1300)]
glsl: add signatures for textureGatherOffsets()

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: add support for texture functions with offset arrays
Chris Forbes [Thu, 10 Oct 2013 08:34:03 +0000 (21:34 +1300)]
glsl: add support for texture functions with offset arrays

This is needed for textureGatherOffsets()

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965/fs: Add support for shadow comparitors with gather4
Chris Forbes [Thu, 10 Oct 2013 06:57:29 +0000 (19:57 +1300)]
i965/fs: Add support for shadow comparitors with gather4

Note that gather4_po_c's parameters are too long for SIMD16. It might be
worth emitting 2xSIMD8 messages in this case at some point.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965/vs: Add support for shadow comparitors with gather4
Chris Forbes [Thu, 10 Oct 2013 06:42:47 +0000 (19:42 +1300)]
i965/vs: Add support for shadow comparitors with gather4

gather4_c's argument layout is straightforward -- refz just goes on the
end.

gather4_po_c's layout however -- the array index is replaced with refz.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Add Gen7 gather4_c and gather4_po_c message types
Chris Forbes [Thu, 10 Oct 2013 06:39:54 +0000 (19:39 +1300)]
i965: Add Gen7 gather4_c and gather4_po_c message types

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Add new textureGather[Offset]() overloads for shadow samplers
Chris Forbes [Thu, 10 Oct 2013 06:35:36 +0000 (19:35 +1300)]
glsl: Add new textureGather[Offset]() overloads for shadow samplers

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>