platform/upstream/mesa.git
8 years agost/nine: handle possible failure of D3DWindowBuffer_create
Patrick Rudolph [Sat, 24 Sep 2016 09:34:33 +0000 (11:34 +0200)]
st/nine: handle possible failure of D3DWindowBuffer_create

Check for errors and pass them to the callers.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Assert on buffer creation failure
Patrick Rudolph [Sat, 24 Sep 2016 08:46:27 +0000 (10:46 +0200)]
st/nine: Assert on buffer creation failure

Add an assert to make sure buffer creation doesn't fail.
Add error handling in calling functions.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Use NineDevice9_CreateDepthStencilSurface in swapchain9
Patrick Rudolph [Fri, 23 Sep 2016 15:55:08 +0000 (17:55 +0200)]
st/nine: Use NineDevice9_CreateDepthStencilSurface in swapchain9

Replace custom code with NineDevice9_CreateDepthStencilSurface.
All functionality is given now.

8 years agost/nine: Fix check and remove useless code in swapchain9
Axel Davy [Sat, 1 Oct 2016 22:58:48 +0000 (00:58 +0200)]
st/nine: Fix check and remove useless code in swapchain9

The removed code was there for two reasons:
1) Allow DF16, DF24, INTZ to be used as depth buffer
for swapchain, if the driver doesn't support
PIPE_BIND_SAMPLER_VIEW for the underlying format
2) Set PIPE_BIND_SAMPLER_VIEW if possible, such that
if StretchRect is called on the depth texture, it is happy.

1) The reason these formats needed a workaround is because
the check flags for them in CheckDeviceFormat were incorrect,
which led applications to think the formats were valid for
swapchains, even if they weren't supported.
2) StretchRect limitations for depth buffers force
the resource_copy_region path, which should be fine without
PIPE_BIND_SAMPLER_VIEW.

Thus fix the check for 1), and remove the code.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Implement MSAA quality levels
Patrick Rudolph [Thu, 22 Sep 2016 15:03:17 +0000 (17:03 +0200)]
st/nine: Implement MSAA quality levels

Advertise quality levels:
Each supported multisample count matches to one quality level.
The application doesn't know how much samples each quality level has.
For that reason it's not possible to set the multisample mask.

Return errors on quality level missmatch.

Fixes several old games not having multisample support until now.

Fix for issue #73.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Prepare update_framebuffer for MS quality levels
Patrick Rudolph [Fri, 30 Sep 2016 16:15:31 +0000 (18:15 +0200)]
st/nine: Prepare update_framebuffer for MS quality levels

Compare resource's nr_samples instead of D3D multisample level.
Required for multisample quality levels to work correct.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Add additional error handling in CheckDeviceMultiSampleType
Patrick Rudolph [Fri, 30 Sep 2016 14:15:38 +0000 (16:15 +0200)]
st/nine: Add additional error handling in CheckDeviceMultiSampleType

Return one supported quality level in error cases.
Return error on invalid multisample count.

Fixes failing wine tests.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Fix compiler warning
Patrick Rudolph [Thu, 1 Sep 2016 16:07:55 +0000 (18:07 +0200)]
st/nine: Fix compiler warning

Use strict aliasing in SetPrivateData and struct pheader.
Casting char[1] to IUnknown** isn't allowed in strict aliasing.
Compute pointer to body by adding size of header to header pointer.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Remove resource9 {Set/Get/Free}PrivateData functions
Patrick Rudolph [Fri, 16 Sep 2016 15:33:52 +0000 (17:33 +0200)]
st/nine: Remove resource9 {Set/Get/Free}PrivateData functions

Remove {Set/Get/Free}PrivateData in resource9.
Functionality has been implement in IUnknown interface.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Remove volume9 {Set/Get/Free}PrivateData functions
Patrick Rudolph [Fri, 16 Sep 2016 15:32:20 +0000 (17:32 +0200)]
st/nine: Remove volume9 {Set/Get/Free}PrivateData functions

Remove {Set/Get/Free}PrivateData in volume9.
Functionality has been implement in IUnknown interface.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Switch {Set/Get/Free}PrivateData functions
Patrick Rudolph [Fri, 16 Sep 2016 15:29:47 +0000 (17:29 +0200)]
st/nine: Switch {Set/Get/Free}PrivateData functions

Switch {Set/Get/Free}PrivateData function to introduced IUnknown functions.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Implement {Set/Get/Free}PrivateData in iunknown
Patrick Rudolph [Fri, 16 Sep 2016 15:26:07 +0000 (17:26 +0200)]
st/nine: Implement {Set/Get/Free}PrivateData in iunknown

Implement {Set/Get/Free}PrivateData in iunknown to get rid
of duplicated code in resource9 and volume9.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Return device in NineSurface9_GetContainer
Patrick Rudolph [Fri, 16 Sep 2016 14:42:50 +0000 (16:42 +0200)]
st/nine: Return device in NineSurface9_GetContainer

According to MSDN the device is returned for surfaces that do
not have a regular container.

Such surfaces are:
OffscreenPlainSurface, DepthStencilSurface and RenderTarget

Tested and verified on Windows.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Allocate surface resources in surface ctor
Patrick Rudolph [Thu, 15 Sep 2016 18:28:17 +0000 (20:28 +0200)]
st/nine: Allocate surface resources in surface ctor

Allocate resources in surface ctor.
Allows to use statetracker internal memory accounting.

Fix for issue #231.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Fix D3DFMT_NULL size
Axel Davy [Sun, 2 Oct 2016 09:58:41 +0000 (11:58 +0200)]
st/nine: Fix D3DFMT_NULL size

D3DFMT_NULL is mapped to PIPE_FORMAT_NONE.
Instead of relying on PIPE_FORMAT_NONE to
return a size, pick one.
The one picked is the same than Wine.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Add debugging output
Patrick Rudolph [Wed, 14 Sep 2016 17:51:48 +0000 (19:51 +0200)]
st/nine: Add debugging output

Add DBG calls to NineTexture9_GetLevelDesc and
NineTexture9_GetSurfaceLevel to ease debugging.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Fix assert in NineUnknown_QueryInterface
Patrick Rudolph [Wed, 14 Sep 2016 17:50:16 +0000 (19:50 +0200)]
st/nine: Fix assert in NineUnknown_QueryInterface

Tests showed that is allowed to call this method on
object that have a zero refcount.
Required for issue #230.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Print interface id in NineVolume9_GetContainer
Patrick Rudolph [Wed, 14 Sep 2016 17:12:58 +0000 (19:12 +0200)]
st/nine: Print interface id in NineVolume9_GetContainer

To ease debugging print interface id.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Print interface id in NineSurface9_GetContainer
Patrick Rudolph [Wed, 14 Sep 2016 17:12:27 +0000 (19:12 +0200)]
st/nine: Print interface id in NineSurface9_GetContainer

To ease debugging print interface id.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Print interface id in NineUnknown_QueryInterface
Patrick Rudolph [Wed, 14 Sep 2016 16:44:41 +0000 (18:44 +0200)]
st/nine: Print interface id in NineUnknown_QueryInterface

To ease debugging print interface id.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Move assert in NineSurface9_ctor
Patrick Rudolph [Sun, 11 Sep 2016 09:05:01 +0000 (11:05 +0200)]
st/nine: Move assert in NineSurface9_ctor

Move assert to function entry.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Properly declare sampler states for ff
Axel Davy [Sat, 1 Oct 2016 10:55:16 +0000 (12:55 +0200)]
st/nine: Properly declare sampler states for ff

Fixes a softpipe assertion failure with wine tests

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
8 years agost/nine: Handle user clipping planes properly for ff
Axel Davy [Sat, 1 Oct 2016 09:47:52 +0000 (11:47 +0200)]
st/nine: Handle user clipping planes properly for ff

Found reading msdn and checking Wine.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Fix the calculation of the number of vs inputs
Axel Davy [Thu, 29 Sep 2016 22:17:45 +0000 (00:17 +0200)]
st/nine: Fix the calculation of the number of vs inputs

Fixes hangs on radeonsi, and assert on llvmpipe.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
8 years agost/nine: Fix specular w coordinate
Axel Davy [Sun, 25 Sep 2016 19:20:23 +0000 (21:20 +0200)]
st/nine: Fix specular w coordinate

Found looking at Wine formulas.
Fixes a few visual issues.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Disable parts of lighting calculation if no normal provided
Axel Davy [Sun, 25 Sep 2016 19:15:07 +0000 (21:15 +0200)]
st/nine: Disable parts of lighting calculation if no normal provided

Behaviour found in Wine sources, and checked with some test apps.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Fix condition for specular lightning
Axel Davy [Sun, 25 Sep 2016 17:58:33 +0000 (19:58 +0200)]
st/nine: Fix condition for specular lightning

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Do always accumulate diffuse
Axel Davy [Sun, 25 Sep 2016 17:39:29 +0000 (19:39 +0200)]
st/nine: Do always accumulate diffuse

According to spec.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
8 years agost/nine: Initialize ps ff registers
Axel Davy [Sun, 25 Sep 2016 12:55:04 +0000 (14:55 +0200)]
st/nine: Initialize ps ff registers

Found with wine tests for the rTmp register.
Not sure for the other ones.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Do not pollute rTmp in ff ps
Axel Davy [Sun, 25 Sep 2016 12:50:32 +0000 (14:50 +0200)]
st/nine: Do not pollute rTmp in ff ps

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
8 years agost/nine: Allocate temporaries on demand for ps ff
Axel Davy [Sun, 25 Sep 2016 12:04:17 +0000 (14:04 +0200)]
st/nine: Allocate temporaries on demand for ps ff

Same change than for vs ff.
This makes it easier to not introduce mistakes
reusing temporaries whose result shouldn't be
erased.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
8 years agost/nine: Fix texbem
Axel Davy [Sun, 25 Sep 2016 11:34:25 +0000 (13:34 +0200)]
st/nine: Fix texbem

Error found with wine tests.
nine_shader was expecting another order
than the one device9 was using.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
8 years agost/nine: Fix ff computation for inverse
Axel Davy [Sun, 25 Sep 2016 10:43:29 +0000 (12:43 +0200)]
st/nine: Fix ff computation for inverse

Thanks to wine tests.
Apparently 4x4 inverse is to be used, and
if the inverse can't be calculated, the
input matrix is to be used.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Used normed Vtx for reflectionvector
Axel Davy [Sun, 25 Sep 2016 10:16:59 +0000 (12:16 +0200)]
st/nine: Used normed Vtx for reflectionvector

Fix deduced from the spec.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Implement SPHEREMAP
Axel Davy [Sun, 25 Sep 2016 10:07:29 +0000 (12:07 +0200)]
st/nine: Implement SPHEREMAP

Behaviour checked with a test app.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Enable passthrough only if positiont is used
Axel Davy [Sun, 25 Sep 2016 00:05:28 +0000 (02:05 +0200)]
st/nine: Enable passthrough only if positiont is used

Wine tests for the passthrough feature are for positiont.

Nothing seems to indicate passthrough happens when positiont
it not used. However having passthrough with positiont makes
sense (to be used with ProcessVertices outputs).

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Fix wrong mask in ff vs
Axel Davy [Sun, 25 Sep 2016 14:01:57 +0000 (16:01 +0200)]
st/nine: Fix wrong mask in ff vs

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
8 years agost/nine: Fix tweening factor computation
Axel Davy [Sat, 24 Sep 2016 21:55:57 +0000 (23:55 +0200)]
st/nine: Fix tweening factor computation

The computation was reversed.
Deduced by tests on windows.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Disable ff vertex blending if required inputs are missing
Axel Davy [Sat, 24 Sep 2016 21:50:58 +0000 (23:50 +0200)]
st/nine: Disable ff vertex blending if required inputs are missing

This behaviour has been partially tested on windows.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Use materials if source is not given.
Axel Davy [Sat, 24 Sep 2016 20:49:31 +0000 (22:49 +0200)]
st/nine: Use materials if source is not given.

Deduced by test on windows.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Fix ff SPECULARENABLE
Axel Davy [Sat, 24 Sep 2016 20:19:14 +0000 (22:19 +0200)]
st/nine: Fix ff SPECULARENABLE

We were (wrongly) adding specular to diffuse
in vertex shaders when SPECULARENABLE was set.

However the spec says specular has to be added
after texture processing (which is in ps).
Besides SPECULARENABLE is flagged as a pixel state.

There was unused support for SPECULARENABLE
in the ps ff code.
Remove the vs code, and use the ps code.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Undefined specular should be full of zeros
Axel Davy [Sat, 24 Sep 2016 20:17:22 +0000 (22:17 +0200)]
st/nine: Undefined specular should be full of zeros

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
8 years agost/nine: Implement normal transformation with vertex blending
Axel Davy [Thu, 29 Sep 2016 20:16:19 +0000 (22:16 +0200)]
st/nine: Implement normal transformation with vertex blending

The formula is different from the one of the spec,
but otherwise nothing particular.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Increase MaxVertexBlendMatrixIndex
Axel Davy [Sat, 24 Sep 2016 19:09:08 +0000 (21:09 +0200)]
st/nine: Increase MaxVertexBlendMatrixIndex

Modern cards do advertise 8.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Compact ff vs constants a bit
Axel Davy [Sat, 24 Sep 2016 19:05:04 +0000 (21:05 +0200)]
st/nine: Compact ff vs constants a bit

There are several holes. This patch reduces
the holes a bit, which reduces the size of
the constant buffer uploaded.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Fix vertex blending aVtx computation
Axel Davy [Sat, 24 Sep 2016 08:42:08 +0000 (10:42 +0200)]
st/nine: Fix vertex blending aVtx computation

There was an multiplication by the world matrix 0
which had nothing to do there.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Reorganize ff vtx processing
Axel Davy [Sat, 24 Sep 2016 08:22:30 +0000 (10:22 +0200)]
st/nine: Reorganize ff vtx processing

The new order simplified the code a bit for
next patches.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Small simplification for position_t and fog
Axel Davy [Sat, 24 Sep 2016 08:14:42 +0000 (10:14 +0200)]
st/nine: Small simplification for position_t and fog

position_t disables fog computation.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Cleaning code for vs temporaries
Axel Davy [Fri, 23 Sep 2016 21:14:36 +0000 (23:14 +0200)]
st/nine: Cleaning code for vs temporaries

This has been a real mess up to now: the temporaries
were allocated once, and shared after that between
the different parts of the code.

To help maintaining the code, the temporaries are now
allocated and released on need.

As surprising as it could be, this patch, which was
supposed to introduce no behaviour change, actually
solved a visual bug observed on a sample program.
This was due to ureg_normalize3 polluting a temporary
variable.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: No need for the local flag for temporaries in ff
Axel Davy [Fri, 23 Sep 2016 20:24:42 +0000 (22:24 +0200)]
st/nine: No need for the local flag for temporaries in ff

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
8 years agost/nine: Handle D3DRS_NORMALIZENORMALS
Axel Davy [Fri, 23 Sep 2016 19:50:51 +0000 (21:50 +0200)]
st/nine: Handle D3DRS_NORMALIZENORMALS

When this state is set, the normals computed
in the vs ff shader should be normalized.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
8 years agost/nine: Initial ProcessVertices support
Axel Davy [Mon, 19 Sep 2016 17:00:23 +0000 (19:00 +0200)]
st/nine: Initial ProcessVertices support

For now only VS 3 support is implemented.

This enables The Sims 2 to work.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Partial software vertex processing support
Axel Davy [Sat, 17 Sep 2016 12:16:41 +0000 (14:16 +0200)]
st/nine: Partial software vertex processing support

Software Vertex Processing allows:
. Less limitations for shaders (more loops, etc)
. Less limitations for ff (more enabled lights, 255
matrices for VertexBlend)

In particular shaders can get more constants.
This patch implements support for this (not using software
rendering, but hardware rendering, as llvmpipe and dx10+ hw
have the same limits...)

This is considered a second class path. Even apps asking for
"Mixed Vertex processing" (ie the ability to switch to swvp
on demand) do not use the feature much. Some just initialize
more constants than the normal limit at the start of the
application, but never use more than the normal limit.
When the apps do not need the software vertex processing
features, they do not seem to turn it on. This means it is
ok if that path is slow.
Thus no care has been made to make the path optimized.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Rework vs int and bool constants buffer
Axel Davy [Tue, 4 Oct 2016 17:45:40 +0000 (19:45 +0200)]
st/nine: Rework vs int and bool constants buffer

This will help to support swvp constants.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Change dirty tracking for vs int and bool constants
Axel Davy [Tue, 4 Oct 2016 17:29:59 +0000 (19:29 +0200)]
st/nine: Change dirty tracking for vs int and bool constants

This change makes easier to introduce tracking for
swvp constants.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Drop unused constant upload path
Axel Davy [Tue, 4 Oct 2016 17:14:42 +0000 (19:14 +0200)]
st/nine: Drop unused constant upload path

This path has been disabled for some time because
of some bugs with it. It hasn't been updated to the
new features, and is not faster.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
8 years agost/nine: Add support for swvp constants in shaders
Axel Davy [Sat, 17 Sep 2016 10:14:58 +0000 (12:14 +0200)]
st/nine: Add support for swvp constants in shaders

swvp has relaxed limits (more nested loops, etc).
In particular it enables more constants.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Initial mixed vertex processing support
Axel Davy [Thu, 15 Sep 2016 21:00:02 +0000 (23:00 +0200)]
st/nine: Initial mixed vertex processing support

In mixed vertex processing, the user can enable or disable
software vertex processing. It is on hardware by default.

This feature is not a state, and thus the setting doesn't
need to be recorded by stateblocks.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Implement SetNPatchMode
Axel Davy [Sun, 11 Sep 2016 14:21:43 +0000 (16:21 +0200)]
st/nine: Implement SetNPatchMode

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Implement D3DUSAGE_SOFTWAREPROCESSING
Axel Davy [Sun, 11 Sep 2016 13:57:12 +0000 (15:57 +0200)]
st/nine: Implement D3DUSAGE_SOFTWAREPROCESSING

Buffers with this flag must be usable with both software
and hardware vertex processing. Use Staging for fast cpu access.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
8 years agost/nine: Allocate more space for ATI1
Patrick Rudolph [Sat, 20 Aug 2016 07:39:08 +0000 (09:39 +0200)]
st/nine: Allocate more space for ATI1

ATIx are "unknown" formats that do not follow block format conventions.
Tests showed that pitch*height bytes are allocated.
apitrace used to depend on this behaviour.
It used to copy more bytes than it has to for the ATI1 block format,
but it didn't crash on Windows.

Increase buffersize for ATI1 to fix this crash.
The same issue was present in WINE but a patch has been sent by me.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Add missing break
Patrick Rudolph [Sat, 6 Aug 2016 05:54:54 +0000 (07:54 +0200)]
st/nine: Add missing break

Add missing break instruction.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Implement relative addressing for ps inputs
Axel Davy [Sun, 12 Jun 2016 20:20:21 +0000 (22:20 +0200)]
st/nine: Implement relative addressing for ps inputs

To implement the feature we copy the ps inputs to a temp array.
This is not optimal for performance, but it is the simplest solution.

This is a feature that is very very rarely used.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Wait for pending tasks to execute in swapchain
Axel Davy [Sat, 7 May 2016 14:25:03 +0000 (16:25 +0200)]
st/nine: Wait for pending tasks to execute in swapchain

Fixes crash after Reset() when using thread_submit=true

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Use fixed size arrays for swapchain buffers
Axel Davy [Sat, 7 May 2016 14:14:00 +0000 (16:14 +0200)]
st/nine: Use fixed size arrays for swapchain buffers

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Fix buffer count check for Ex devices
Patrick Rudolph [Sat, 7 May 2016 14:02:59 +0000 (16:02 +0200)]
st/nine: Fix buffer count check for Ex devices

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Disable seamless cubemap for d3d
Axel Davy [Sun, 17 Apr 2016 17:14:35 +0000 (19:14 +0200)]
st/nine: Disable seamless cubemap for d3d

d3d9 doesn't have seamless cubemap.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Fix some check flags
Axel Davy [Mon, 14 Mar 2016 21:19:54 +0000 (22:19 +0100)]
st/nine: Fix some check flags

Uses the new defines introduced in previous commit.
See comment in the commit for more explanation.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Unify some check flags
Axel Davy [Mon, 14 Mar 2016 20:26:19 +0000 (21:26 +0100)]
st/nine: Unify some check flags

The new defines will be reused in a later patch.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agogallium/util: Really allow aliasing of dst for u_box_union_*
Axel Davy [Fri, 30 Sep 2016 18:48:22 +0000 (20:48 +0200)]
gallium/util: Really allow aliasing of dst for u_box_union_*

Gallium nine relies on aliasing to work with this function.
Without this patch, dirty region tracking was incorrect, which
could lead to incorrect textures or vertex buffers.
Fixes several game bugs with nine.
Fixes https://github.com/iXit/Mesa-3D/issues/234

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
8 years agosoftpipe: Cap to 2 GB on 32 bits
Axel Davy [Thu, 6 Oct 2016 17:42:21 +0000 (19:42 +0200)]
softpipe: Cap to 2 GB on 32 bits

On 32 bits system, application memory is quite limited.
softpipe uses application memory. To help prevent memory
exhaustion, limit reported memory availability to 2GB.

Some gallium nine apps do check reported memory by allocating
resources until memory is full. Gallium nine refuses allocations
when 80% of the reported memory limit is used. This change
helps some apps to start.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
8 years agollvmpipe: Cap to 2 GB on 32 bits
Axel Davy [Mon, 28 Mar 2016 20:34:35 +0000 (22:34 +0200)]
llvmpipe: Cap to 2 GB on 32 bits

On 32 bits system, application memory is quite limited.
llvmpipe uses application memory. To help prevent memory
exhaustion, limit reported memory availability to 2GB.

Some gallium nine apps do check reported memory by allocating
resources until memory is full. Gallium nine refuses allocations
when 80% of the reported memory limit is used. This change
helps some apps to start.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
8 years agogallium/os: Fix overflow on 32 bits
Axel Davy [Thu, 6 Oct 2016 17:35:04 +0000 (19:35 +0200)]
gallium/os: Fix overflow on 32 bits

On systems with more than 4GB of ram,
os_get_total_physical_memory was triggering an integer
overflow for the linux and haiku path, when on
32 bits.

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

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agost/nine: Memset pipe_resource templates
Axel Davy [Sun, 9 Oct 2016 12:26:32 +0000 (14:26 +0200)]
st/nine: Memset pipe_resource templates

Fixes regression introduced by
ecd6fce2611e88ff8468a354cff8eda39f260a31
and is more future proof than just clearing the next
field.

Other nine usages did already zero out the templates.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Acked-by: Edward O'Callaghan <funfunctor@folklore1984.net>
8 years agonvc0: fix valid range for shader buffers
Samuel Pitoiset [Sun, 9 Oct 2016 20:17:51 +0000 (22:17 +0200)]
nvc0: fix valid range for shader buffers

When offset != 0, the valid range was wrong because the second
argument of util_range_add() is end, not size.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agonvc0/ir: fix overwriting of value backing non-constant gather offset
Ilia Mirkin [Mon, 10 Oct 2016 16:06:59 +0000 (12:06 -0400)]
nvc0/ir: fix overwriting of value backing non-constant gather offset

Normally the value is an immediate, which is moved to some temporary, so
there's no problem. In the case of a non-constant offset (as allowed by
ARB_gpu_shader5), we have to take care to copy it first before using it
to build up the bits.

This fixes a compilation error observed in F1 2015.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Cc: mesa-stable@lists.freedesktop.org
8 years agoglsl: Add missing cache_destroy stub function.
Vinson Lee [Fri, 7 Oct 2016 20:57:44 +0000 (13:57 -0700)]
glsl: Add missing cache_destroy stub function.

  CC       glsl/tests/cache_test.o
glsl/tests/cache_test.c: In function ‘test_cache_create’:
glsl/tests/cache_test.c:160:4: error: implicit declaration of function ‘cache_destroy’ [-Werror=implicit-function-declaration]
    cache_destroy(cache);
    ^

Fixes: 87ab26b2ab35 ("glsl: Add initial functions to implement an on-disk cache")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agodocs: Mark GL_OES_viewport_array done on i965
Anuj Phogat [Wed, 5 Oct 2016 19:18:55 +0000 (12:18 -0700)]
docs: Mark GL_OES_viewport_array done on i965

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
8 years agoegl: Unify the EGLint/EGLAttrib paths in eglCreateSync* (v3)
Chad Versace [Tue, 27 Sep 2016 20:27:21 +0000 (13:27 -0700)]
egl: Unify the EGLint/EGLAttrib paths in eglCreateSync* (v3)

Pre-patch, there were two code paths for parsing EGLSync attribute
lists: one path for old-style EGLint lists, used by eglCreateSyncKHR,
and another for new-style EGLAttrib lists, used by eglCreateSync (1.5)
and eglCreateSync64 (EGL_KHR_cl_event2).

There were two attrib_list parsing functions,
  _eglParseSyncAttribList(_EGLSync *sync, const EGLint *attrib_list)
  _eglParseSyncAttribList64(_EGLSync *sync, const EGLattrib *attrib_list)
This patch unifies the two attrib_list parsing functions into one,
  _eglParseSyncAttribList(_EGLSync *sync, const EGLattrib *attrib_list)

Many internal EGLSync function signatures had *two* attrib_list
parameters to accomodate both code paths: one parameter was an EGLint
list and other an EGLAttrib list. At most one of the parameters was
allowed to be non-null.  This patch removes the `EGLint *attrib_list`
parameter, leaving only the `EGLAttrib *attrib_list` parameter, for all
internal EGLSync functions.

v2:
  - Consistently use condition (sizeof(int_list[0]) ==
    sizeof(attrib_list[0])). [for emil]
v3:
  - Don't double-unlock the display in eglCreateSyncKHR.

Reviewed-by: Emil Velikov <emil.velikov@collabora.com> (v2)
8 years agointel: Fix bash-specific redirection.
Eric Anholt [Mon, 10 Oct 2016 16:18:19 +0000 (09:18 -0700)]
intel: Fix bash-specific redirection.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
8 years agogallium: Fix install-gallium-links.mk on non-bash /bin/sh
Eric Anholt [Thu, 6 Oct 2016 22:19:21 +0000 (15:19 -0700)]
gallium: Fix install-gallium-links.mk on non-bash /bin/sh

Debian uses dash by default, which doesn't do '+='.  Fixes servo's
osmesa-based headless testing system, which was looking for libOSMesa in
the lib/ directory.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Cc: mesa-stable@lists.freedesktop.org
8 years agonv50/ir: only stick one preret per function
Ilia Mirkin [Sun, 9 Oct 2016 04:09:54 +0000 (00:09 -0400)]
nv50/ir: only stick one preret per function

A function with multiple returns would have had multiple preret settings
at the top of the function. While this is unlikely to have caused issues
since we don't use functions in earnest, it could have in some cases
overflowed the call stack, in case a function had a lot of early
returns.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
8 years agoradeonsi: make more use of si_have_tgsi_compute
Nicolai Hähnle [Thu, 6 Oct 2016 20:57:55 +0000 (22:57 +0200)]
radeonsi: make more use of si_have_tgsi_compute

Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agogallium/radeon: assign a name to LLVM output variables in debug builds
Nicolai Hähnle [Fri, 7 Oct 2016 15:14:54 +0000 (17:14 +0200)]
gallium/radeon: assign a name to LLVM output variables in debug builds

This can be helpful with R600_DEBUG=preoptir.

Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agogallium/radeon: avoid redundant work with overlapping in/out arrays
Nicolai Hähnle [Fri, 7 Oct 2016 10:54:34 +0000 (12:54 +0200)]
gallium/radeon: avoid redundant work with overlapping in/out arrays

Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: support ARB_compute_variable_group_size
Nicolai Hähnle [Fri, 9 Sep 2016 08:08:11 +0000 (10:08 +0200)]
radeonsi: support ARB_compute_variable_group_size

Not sure if it's possible to avoid programming the block size twice (once for
the userdata and once for the dispatch).

Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoanv: turn on samplerAnisotropy in VkPhysicalDeviceFeatures
Lionel Landwerlin [Fri, 7 Oct 2016 12:53:04 +0000 (13:53 +0100)]
anv: turn on samplerAnisotropy in VkPhysicalDeviceFeatures

According to the Vulkan spec 5.63.4 :

  samplerAnisotropy indicates whether anisotropic filtering is supported. If
  this feature is not enabled, the maxAnisotropy member of the
  VkSamplerCreateInfo structure must be 1.0.

Since we already set maxAnisotropy to 16 and program the hardware according
to the VkSamplerCreateInfo.maxAnisotropy, it seems we can turn this on.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoradv: Use proper header guards over 'pragma once' directives
Edward O'Callaghan [Fri, 7 Oct 2016 11:19:19 +0000 (22:19 +1100)]
radv: Use proper header guards over 'pragma once' directives

Signed-off-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
8 years agomesa: throw error if bufSize negative in GetSynciv on OpenGL ES
Tapani Pälli [Fri, 7 Oct 2016 05:41:15 +0000 (08:41 +0300)]
mesa: throw error if bufSize negative in GetSynciv on OpenGL ES

Fixes following dEQP tests:

   dEQP-GLES31.functional.debug.negative_coverage.callbacks.state.get_synciv
   dEQP-GLES31.functional.debug.negative_coverage.get_error.state.get_synciv
   dEQP-GLES31.functional.debug.negative_coverage.log.state.get_synciv

v2: drop _mesa_is_gles check (Kenneth)

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98133
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoglsl: prohibit lowp, mediump precision on atomic_uint
Tapani Pälli [Fri, 7 Oct 2016 05:23:41 +0000 (08:23 +0300)]
glsl: prohibit lowp, mediump precision on atomic_uint

Fixes following dEQP tests:

   dEQP-GLES31.functional.debug.negative_coverage.callbacks.atomic_counter.atomic_precision
   dEQP-GLES31.functional.debug.negative_coverage.get_error.atomic_counter.atomic_precision
   dEQP-GLES31.functional.debug.negative_coverage.log.atomic_counter.atomic_precision

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98131
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoglsl: optimize copy_propagation_elements pass
Tapani Pälli [Fri, 30 Sep 2016 15:12:12 +0000 (08:12 -0700)]
glsl: optimize copy_propagation_elements pass

Changes make copy_propagation_elements pass faster, reducing link
time spent in test case of bug 94477. Does not fix the actual issue
but brings down the total time. No regressions seen in CI.

v2 (idr): Formatting / whitespace fixes.  Embed the acp_ref in the
acp_entry.

v3 (idr): Delete unused copy constructor.  Use while(pop_head) instead
of foreach() { remove }.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoradv: don't build without SHA1.
Dave Airlie [Mon, 10 Oct 2016 00:06:52 +0000 (10:06 +1000)]
radv: don't build without SHA1.

Just copy the section from anv above this.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98167
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agodocs/features.txt: Add GL_KHR_robustness supported on ES 3.2
Edward O'Callaghan [Fri, 7 Oct 2016 12:21:32 +0000 (23:21 +1100)]
docs/features.txt: Add GL_KHR_robustness supported on ES 3.2

Both radeonsi and nvc0 should also support ES so fixup doc.

Signed-off-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agointel: aubinator: enable loading dumps from standard input
Lionel Landwerlin [Tue, 4 Oct 2016 14:15:50 +0000 (15:15 +0100)]
intel: aubinator: enable loading dumps from standard input

In conjuction with an intel_aubdump change, you can now look at your
application's output like this :

$ intel_aubdump -c '/path/to/aubinator --gen=hsw' my_gl_app

v2: Add print_help() comment about standard input handling (Eero)
    Remove shrinked gtt space debug workaround (Eero)

v3: Use realloc rather than memcpy/free (Ben)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Sirisha Gandikota <Sirisha.Gandikota@intel.com>
8 years agointel: aubinator: enable loading xml files from a given directory
Lionel Landwerlin [Wed, 5 Oct 2016 22:52:51 +0000 (23:52 +0100)]
intel: aubinator: enable loading xml files from a given directory

This might be useful for people who debug with out of tree descriptions.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Sirisha Gandikota <Sirisha.Gandikota@intel.com>
8 years agointel: aubinator: generate a standalone binary
Lionel Landwerlin [Tue, 4 Oct 2016 15:19:43 +0000 (16:19 +0100)]
intel: aubinator: generate a standalone binary

Embed the xml files into the binary, so aubinator can be used from any
location.

v2: Split generation packing into another patch (Jason)
    Check for xxd (Jason)

v3: Fix out of tree builds (Jason)
    Generate custom variable name rather than names generated by xxd
    (Lionel)

v4: Move generated _xml.h files to genxml/ (Sirisha)

v5: Remove newline from makefile (Jason)

v6: Add comment on gen*_xml.h creation (Jason)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoanv/TODO: Update the HiZ task
Nanley Chery [Fri, 7 Oct 2016 19:07:33 +0000 (12:07 -0700)]
anv/TODO: Update the HiZ task

Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Chad Versace <chadversary@chromium.org>
8 years agoanv: Enable fast depth clears
Nanley Chery [Fri, 7 Oct 2016 19:07:31 +0000 (12:07 -0700)]
anv: Enable fast depth clears

Provides an FPS increase of ~30% on the Sascha triangle and multisampling
demos.

Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Chad Versace <chadversary@chromium.org>
8 years agoanv/cmd_buffer: Enable rendering to HiZ
Chad Versace [Thu, 6 Oct 2016 22:21:53 +0000 (15:21 -0700)]
anv/cmd_buffer: Enable rendering to HiZ

Nanley Chery:
(rebase)
 - Resolve conflicts with new anv_batch_emit macro
(amend)
 - Handle a QPitch TODO
 - Emit 3DSTATE_HIER_DEPTH_BUFFER on pre-BDW systems
 - Only use HiZ for single-subpass renderpasses
 - Emit the HiZ instruction before the stencil instruction to follow the
   optimized clear sequence specified in the PRMs
 - Don't modify clear params
 - Enable resolves when a HiZ buffer is used to ensure depth buffer validity

Provides an FPS increase of ~15% on the Sascha triangle and multisampling
demos.

Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoanv/cmd_buffer: Add code for performing HZ operations
Nanley Chery [Fri, 7 Oct 2016 19:07:27 +0000 (12:07 -0700)]
anv/cmd_buffer: Add code for performing HZ operations

Create a function that performs one of three HiZ operations -
depth/stencil clears, HiZ resolve, and depth resolves.

Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Chad Versace <chadversary@chromium.org>