mesa.git
8 years agost/nine: Begin programmable shader fog support
Axel Davy [Fri, 8 May 2015 17:48:45 +0000 (19:48 +0200)]
st/nine: Begin programmable shader fog support

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Fix fixed function fog support
Axel Davy [Fri, 8 May 2015 17:26:20 +0000 (19:26 +0200)]
st/nine: Fix fixed function fog support

Previous code had only a subcase of fog working right.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Rework ff constant buffers
Axel Davy [Tue, 24 Mar 2015 10:06:22 +0000 (11:06 +0100)]
st/nine: Rework ff constant buffers

Always use a user constant buffer for ff.
It means we have to:
. commit the user constant buffer for ff when we use it
. commit back the non-ff constant buffer when we stop using it

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Rework constant buffer state handling
Axel Davy [Tue, 24 Mar 2015 09:47:35 +0000 (10:47 +0100)]
st/nine: Rework constant buffer state handling

We have two paths:
. One that uses a fixed constant buffer, and updates it when needed
. One that uses a user constant buffer, and uploads it when needed.

This patch separates the preparation of the constant buffer
and the commit.

It also removes NineDevice9_RestoreNonCSOState, which was
used to restore all states. Instead the commit of the constant
buffer is moved to nine_state, and the other field settings
moved to other functions where more appropriate.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Rework blend states
Axel Davy [Tue, 24 Mar 2015 09:10:25 +0000 (10:10 +0100)]
st/nine: Rework blend states

Separate state preparation and state commit

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Improve fallback when driver doesn't support user buffers.
Axel Davy [Sat, 3 Jan 2015 10:36:09 +0000 (11:36 +0100)]
st/nine: Improve fallback when driver doesn't support user buffers.

For now the path updated is only used by Amd drivers, but a later
patch will make it used by all drivers. Some drivers like llvmpipe
doesn't support the uploading of constants from user buffers, so improve
the path to work for all drivers

Inspired from the gl state tracker.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Avoid useless updates in SetSamplerState
Axel Davy [Sun, 15 Feb 2015 15:22:43 +0000 (16:22 +0100)]
st/nine: Avoid useless updates in SetSamplerState

Check for redundant settings

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: David Heidelberg <david@ixit.cz>
8 years agost/nine: Rework rasterizer states
Axel Davy [Tue, 24 Mar 2015 09:16:59 +0000 (10:16 +0100)]
st/nine: Rework rasterizer states

Separate state preparation and state commit

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Reorder DSA state settings
Axel Davy [Fri, 15 May 2015 21:52:09 +0000 (23:52 +0200)]
st/nine: Reorder DSA state settings

Separate state preparation and state commit

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Reorder nine_state.
Axel Davy [Tue, 24 Mar 2015 08:35:18 +0000 (09:35 +0100)]
st/nine: Reorder nine_state.

Instead of mixing state preparation (filling pipe_****)
and state commit (pipe->set_*****),
begin doing so in two separate functions.

This will allow to implement efficient Stateblocks,
and eventually lead to optimisation where the complete
pipe_*** structure is only partially updated.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Remove group_mask argument from nine_update_state
Axel Davy [Sun, 15 Feb 2015 08:19:16 +0000 (09:19 +0100)]
st/nine: Remove group_mask argument from nine_update_state

It was only used to discriminate update framebuffer vs update
everything. Instead use two functions.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Implement TEXBEM,TEXBEML and BEM
Tiziano Bacocco [Fri, 30 Jan 2015 19:10:38 +0000 (20:10 +0100)]
st/nine: Implement TEXBEM,TEXBEML and BEM

Signed-off-by: Tiziano Bacocco <tizbac2@gmail.com>
8 years agost/nine: Fix use of uninitialized values
Patrick Rudolph [Sun, 17 May 2015 10:46:42 +0000 (12:46 +0200)]
st/nine: Fix use of uninitialized values

Set all values to 0 after allocation. Found using valgrind.

Reviewed-by: Axel Davy <axel.davy@ens.fr>
Signed-off-by: Patrick Rudolph <siro@das-labor.org>
8 years agost/nine: Prevent possible crash
Patrick Rudolph [Sat, 16 May 2015 17:47:00 +0000 (19:47 +0200)]
st/nine: Prevent possible crash

In case NineBaseTexture9_ctor returns an error
This->surfaces[l] might be NULL.

Reviewed-by: Axel Davy <axel.davy@ens.fr>
Signed-off-by: Patrick Rudolph <siro@das-labor.org>
8 years agost/nine: Return correct error codes in NineDevice9_Reset
Patrick Rudolph [Tue, 19 May 2015 18:18:29 +0000 (20:18 +0200)]
st/nine: Return correct error codes in NineDevice9_Reset

Allow more than two errors, and return D3DERR_INVALIDCALL
for failed display resolution changes.

Reviewed-by: Axel Davy <axel.davy@ens.fr>
Signed-off-by: Patrick Rudolph <siro@das-labor.org>
8 years agost/nine: Fail on D3DUSAGE_DYNAMIC for D3DPOOL_SCRATCH textures
Patrick Rudolph [Wed, 13 May 2015 17:51:30 +0000 (19:51 +0200)]
st/nine: Fail on D3DUSAGE_DYNAMIC for D3DPOOL_SCRATCH textures

Texture with pool D3DPOOL_SCRATCH and D3DPOOL_MANAGED
cannot be used with flag D3DUSAGE_DYNAMIC.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
8 years agost/nine: Fix Lock Checks for Compressed textures
Axel Davy [Thu, 14 May 2015 15:22:26 +0000 (17:22 +0200)]
st/nine: Fix Lock Checks for Compressed textures

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Impose restrictions on DXTN texture sizes
Axel Davy [Thu, 14 May 2015 15:01:40 +0000 (17:01 +0200)]
st/nine: Impose restrictions on DXTN texture sizes

This is the expected behaviour.

Fixes wine tests.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: David Heidelberg <david@ixit.cz>
8 years agost/nine: Return NULL pointer in lock error cases
Patrick Rudolph [Wed, 13 May 2015 17:43:04 +0000 (19:43 +0200)]
st/nine: Return NULL pointer in lock error cases

Tests showed, that in case of errors, the pBits pointer is set to NULL.
The pBits field isn't set to NULL in case of an already locked object.

Reviewed-by: Axel Davy <axel.davy@ens.fr>
Signed-off-by: Patrick Rudolph <siro@das-labor.org>
8 years agost/nine: Fix resource SetPriority/GetPriority
Patrick Rudolph [Wed, 13 May 2015 05:19:11 +0000 (07:19 +0200)]
st/nine: Fix resource SetPriority/GetPriority

Return 0 for non MANAGED textures and surfaces.
Fixes failing wine d3d9 tests device.c test_resource_priority.

Reviewed-by: Axel Davy <axel.davy@ens.fr>
Signed-off-by: Patrick Rudolph <siro@das-labor.org>
8 years agost/nine: Clean GetPrivateData
Patrick Rudolph [Tue, 12 May 2015 18:28:17 +0000 (20:28 +0200)]
st/nine: Clean GetPrivateData

Move the assert to return error codes in the correct order.
Always set the pSizeOfData to the required buffer size.
Fixes failing wine test device.c test_private_data()

Reviewed-by: Axel Davy <axel.davy@ens.fr>
Signed-off-by: Patrick Rudolph <siro@das-labor.org>
8 years agost/nine: Allow lock coordinates outside range
Patrick Rudolph [Mon, 20 Apr 2015 17:26:55 +0000 (19:26 +0200)]
st/nine: Allow lock coordinates outside range

This fixes wine test device.c test_lockrect_invalid()

Mimic WindowsXp behaviour and allow negative values in the rectangle passed.
Add comment to point out behaviour used.

Reviewed-by: Axel Davy <axel.davy@ens.fr>
Signed-off-by: Patrick Rudolph <siro@das-labor.org>
8 years agost/nine: Fix GenerateMipSubLevels potential crash
Patrick Rudolph [Tue, 12 May 2015 18:07:09 +0000 (20:07 +0200)]
st/nine: Fix GenerateMipSubLevels potential crash

For the case of D3DPOOL_MANAGED textures, This->base.resource can be NULL
at the start of the function. In This case, UploadSelf will take care
of the defining. Assign resource after the UploadSelf call
to prevent NULL pointer exception.

Reviewed-by: Axel Davy <axel.davy@ens.fr>
Signed-off-by: Patrick Rudolph <siro@das-labor.org>
8 years agost/nine: Fix FillColor Flag check
Axel Davy [Sat, 16 May 2015 16:40:02 +0000 (18:40 +0200)]
st/nine: Fix FillColor Flag check

IT is better check if the surface was created with RT flag,
instead of checking capability (llvmpipe was complaining)

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Fix StretchRect checks
Axel Davy [Thu, 7 May 2015 23:29:35 +0000 (01:29 +0200)]
st/nine: Fix StretchRect checks

Fixes Wine tests

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Implement EvictManagedResources
Axel Davy [Fri, 8 May 2015 14:54:53 +0000 (16:54 +0200)]
st/nine: Implement EvictManagedResources

EvictManagedResources is used by apps to free
the gpu memory of MANAGED textures (which have
a cpu memory backing)

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Track managed textures
Axel Davy [Wed, 6 May 2015 22:03:21 +0000 (00:03 +0200)]
st/nine: Track managed textures

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Only update dirty rect for UpdateTexture
Axel Davy [Tue, 5 May 2015 18:40:12 +0000 (20:40 +0200)]
st/nine: Only update dirty rect for UpdateTexture

UpdateTexture is supposed to optimise by uploading only for the
dirty region of the source (d3d9 doc, wine tests).
This patch adds the behaviour for surfaces, but not entirely for
volumes.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Textures start dirty
Axel Davy [Sun, 3 May 2015 22:17:09 +0000 (00:17 +0200)]
st/nine: Textures start dirty

According to the spec all textures start
dirty.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Track dirty region for SYSTEMMEM too
Axel Davy [Sun, 3 May 2015 21:53:48 +0000 (23:53 +0200)]
st/nine: Track dirty region for SYSTEMMEM too

Dirty regions should be tracked for both MANAGED
and SYSTEMMEM.
Until now we didn't bother to track for SYSTEMMEM,
because we hadn't implemented using the dirty region
to avoid some copies

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Add missing BASETEX_REGISTER_UPDATE calls
Axel Davy [Sun, 3 May 2015 21:46:14 +0000 (23:46 +0200)]
st/nine: Add missing BASETEX_REGISTER_UPDATE calls

If the texture is bound and dirty_mip is true,
BASETEX_REGISTER_UPDATE adds the texture to the list
of things to update before the next draw call.

Some calls to it were missing.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: SetAutoGenFilterType should regenerate the sublevels
Axel Davy [Sun, 3 May 2015 21:28:25 +0000 (23:28 +0200)]
st/nine: SetAutoGenFilterType should regenerate the sublevels

It should regenerate the sublevels according to the spec

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Simplify NineVolume9_CopyVolume
Axel Davy [Sun, 3 May 2015 20:57:13 +0000 (22:57 +0200)]
st/nine: Simplify NineVolume9_CopyVolume

We had only one usage for this function.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Split NineSurface9_CopySurface
Axel Davy [Sun, 3 May 2015 20:40:38 +0000 (22:40 +0200)]
st/nine: Split NineSurface9_CopySurface

NineSurface9_CopySurface was supporting more cases than what
we needed, and doing checks that were innapropriate for
some NineSurface9_CopySurface use cases.

This patch splits it into two for the two use cases, and moves
the checks to the caller.

This patch also adds a few checks to NineDevice9_UpdateSurface

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Simplify Volume9 dirty region tracking
Axel Davy [Tue, 5 May 2015 21:51:24 +0000 (23:51 +0200)]
st/nine: Simplify Volume9 dirty region tracking

Similar to what was done for Surface9, track the dirty region
only in VolumeTexture9.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agoutil/u_blitter: implement alpha blending for pipe->blit
Marek Olšák [Sat, 8 Nov 2014 12:02:47 +0000 (13:02 +0100)]
util/u_blitter: implement alpha blending for pipe->blit

8 years agogallium: Add blending to pipe blit
Christoph Bumiller [Sat, 31 May 2014 21:13:24 +0000 (23:13 +0200)]
gallium: Add blending to pipe blit

This type of blending is used for gallium nine software cursor

Signed-off-by: David Heidelberg <david@ixit.cz>
8 years agost/nine: Revert to sw cursor in case of failure to set hw cursor
Axel Davy [Sat, 21 Mar 2015 21:28:59 +0000 (22:28 +0100)]
st/nine: Revert to sw cursor in case of failure to set hw cursor

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: David Heidelberg <david@ixit.cz>
8 years agost/nine: Do not call ID3DPresent_GetCursorPos for sw cursor
Axel Davy [Sat, 21 Mar 2015 21:23:56 +0000 (22:23 +0100)]
st/nine: Do not call ID3DPresent_GetCursorPos for sw cursor

For sw cursor we do not tell wine the cursor position (the app
tells us directly). We shouldn't use ID3DPresent_GetCursorPos.

device->cursor.pos already contains the coordinates the app
gave us.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: David Heidelberg <david@ixit.cz>
8 years agost/nine: Force hw cursor for Windowed mode
Axel Davy [Sun, 22 Mar 2015 17:48:07 +0000 (18:48 +0100)]
st/nine: Force hw cursor for Windowed mode

According to the spec, Windowed mode must
have hw cursor

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: David Heidelberg <david@ixit.cz>
8 years agost/nine: Hide hardware cursor when we don't use it
Axel Davy [Sat, 21 Mar 2015 21:21:14 +0000 (22:21 +0100)]
st/nine: Hide hardware cursor when we don't use it

We have either hardware cursor or software cursor.
When we use software cursor, we should hide the hardware
cursor.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: David Heidelberg <david@ixit.cz>
8 years agost/nine: fix D3DRS_DITHERENABLE wrong state group
Axel Davy [Sun, 15 Feb 2015 20:30:44 +0000 (21:30 +0100)]
st/nine: fix D3DRS_DITHERENABLE wrong state group

D3DRS_DITHERENABLE was assigned to the rasterizer state
group, but it was used for the blend group.

Assign it to the blend group.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Account POINTSIZE_MIN and POINTSIZE_MAX for point size
Patrick Rudolph [Sun, 19 Apr 2015 08:14:30 +0000 (10:14 +0200)]
st/nine: Account POINTSIZE_MIN and POINTSIZE_MAX for point size

When using D3DRS_POINTSIZE make sure the value is at least
D3DRS_POINTSIZE_MIN but not greater than D3DRS_POINTSIZE_MAX.

Fixes some Wine tests.

Reviewed-by: Axel Davy <axel.davy@ens.fr>
Signed-off-by: Patrick Rudolph <siro@das-labor.org>
8 years agost/nine: Align texture memory
Patrick Rudolph [Tue, 12 May 2015 05:27:37 +0000 (07:27 +0200)]
st/nine: Align texture memory

Align texture memory on 32 byte boundry to allow
SSE/AVX memcpy to work on locked rects.

This fixes some crashes with games using SSE.

Reviewed-by: David Heidelberg <david@ixit.cz>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
Signed-off-by: Patrick Rudolph <siro@das-labor.org>
8 years agost/nine: Always set point_quad_rasterization to 1
Axel Davy [Sat, 16 May 2015 16:41:51 +0000 (18:41 +0200)]
st/nine: Always set point_quad_rasterization to 1

Both Points and Point Sprites are rasterized like quads,
according to d3d9 doc and gallium rasterizer doc.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Fix Swizzle for ATI2 format
Axel Davy [Sat, 16 May 2015 20:41:26 +0000 (22:41 +0200)]
st/nine: Fix Swizzle for ATI2 format

We had red and green in the wrong channels
for the ATI2 format (RGTC2).

Found thanks to wine tests.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: David Heidelberg <david@ixit.cz>
8 years agotarget/d3dadapter9: Return Windows like card names
Patrick Rudolph [Mon, 25 May 2015 08:36:21 +0000 (10:36 +0200)]
target/d3dadapter9: Return Windows like card names

Add support for multiple cards and fill in Win
like card name, driver name and version info.
Use fallback for unknown vendors and unknown card names.

Reviewed-by: Axel Davy <axel.davy@ens.fr>
Signed-off-by: Patrick Rudolph <siro@das-labor.org>
8 years agost/nine: Require gcc >= 4.6
David Heidelberg [Fri, 10 Apr 2015 22:13:53 +0000 (00:13 +0200)]
st/nine: Require gcc >= 4.6

Nine code uses some C11 features, and this
leads to compile error on gcc <= 4.5

Another way would have been to use the
-fms-extensions CFLAG

Signed-off-by: David Heidelberg <david@ixit.cz>
Cc: "10.4 10.5 10.6" <mesa-stable@lists.freedesktop.org>
8 years agoglsl: fix error message when validating tcs output decls
Ilia Mirkin [Fri, 21 Aug 2015 19:08:15 +0000 (15:08 -0400)]
glsl: fix error message when validating tcs output decls

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agorelnote updates
Rob Clark [Mon, 10 Aug 2015 21:27:19 +0000 (17:27 -0400)]
relnote updates

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agost/mesa: pass through 4th opcode argument in bitmap/pixel visitors
Ilia Mirkin [Fri, 21 Aug 2015 00:06:50 +0000 (20:06 -0400)]
st/mesa: pass through 4th opcode argument in bitmap/pixel visitors

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.6" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agost/mesa: fix assignments with 4-operand arguments (i.e. BFI)
Ilia Mirkin [Thu, 20 Aug 2015 23:59:04 +0000 (19:59 -0400)]
st/mesa: fix assignments with 4-operand arguments (i.e. BFI)

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.6" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoi965: allow image_size on float images
Martin Peres [Fri, 21 Aug 2015 13:25:14 +0000 (16:25 +0300)]
i965: allow image_size on float images

This got missed because the piglit test only tested int images to avoid a
combinatiorial explosion of format, targets, stages and sizes which
takes more than 5 minutes to test on nvidia's driver.

This patch also drops the IMAGE_FUNCTION_AVAIL_ATOMIC which is not applicable
to the image_size codepath but was not hurting in any way.

Signed-off-by: Martin Peres <martin.peres@linux.intel.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
8 years agoclover: fix llvm 3.5 build error
Zoltan Gilian [Wed, 19 Aug 2015 09:56:08 +0000 (11:56 +0200)]
clover: fix llvm 3.5 build error

There is no MDOperand in llvm 3.5.

v2: Check if kernel metadata is present to avoid crash (EdB).
v3: Second attempt to avoid crash: switch off metadata query for llvm < 3.6.

Reviewed-by: Serge Martin (EdB) <edb+mesa@sigluy.net>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
8 years agomesa: update fbo state in glTexStorage
Tapani Pälli [Thu, 20 Aug 2015 07:25:59 +0000 (10:25 +0300)]
mesa: update fbo state in glTexStorage

We have to re-validate FBOs rendering to the texture like is done
with TexImage and CopyTexImage.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91673
Cc: "10.6" <mesa-stable@lists.freedesktop.org>
8 years agovc4: Add algebraic opt for rcp(1.0).
Eric Anholt [Wed, 19 Aug 2015 05:19:12 +0000 (22:19 -0700)]
vc4: Add algebraic opt for rcp(1.0).

We're generating rcps as part of backend lowering of the packed coordinate
in the CS, and we don't want to lower them in NIR because of the extra
newton-raphson steps in the common case.  However, GLB2.7 is moving a
vertex attribute with a 1.0 W component to the position, and that makes us
produce some silly RCPs.

total instructions in shared programs: 97590 -> 97580 (-0.01%)
instructions in affected programs:     74 -> 64 (-13.51%)

8 years agovc4: Allow unpack_8[abcd]_f's src to stay in r4.
Eric Anholt [Wed, 19 Aug 2015 05:07:47 +0000 (22:07 -0700)]
vc4: Allow unpack_8[abcd]_f's src to stay in r4.

I had QPU emit code to do it, but forgot to flag the register class.

total instructions in shared programs: 97974 -> 97590 (-0.39%)
instructions in affected programs:     25291 -> 24907 (-1.52%)

8 years agovc4: Pack the unorm-packing bits into a src MUL instruction when possible.
Eric Anholt [Wed, 19 Aug 2015 04:26:05 +0000 (21:26 -0700)]
vc4: Pack the unorm-packing bits into a src MUL instruction when possible.

Now that we do non-SSA QIR instructions, we can take a NIR SSA src that's
only used by the unorm packing and just stuff the pack bits into it.

total instructions in shared programs: 98136 -> 97974 (-0.17%)
instructions in affected programs:     4149 -> 3987 (-3.90%)

8 years agovc4: Add a QIR helper for whether the op is a MUL type.
Eric Anholt [Wed, 19 Aug 2015 04:43:42 +0000 (21:43 -0700)]
vc4: Add a QIR helper for whether the op is a MUL type.

8 years agovc4: Drop an unused algebraic op.
Eric Anholt [Wed, 19 Aug 2015 03:18:51 +0000 (20:18 -0700)]
vc4: Drop an unused algebraic op.

NIR now handles this optimization for us.

8 years agovc4: Switch QPU_PACK_SCALED to be two non-SSA instructions.
Eric Anholt [Thu, 6 Aug 2015 03:54:02 +0000 (20:54 -0700)]
vc4: Switch QPU_PACK_SCALED to be two non-SSA instructions.

total instructions in shared programs: 98159 -> 98136 (-0.02%)
instructions in affected programs:     12279 -> 12256 (-0.19%)

8 years agovc4: Make the pack-to-unorm instructions be non-SSA.
Eric Anholt [Thu, 6 Aug 2015 03:31:21 +0000 (20:31 -0700)]
vc4: Make the pack-to-unorm instructions be non-SSA.

This helps ensure that the register allocator doesn't force the later pack
operations to insert extra MOVs.

total instructions in shared programs: 98170 -> 98159 (-0.01%)
instructions in affected programs:     2134 -> 2123 (-0.52%)

8 years agovc4: Allow QIR registers to be non-SSA.
Eric Anholt [Tue, 4 Aug 2015 02:25:47 +0000 (19:25 -0700)]
vc4: Allow QIR registers to be non-SSA.

Now that we have NIR, most of the optimization we still need to do is
peepholes on instruction selection rather than general dataflow
operations.  This means we want to be able to have QIR be a lot closer to
the actual QPU instructions, just with virtual registers.  Allowing
multiple instructions writing the same register opens up a lot of
possibilities.

8 years agovc4: We can now move TEX_RESULT accesses across other r4 ops.
Eric Anholt [Thu, 6 Aug 2015 03:11:07 +0000 (20:11 -0700)]
vc4: We can now move TEX_RESULT accesses across other r4 ops.

No difference on shader-db.

8 years agoglsl: fix binding validation for interface blocks
Timothy Arceri [Wed, 27 May 2015 10:12:42 +0000 (20:12 +1000)]
glsl: fix binding validation for interface blocks

V2: rebase on SSBO changes

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoglsl: interleave constant propagation and folding
Timothy Arceri [Sun, 16 Aug 2015 04:26:23 +0000 (14:26 +1000)]
glsl: interleave constant propagation and folding

The constant folding pass can take a long time to complete
so rather than running through the entire pass each time
a new constant is propagated (and vice versa) interleave them.

This change helps ES31-CTS.arrays_of_arrays.InteractionFunctionCalls1
go from around 2 min -> 23 sec.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agonv50/ir: pre-compute BFE arg when both bits and offset are imm
Ilia Mirkin [Fri, 21 Aug 2015 02:13:48 +0000 (22:13 -0400)]
nv50/ir: pre-compute BFE arg when both bits and offset are imm

Due to a quirk in how the nv50 opt passes run, the algebraic
optimization that looks for these BFE's happens before the constant
folding pass. Rearranging these passes isn't a great idea, but this is
easy enough to fix. Allows a following cvt to eliminate the bfe in
certain situations.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agoglsl: expose textureQueryLod in GLSL 4.00+ fragment shaders
Ilia Mirkin [Wed, 19 Aug 2015 22:43:47 +0000 (18:43 -0400)]
glsl: expose textureQueryLod in GLSL 4.00+ fragment shaders

See issue from the ARB_texture_query_lod spec for LOD vs Lod confusion:

    (3) The core specification uses the "Lod" spelling, not "LOD".  Should
        this extension be modified to use "Lod"?

      RESOLVED: The "Lod" spelling is the correct spelling for the core
      specification and the preferred spelling for use. However, use of
      "LOD" also exists, as the extension predated the core specification,
      so this extension won't remove use of "LOD".

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
8 years agoRevert "mesa/formats: refactor by collapsing cases in switch statement by type"
Nanley Chery [Fri, 21 Aug 2015 01:00:20 +0000 (18:00 -0700)]
Revert "mesa/formats: refactor by collapsing cases in switch statement by type"

This reverts commit ffe6c6ad5f719dedd1b6b95e8590e3f20b23d340.

_mesa_format_num_components() does not include the padding bits in mesa formats
containing 'X' channels. This could cause mipmap generation for certain
uncompressed formats to underestimate the number of channels in the source
image by 1.

Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
8 years agor600g: Fix handling of TGSI_OPCODE_ARR with SB
Glenn Kennard [Thu, 13 Aug 2015 18:30:07 +0000 (20:30 +0200)]
r600g: Fix handling of TGSI_OPCODE_ARR with SB

FLT_TO_INT goes in the vector pipes on evergreen/NI,
not the trans unit as on earlier chips.

Signed-off-by: Glenn Kennard <glenn.kennard@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agor600: Turn 'r600_shader_key' struct into union
Edward O'Callaghan [Wed, 19 Aug 2015 08:58:47 +0000 (18:58 +1000)]
r600: Turn 'r600_shader_key' struct into union

This struct was getting a bit crowded, following the lead of
radeonsi, mirror the idea of having sub-structures for each
shader type. Turning 'r600_shader_key' into an union saves
some trivial memory and CPU cycles for the shader keys.

[airlied: drop as_ls, and reorder so larger fields at start.]
Signed-off-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agor600: Rewrite r600_shader_selector_key() to use a switch stmt
Edward O'Callaghan [Wed, 19 Aug 2015 08:58:46 +0000 (18:58 +1000)]
r600: Rewrite r600_shader_selector_key() to use a switch stmt

Signed-off-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agoi965: Use NIR by default for vertex shaders
Jason Ekstrand [Mon, 3 Aug 2015 15:17:42 +0000 (08:17 -0700)]
i965: Use NIR by default for vertex shaders

Shader-db results for vec4 on i965:

   total instructions in shared programs: 1499894 -> 1502261 (0.16%)
   instructions in affected programs:     1414224 -> 1416591 (0.17%)
   helped:                                2434
   HURT:                                  10543
   GAINED:                                1
   LOST:                                  0

Shader-db results for vec4 on g4x:

   total instructions in shared programs: 1437411 -> 1439779 (0.16%)
   instructions in affected programs:     1362402 -> 1364770 (0.17%)
   helped:                                2434
   HURT:                                  10544
   GAINED:                                0
   LOST:                                  0

Shader-db results for vec4 on Iron Lake:

   total instructions in shared programs: 1437214 -> 1439593 (0.17%)
   instructions in affected programs:     1362205 -> 1364584 (0.17%)
   helped:                                2433
   HURT:                                  10544
   GAINED:                                1
   LOST:                                  0

Shader-db results for vec4 on Sandy Bridge:

   total instructions in shared programs: 2022092 -> 1941570 (-3.98%)
   instructions in affected programs:     1886838 -> 1806316 (-4.27%)
   helped:                                7510
   HURT:                                  10737
   GAINED:                                0
   LOST:                                  0

Shader-db results for vec4 on Ivy Bridge:

   total instructions in shared programs: 1853749 -> 1804960 (-2.63%)
   instructions in affected programs:     1686736 -> 1637947 (-2.89%)
   helped:                                6735
   HURT:                                  11101
   GAINED:                                0
   LOST:                                  0

Shader-db results for vec4 on Haswell:

   total instructions in shared programs: 1853749 -> 1804960 (-2.63%)
   instructions in affected programs:     1686736 -> 1637947 (-2.89%)
   helped:                                6735
   HURT:                                  11101
   GAINED:                                0
   LOST:                                  0

Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Matt Turner <mattst88@gmail.com>
8 years agoglsl: check if return_deref in lower_subroutine_visitor::visit_leave isn't NULL
Kai Wasserbäch [Fri, 14 Aug 2015 12:49:43 +0000 (14:49 +0200)]
glsl: check if return_deref in lower_subroutine_visitor::visit_leave isn't NULL

Fixes a crash in Piglit's
spec@arb_shader_subroutine@linker@no-mutual-recursion.vert for me.

Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agonv50/ir: Handle OP_CVT when folding constant expressions
Tobias Klausmann [Sun, 11 Jan 2015 21:40:22 +0000 (22:40 +0100)]
nv50/ir: Handle OP_CVT when folding constant expressions

[imirkin: handle more type combinations, use macro]
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agonvc0/ir: undo more shifts still by allowing a pre-SHL to occur
Ilia Mirkin [Wed, 19 Aug 2015 03:16:32 +0000 (23:16 -0400)]
nvc0/ir: undo more shifts still by allowing a pre-SHL to occur

This happens with unpackSnorm lowering. There's yet another
bitfield-extract behind it, but there's too much variation to be worth
cutting through.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agonvc0/ir: don't require AND when the high byte is being addressed
Ilia Mirkin [Wed, 19 Aug 2015 02:53:11 +0000 (22:53 -0400)]
nvc0/ir: don't require AND when the high byte is being addressed

unpackUnorm* lowering doesn't AND the high byte/word as it's
unnecessary. Detect that situation as well.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agonvc0/ir: detect i2f/i2i which operate on specific bytes/words
Ilia Mirkin [Wed, 19 Aug 2015 01:09:12 +0000 (21:09 -0400)]
nvc0/ir: detect i2f/i2i which operate on specific bytes/words

Some Unigine shaders have been observed to unpack bytes out of 32-bit
integers and convert them to floats. I2F/I2I can handle this sort of
thing directly. Detect the handleable situations.

This misses 16-bit word capabilities in nv50, but I haven't seen shaders
that would actually make use of that.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agonvc0/ir: detect AND/SHR pairs and convert into EXTBF
Ilia Mirkin [Wed, 19 Aug 2015 01:07:33 +0000 (21:07 -0400)]
nvc0/ir: detect AND/SHR pairs and convert into EXTBF

Some shaders appear to extract bits using shift/and combos. Detect
(some) of those and convert to EXTBF instead.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agonv50/ir: support different unordered_set implementations
Chih-Wei Huang [Fri, 19 Jun 2015 18:00:15 +0000 (02:00 +0800)]
nv50/ir: support different unordered_set implementations

If build with C++11 standard, use std::unordered_set.

Otherwise if build on old Android version with stlport,
use std::tr1::unordered_set with a wrapper class.

Otherwise use std::tr1::unordered_set.

Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agoi965: Fix "handle nir_intrinsic_image_size"
Martin Peres [Thu, 20 Aug 2015 12:15:56 +0000 (15:15 +0300)]
i965: Fix "handle nir_intrinsic_image_size"

I pushed a half-baked version of "i965: handle nir_intrinsic_image_size" by
accident. Not having the Reviewed-by: tags on the last two commits should
have been a red flag but I somehow missed it after the QA check.

This patch should fix image-size for non-int images. I will add support to
the piglit test for all the other image types.

Sorry for the noise.

Signed-off-by: Martin Peres <martin.peres@linux.intel.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
8 years agoi965: enable GL_ARB_shader_image_size
Martin Peres [Wed, 29 Apr 2015 09:42:16 +0000 (12:42 +0300)]
i965: enable GL_ARB_shader_image_size

Signed-off-by: Martin Peres <martin.peres@linux.intel.com>
8 years agoi965: handle nir_intrinsic_image_size
Martin Peres [Wed, 29 Apr 2015 09:39:16 +0000 (12:39 +0300)]
i965: handle nir_intrinsic_image_size

v2, Review from Francisco Jerez:
- avoid the camelCase for the booleans
- init the booleans using the sampler type
- force the initialization of all the components of the output register

v3:
- Rename a variable from CubeMapArray to CubeArray to re-use GLSL's name (Ilia)
- Fix some indentation and drop parenthesis (Topi)
- Fix a signed/unsigned comparaison warning

Signed-off-by: Martin Peres <martin.peres@linux.intel.com>
8 years agonir: convert the glsl intrinsic image_size to nir_intrinsic_image_size
Martin Peres [Tue, 11 Aug 2015 14:42:12 +0000 (17:42 +0300)]
nir: convert the glsl intrinsic image_size to nir_intrinsic_image_size

v2, review from Francisco Jerez:
 - make the destination variable as large as what the nir instrinsic
   defines (4) instead of the size of the return variable of glsl. This
   is still safe for the already existing code because all the intrinsics
   affected returned the same amount of components as expected by glsl IR.
   In the case of image_size, it is not possible to do so because the
   returned number of component depends on the image type and this case
   is not well handled by nir.

v3:
- Style fix

Signed-off-by: Martin Peres <martin.peres@linux.intel.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
8 years agoglsl: add support for the imageSize builtin
Martin Peres [Mon, 27 Apr 2015 16:25:34 +0000 (19:25 +0300)]
glsl: add support for the imageSize builtin

The code is heavily inspired from Francisco Jerez's code supporting the
image_load_store extension.

Backends willing to support this builtin should handle
__intrinsic_image_size.

v2: Based on the review of Ilia Mirkin
- Enable the extension for GLES 3.1
- Fix indentation
- Fix the return type (float to int, number of components for CubeImages)
- Add a warning related to GLES 3.1

v3: Based on the review of Francisco Jerez
- Refactor the code to share both add_image_function and _image with the other
  image-related functions

v4: Based on Topi Pohjolainen's comments
- Do not add parenthesis for the return value

v5: based on Francisco Jerez's comments:
- Fix a few indent issues
- Reduce the size of a condition by testing the dimension and array properties
  instead of enumerating all the formats.

Signed-off-by: Martin Peres <martin.peres@linux.intel.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
8 years agomain: add extension GL_ARB_shader_image_size
Martin Peres [Mon, 27 Apr 2015 17:05:14 +0000 (20:05 +0300)]
main: add extension GL_ARB_shader_image_size

Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Martin Peres <martin.peres@linux.intel.com>
8 years agodocs: Mark GLES 3.1 image load/store as done on i965.
Francisco Jerez [Thu, 20 Aug 2015 10:46:53 +0000 (13:46 +0300)]
docs: Mark GLES 3.1 image load/store as done on i965.

8 years agomesa: Add ES31 API tag for the extension table.
Francisco Jerez [Wed, 19 Aug 2015 11:42:50 +0000 (14:42 +0300)]
mesa: Add ES31 API tag for the extension table.

I'll mark the OES_shader_image_atomic extension entry with this tag to
make sure that we don't expose it on earlier GLES API versions
accidentally, because according to the extension:

 "OpenGL ES 3.1 and GLSL ES 3.10 are required."

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
8 years agoglsl: Parse the allowed image format qualifiers in GLSL ES 3.1.
Francisco Jerez [Sun, 16 Aug 2015 22:47:50 +0000 (01:47 +0300)]
glsl: Parse the allowed image format qualifiers in GLSL ES 3.1.

This includes the minimum required desktop/ES GLSL version in the
format qualifier table in anticipation of new GLSL versions extending
the set of supported image formats.  According to section 4.4.7 of the
GLSL ES 3.1 spec:

"The format layout qualifier identifiers for image variable
 declarations are:
 [...]
 rgba32f
 rgba16f
 r32f
 rgba8
 rgba8_snorm
 [...]
 rgba32i
 rgba16i
 rgba8i
 r32i
 [...]
 rgba32ui
 rgba16ui
 rgba8ui
 r32ui"

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
8 years agoglsl: Recognise image memory qualifiers in GLSL ES 3.1.
Francisco Jerez [Mon, 17 Aug 2015 16:12:00 +0000 (19:12 +0300)]
glsl: Recognise image memory qualifiers in GLSL ES 3.1.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
8 years agoglsl: Define image-related built-in constants required by GLSL ES 3.1.
Francisco Jerez [Mon, 17 Aug 2015 14:42:30 +0000 (17:42 +0300)]
glsl: Define image-related built-in constants required by GLSL ES 3.1.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
8 years agoglsl: Remove duplicate definition of gl_MaxTess*ImageUniforms built-in constants.
Francisco Jerez [Sun, 16 Aug 2015 22:39:38 +0000 (01:39 +0300)]
glsl: Remove duplicate definition of gl_MaxTess*ImageUniforms built-in constants.

These seem to have been re-added at some point during the
ARB_tessellation_shader implementation work.  AFAICT the second
(correct) definition of each constant would have had no effect because
the symbols were already defined.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
8 years agoglsl: Accept atomic_uint type in GLSL ES 3.1.
Francisco Jerez [Sun, 16 Aug 2015 22:38:00 +0000 (01:38 +0300)]
glsl: Accept atomic_uint type in GLSL ES 3.1.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
8 years agoglsl: Accept supported image types in GLSL ES 3.1.
Francisco Jerez [Sun, 16 Aug 2015 22:37:12 +0000 (01:37 +0300)]
glsl: Accept supported image types in GLSL ES 3.1.

These are a subset of the image types supported by desktop GL,
excluding 1D, 1D array, rectangle, buffer, cube array, 2D MS and 2D
MS array texture targets.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
8 years agoglsl: Expose image load and store built-ins in GLSL ES 3.1.
Francisco Jerez [Sun, 16 Aug 2015 22:34:41 +0000 (01:34 +0300)]
glsl: Expose image load and store built-ins in GLSL ES 3.1.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
8 years agoglsl: Use a separate availability class for image atomic built-ins.
Francisco Jerez [Sun, 16 Aug 2015 22:34:13 +0000 (01:34 +0300)]
glsl: Use a separate availability class for image atomic built-ins.

These are not part of unextended GLSL ES 3.1.

Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
8 years agoglsl: Allow precision qualifiers on general opaque types.
Francisco Jerez [Sun, 16 Aug 2015 22:28:57 +0000 (01:28 +0300)]
glsl: Allow precision qualifiers on general opaque types.

From the GLSL ES 3.1 spec, section 4.7.3:
 "Any floating point, integer, opaque type declaration can have the
  type preceded by one of these precision qualifiers: [...] highp
  [...], mediump [...], lowp [...]."

Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
8 years agoglsl: Implement GLSL ES restriction on images being either readonly or writeonly.
Francisco Jerez [Sun, 16 Aug 2015 22:27:43 +0000 (01:27 +0300)]
glsl: Implement GLSL ES restriction on images being either readonly or writeonly.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
8 years agoglsl: Require that all image uniforms have a format qualifier in GLSL ES.
Francisco Jerez [Sun, 16 Aug 2015 22:26:40 +0000 (01:26 +0300)]
glsl: Require that all image uniforms have a format qualifier in GLSL ES.

Note that this is slightly more permissive than the spec language
requires: "Any image variable must specify a format layout qualifier."

The GLSL ES spec seems really sketchy regarding format layout
qualifiers on function formal parameters -- On the one hand they are
required, but on the other hand it doesn't provide any syntax to
specify them (see section 6.1.1), they don't participate in parameter
type matching for overload resolution, and are in fact explictly
forbidden ("Layout qualifiers cannot be used on formal function
parameters").  Of course none of the image built-in functions defined
by the spec specify format layout qualifiers (and they probably
couldn't sensibly), to contradict its own requirement.

This probably qualifies for a spec bug, but in the meantime do the
sensible thing and require layout qualifiers on uniforms *only*.

Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
8 years agoglsl: Add support for image binding qualifiers.
Francisco Jerez [Sun, 16 Aug 2015 22:25:11 +0000 (01:25 +0300)]
glsl: Add support for image binding qualifiers.

Support for binding an image to an image unit explicitly in the shader
source is required by both GLSL 4.2 and GLSL ES 3.1, but not by the
original ARB_shader_image_load_store extension.

Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>