mesa.git
7 years agoanv: Fix anv_pipeline_validate_create_info assertions.
Kenneth Graunke [Thu, 29 Sep 2016 18:42:43 +0000 (11:42 -0700)]
anv: Fix anv_pipeline_validate_create_info assertions.

Many of these can be "NULL if the pipeline has rasterization disabled."
Also, we should assert that pMultisampleState exists.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agotrace: add invalidate_resource callback
Ilia Mirkin [Tue, 11 Oct 2016 03:17:20 +0000 (23:17 -0400)]
trace: add invalidate_resource callback

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradv/winsys: Fix radv_amdgpu_cs_grow min_size argument. (v2)
Gustaw Smolarczyk [Thu, 6 Oct 2016 17:50:47 +0000 (19:50 +0200)]
radv/winsys: Fix radv_amdgpu_cs_grow min_size argument. (v2)

It's supposed to be how much at least we want to grow the cs, not the
minimum size of the cs after growth.

v2: Unbreak use_ib_bos.
    Don't mask the ib_size when !use_ib_bos, since it's not needed.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: fix strict aliasing violation
Grigori Goronzy [Tue, 11 Oct 2016 22:47:20 +0000 (00:47 +0200)]
radv: fix strict aliasing violation

Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: fix uninitialized variables
Grigori Goronzy [Tue, 11 Oct 2016 22:47:19 +0000 (00:47 +0200)]
radv: fix uninitialized variables

This gets rid of "may be used uninitialized" compiler warnings.

Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: add missing unreachable
Grigori Goronzy [Tue, 11 Oct 2016 22:47:18 +0000 (00:47 +0200)]
radv: add missing unreachable

Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: remove the validation layer and some related bits.
Dave Airlie [Tue, 11 Oct 2016 22:37:14 +0000 (08:37 +1000)]
radv: remove the validation layer and some related bits.

As pointed out by Emil this isn't used in anv anymore,
and it was totally unused in radv anyways.

Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: drop entrypoint split out.
Dave Airlie [Tue, 11 Oct 2016 05:57:58 +0000 (15:57 +1000)]
radv: drop entrypoint split out.

radv really doesn't need different dispatch per gen yet,
there really isn't that many differences yet.

Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: drop the RADV_CALL macro.
Dave Airlie [Tue, 11 Oct 2016 05:54:52 +0000 (15:54 +1000)]
radv: drop the RADV_CALL macro.

This is leftover from anv, and we really never needed it.

Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: check driver name before calling amdgpu.
Dave Airlie [Tue, 11 Oct 2016 05:21:25 +0000 (15:21 +1000)]
radv: check driver name before calling amdgpu.

This checks the kernel driver name is amdgpu before calling
libdrm_amdgpu.

This avoids the following error:
amdgpu_device_initialize: DRM version is 1.6.0 but this driver is only compatible with 3.x.x

when run on a machine with i915 graphics as well as amdgpu.

Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: fix memory leak from physical device if wsi fails
Dave Airlie [Tue, 11 Oct 2016 22:52:56 +0000 (08:52 +1000)]
radv: fix memory leak from physical device if wsi fails

Inspired by patch from Edward O'Callaghan <funfunctor@folklore1984.net>
which didn't do it right.

Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv/winsys: Fix mem leak at failed do_winsys_init() call site
Edward O'Callaghan [Tue, 11 Oct 2016 11:43:07 +0000 (22:43 +1100)]
radv/winsys: Fix mem leak at failed do_winsys_init() call site

Probably unlikely however ensure we don't leak a heap allocation
on the fail path.

V.2:
 also fix missing 'amdgpu_device_deinitialize()' calls (Emil Velikov).

Signed-off-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv/winsys: Trivial style and readability fixups
Edward O'Callaghan [Tue, 11 Oct 2016 09:04:47 +0000 (20:04 +1100)]
radv/winsys: Trivial style and readability fixups

Drop/add a few newlines where appropriate and drop a couple of
unnessary braces.

Signed-off-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradeonsi: emit TA_CS_BC_BASE_ADDR on SI only if the kernel allows it
Marek Olšák [Mon, 10 Oct 2016 11:23:55 +0000 (13:23 +0200)]
radeonsi: emit TA_CS_BC_BASE_ADDR on SI only if the kernel allows it

Reviewed-by: Edmondo Tommasina <edmondo.tommasina@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoswr: [rasterizer archrast] update proto file
Tim Rowley [Mon, 10 Oct 2016 23:32:31 +0000 (18:32 -0500)]
swr: [rasterizer archrast] update proto file

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
7 years agoswr: [rasterizer archrast] add support for stats files
Tim Rowley [Mon, 10 Oct 2016 16:41:33 +0000 (11:41 -0500)]
swr: [rasterizer archrast] add support for stats files

Only stat and counter events are saved to the event files.

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
7 years agoswr: [rasterizer jitter] remove architecture override
Tim Rowley [Mon, 10 Oct 2016 16:07:03 +0000 (11:07 -0500)]
swr: [rasterizer jitter] remove architecture override

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
7 years agoswr: [rasterizer jitter] adjust jitmanager assert
Tim Rowley [Fri, 7 Oct 2016 17:24:52 +0000 (12:24 -0500)]
swr: [rasterizer jitter] adjust jitmanager assert

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
7 years agoswr: [rasterizer] eliminate unused label warnings on gcc
Tim Rowley [Fri, 7 Oct 2016 14:52:19 +0000 (09:52 -0500)]
swr: [rasterizer] eliminate unused label warnings on gcc

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
7 years agoswr: [rasterizer core] implement depth bounds test
Tim Rowley [Fri, 7 Oct 2016 02:06:59 +0000 (21:06 -0500)]
swr: [rasterizer core] implement depth bounds test

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
7 years agoswr: [rasterizer core] update/add formats
Tim Rowley [Thu, 6 Oct 2016 21:26:56 +0000 (16:26 -0500)]
swr: [rasterizer core] update/add formats

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
7 years agoswr: [rasterizer core] SwrStoreTiles api change
Tim Rowley [Thu, 6 Oct 2016 18:22:35 +0000 (13:22 -0500)]
swr: [rasterizer core] SwrStoreTiles api change

SwrStoreTiles now takes a mask of surfaces to store.  Reduces
overhead when storing multiple render targets.

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
7 years agoswr: [rasterizer scripts] add ENABLE_ASSERT_DIALOGS knob for windows
Tim Rowley [Wed, 5 Oct 2016 18:48:40 +0000 (13:48 -0500)]
swr: [rasterizer scripts] add ENABLE_ASSERT_DIALOGS knob for windows

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
7 years agoswr: [rasterizer archrast] add mako template
Tim Rowley [Wed, 5 Oct 2016 18:45:12 +0000 (13:45 -0500)]
swr: [rasterizer archrast] add mako template

Add template for generating code to save events to a file.

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
7 years agoswr: [rasterizer core] disable cull for rect_list
Tim Rowley [Tue, 4 Oct 2016 18:36:12 +0000 (13:36 -0500)]
swr: [rasterizer core] disable cull for rect_list

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
7 years agoswr: [rasterizer core] add support for "RAW" surface format
Tim Rowley [Tue, 4 Oct 2016 18:14:32 +0000 (13:14 -0500)]
swr: [rasterizer core] add support for "RAW" surface format

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
7 years agoswr: [rasterizer core] align Macrotile FIFO memory to SIMD size
Tim Rowley [Tue, 4 Oct 2016 17:59:30 +0000 (12:59 -0500)]
swr: [rasterizer core] align Macrotile FIFO memory to SIMD size

Align and use streaming store instructions for BE fifo queues.
Provides slightly faster enqueue and doesn't pollute the caches.
Add appropriate memory fences to ensure streaming writes are
globally visible.

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
7 years agoswr: [rasterizer common] remove threadviz code
Tim Rowley [Mon, 3 Oct 2016 21:39:10 +0000 (16:39 -0500)]
swr: [rasterizer common] remove threadviz code

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
7 years agoswr: [rasterizer memory] split load/store for compile speed
Tim Rowley [Fri, 7 Oct 2016 17:07:07 +0000 (12:07 -0500)]
swr: [rasterizer memory] split load/store for compile speed

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
7 years agoegl: add eglSwapBuffersWithDamageKHR
Eric Engestrom [Mon, 10 Oct 2016 16:33:17 +0000 (17:33 +0100)]
egl: add eglSwapBuffersWithDamageKHR

EGL_KHR_swap_buffers_with_damage is actually already supported, as it is
technically nothing but a rename of EGL_EXT_swap_buffers_with_damage.

To that effect, both extension are advertised depending on the same
condition, and the new entrypoint simply redirects to the previous one.

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agointel/genxml: fix building rules for aubinator required headers
Mauro Rossi [Mon, 10 Oct 2016 21:43:42 +0000 (23:43 +0200)]
intel/genxml: fix building rules for aubinator required headers

New generated headers were introduced by commit 63a366a
"intel: aubinator: generate a standalone binary"

Android does not need aubinator yet, so in order to avoid building error,
aubinator required new genxml headers are defined in a separate list.

If required, building rules for Android will be added later.
[Emil Velikov: don't use a _HEADERS variable name (causes warnings)]
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoradv: automake: move libamdgpu_addrlib.la to VULKAN_LIB_DEPS
Emil Velikov [Mon, 10 Oct 2016 16:07:33 +0000 (17:07 +0100)]
radv: automake: move libamdgpu_addrlib.la to VULKAN_LIB_DEPS

The static library is analogous to the intel ISL, which is required for
both hardware and (to be added) testing library.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoradv: automake: remove unused variables
Emil Velikov [Mon, 10 Oct 2016 16:02:23 +0000 (17:02 +0100)]
radv: automake: remove unused variables

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoradv: automake: include the python scripts/formats table in the tarball
Emil Velikov [Mon, 10 Oct 2016 16:01:47 +0000 (17:01 +0100)]
radv: automake: include the python scripts/formats table in the tarball

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agomesa: fix error handling in _mesa_TransformFeedbackVaryings
Tapani Pälli [Mon, 10 Oct 2016 06:49:36 +0000 (09:49 +0300)]
mesa: fix error handling in _mesa_TransformFeedbackVaryings

Patch changes function to use _mesa_lookup_shader_program_err both
in TransformFeedbackVaryings and GetTransformFeedbackVarying that
handles errors correctly for invalid values of shader program.

Fixes following dEQP test:
   dEQP-GLES31.functional.debug.negative_coverage.get_error.shader.transform_feedback_varyings

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98135
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
7 years agoi965: solve cubemap negative x/y/z faces buffer offset issue in dEQP.
Xu,Randy [Sat, 8 Oct 2016 08:15:59 +0000 (16:15 +0800)]
i965: solve cubemap negative x/y/z faces buffer offset issue in dEQP.

Add the miptree level/slice x/y_offset when count the surface offset
in brw_emit_surface_state. The surface offset has two parts, one is
from mt->offset, which should be 32 aligned in width/height for tiled
buffer; another is from mt->level[current_level].slice[current_slice].
x/y_offset.

This fix will solve 12 deqp failure
dEQP-EGL.functional.image.create.gles2_cubemap_negative_*_texture

Signed-off-by: Xu,Randy <randy.xu@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoi915g: fix incorrect gl_FragCoord value
Nicholas Bishop [Thu, 25 Aug 2016 23:31:53 +0000 (19:31 -0400)]
i915g: fix incorrect gl_FragCoord value

On Intel Pineview M hardware, the i915 gallium driver doesn't output
the correct gl_FragCoord. It seems to always have an X coord of 0.0
and a Y coord of the window's height in pixels, e.g. 600.0f or such.

I believe this is a regression caused in part by this commit:
afa035031ff9e0c07a2297d864e46c76f7bfff58

The old behavior used the output at index zero, while the new behavior
uses actual zeroes. In the case of gl_FragCoord the output at index
zero happened to be the correct one, so the behavior appeared correct
although the code already had a bug.

Fixed by checking for I915_SEMANTIC_POS when setting up texCoords. If
the generic_mapping is I915_SEMANTIC_POS, look for the
TGSI_SEMANTIC_POSITION instead of a TGSI_SEMANTIC_GENERIC output.

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

Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Tested-by: Stéphane Marchesin <marcheu@chromium.org>
7 years agoRevert "mesa_glinterop: remove inclusion of GLX header"
Vinson Lee [Mon, 3 Oct 2016 22:16:30 +0000 (15:16 -0700)]
Revert "mesa_glinterop: remove inclusion of GLX header"

This reverts commit 8472045b16b3e4621553fe451a20a9ba9f0d44b6.

Conflicts:

include/GL/mesa_glinterop.h

This patch fixes this build error with GCC 4.4.

  Compiling src/glx/dri_common_interop.c ...
In file included from src/glx/dri_common_interop.c:33:
include/GL/mesa_glinterop.h:62: error: redefinition of typedef ‘GLXContext’
include/GL/glx.h:165: note: previous declaration of ‘GLXContext’ was here

Fixes: 8472045b16b3 ("mesa_glinterop: remove inclusion of GLX header")
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96770
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
7 years agost/nine: More checks for GetRenderTargetData
Axel Davy [Sun, 2 Oct 2016 10:14:03 +0000 (12:14 +0200)]
st/nine: More checks for GetRenderTargetData

Fixes a wine test crash

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
7 years agost/nine: Add debug output for lost devices
Patrick Rudolph [Wed, 28 Sep 2016 18:11:34 +0000 (20:11 +0200)]
st/nine: Add debug output for lost devices

Add debug output to ease debugging.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
7 years agost/nine: Prevent crash in GetRenderTargetData
Patrick Rudolph [Wed, 28 Sep 2016 16:50:19 +0000 (18:50 +0200)]
st/nine: Prevent crash in GetRenderTargetData

Return error instead of crashing on source surfaces
with format D3DFMT_NULL.

Fix for issue #236.

Tested on Windows 7.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
7 years agost/nine: Set CLAMP_TO_EDGE on cubetextures
Patrick Rudolph [Sat, 24 Sep 2016 16:19:26 +0000 (18:19 +0200)]
st/nine: Set CLAMP_TO_EDGE on cubetextures

Wine tests show that cubetextures always use
PIPE_TEX_WRAP_CLAMP_TO_EDGE regardless of set
sampler states.

Fixes failing d3d9 wine test test_cube_wrap.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
7 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>
7 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>
7 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.

7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>