Rebase against 692656467729c5548c45244aa05ca946620afa72.

This commit is contained in:
Sebastian Lackner 2017-04-12 07:03:43 +02:00
parent e5d2247213
commit b113596b6c
5 changed files with 198 additions and 319 deletions

View File

@ -1,4 +1,4 @@
From 0c19e06c3931da74e58127739817d2443d8021f8 Mon Sep 17 00:00:00 2001
From 07bb6e9c60e3525ccf70f979d60f045e4300dbc4 Mon Sep 17 00:00:00 2001
From: Christian Costa <titan.costa@gmail.com>
Date: Fri, 19 Dec 2014 22:31:46 +0100
Subject: d3dx9_36: Implement ID3DXEffect_FindNextValidTechnique + add tests.
@ -9,10 +9,10 @@ Subject: d3dx9_36: Implement ID3DXEffect_FindNextValidTechnique + add tests.
2 files changed, 91 insertions(+), 3 deletions(-)
diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c
index 76580417e9..fd9c4bd1aa 100644
index 813b57e1ea..3c5f7ba8b8 100644
--- a/dlls/d3dx9_36/effect.c
+++ b/dlls/d3dx9_36/effect.c
@@ -3631,13 +3631,41 @@ static HRESULT WINAPI ID3DXEffectImpl_ValidateTechnique(ID3DXEffect* iface, D3DX
@@ -3652,13 +3652,41 @@ static HRESULT WINAPI ID3DXEffectImpl_ValidateTechnique(ID3DXEffect* iface, D3DX
return D3D_OK;
}
@ -58,11 +58,11 @@ index 76580417e9..fd9c4bd1aa 100644
static BOOL walk_parameter_dep(struct d3dx_parameter *param, walk_parameter_dep_func param_func,
diff --git a/dlls/d3dx9_36/tests/effect.c b/dlls/d3dx9_36/tests/effect.c
index fd94e58476..d96a2df1eb 100644
index de5ae69ec9..aba65d11fd 100644
--- a/dlls/d3dx9_36/tests/effect.c
+++ b/dlls/d3dx9_36/tests/effect.c
@@ -5309,6 +5309,65 @@ static void test_effect_preshader_relative_addressing(IDirect3DDevice9 *device)
effect->lpVtbl->Release(effect);
@@ -5681,6 +5681,65 @@ static void test_effect_state_manager(IDirect3DDevice9 *device)
ok(!refcount, "State manager was not properly freed, refcount %u.\n", refcount);
}
+/*
@ -127,10 +127,10 @@ index fd94e58476..d96a2df1eb 100644
START_TEST(effect)
{
HWND wnd;
@@ -5355,6 +5414,7 @@ START_TEST(effect)
test_effect_out_of_bounds_selector(device);
@@ -5728,6 +5787,7 @@ START_TEST(effect)
test_effect_commitchanges(device);
test_effect_preshader_relative_addressing(device);
test_effect_state_manager(device);
+ test_effect_technique_validation(device);
count = IDirect3DDevice9_Release(device);

View File

@ -52,7 +52,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "61a1a266faa9fa7c959136b0ab0b5d7e01326878"
echo "692656467729c5548c45244aa05ca946620afa72"
}
# Show version information

View File

@ -1,29 +1,30 @@
From 05249b5d5e76a7b5badf6daf22865712a36e39bb Mon Sep 17 00:00:00 2001
From 297e02795ff39b1ee67bca1e54d93867ba151fd6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 25 Aug 2016 19:09:41 +0200
Subject: wined3d: Add support for 1d textures in
context_attach_gl_texture_fbo.
---
dlls/wined3d/context.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
dlls/wined3d/context.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 239dc38fa9..bc450e5249 100644
index 09681834d9..598622d3e7 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -127,7 +127,7 @@ static void context_attach_gl_texture_fbo(struct wined3d_context *context,
{
gl_info->fbo_ops.glFramebufferTexture2D(fbo_target, attachment, GL_TEXTURE_2D, 0, 0);
@@ -139,7 +139,8 @@ static void context_attach_gl_texture_fbo(struct wined3d_context *context,
gl_info->fbo_ops.glFramebufferTexture(fbo_target, attachment,
resource->object, resource->level);
}
- else if (resource->target == GL_TEXTURE_2D_ARRAY)
+ else if (resource->target == GL_TEXTURE_2D_ARRAY || resource->target == GL_TEXTURE_1D_ARRAY)
- else if (resource->target == GL_TEXTURE_2D_ARRAY || resource->target == GL_TEXTURE_3D)
+ else if (resource->target == GL_TEXTURE_1D_ARRAY || resource->target == GL_TEXTURE_2D_ARRAY ||
+ resource->target == GL_TEXTURE_3D)
{
if (!gl_info->fbo_ops.glFramebufferTextureLayer)
{
@@ -149,6 +149,12 @@ static void context_attach_gl_texture_fbo(struct wined3d_context *context,
gl_info->fbo_ops.glFramebufferTexture(fbo_target, attachment,
resource->object, resource->level);
@@ -150,6 +151,12 @@ static void context_attach_gl_texture_fbo(struct wined3d_context *context,
gl_info->fbo_ops.glFramebufferTextureLayer(fbo_target, attachment,
resource->object, resource->level, resource->layer);
}
+ else if (resource->target == GL_TEXTURE_1D)
+ {

View File

@ -1,14 +1,14 @@
From a8f6de27d548772a55d15580bdab50b3658628d7 Mon Sep 17 00:00:00 2001
From ff1d7052ee893bb9e3c338e88a71278aaf228f27 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Thu, 1 Aug 2013 00:33:48 +0200
Subject: wined3d: Send update_texture calls through the CS
FIXME: This logic duplication is ugly.
---
dlls/wined3d/cs.c | 37 ++++++++
dlls/wined3d/device.c | 190 +++++++++++++++++++++++------------------
dlls/wined3d/wined3d_private.h | 4 +
3 files changed, 147 insertions(+), 84 deletions(-)
dlls/wined3d/cs.c | 37 +++++++++++
dlls/wined3d/device.c | 145 +++++++++++++++++++++++------------------
dlls/wined3d/wined3d_private.h | 4 ++
3 files changed, 123 insertions(+), 63 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 1b9c199e91..b6c56ca164 100644
@ -80,68 +80,13 @@ index 1b9c199e91..b6c56ca164 100644
static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 62ea164dfd..5bd7f1075d 100644
index cde275573d..f30aa6bf6f 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3656,28 +3656,17 @@ void CDECL wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device
@@ -3656,59 +3656,20 @@ void CDECL wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device
start_idx, index_count, start_instance, instance_count, TRUE);
}
-static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device,
+/* Context activation is done by the caller. */
+static void wined3d_device_update_texture_3d(struct wined3d_context *context,
struct wined3d_texture *src_texture, unsigned int src_level,
struct wined3d_texture *dst_texture, unsigned int level_count)
{
struct wined3d_const_bo_address data;
- struct wined3d_context *context;
struct wined3d_map_desc src;
- HRESULT hr = WINED3D_OK;
unsigned int i;
- TRACE("device %p, src_texture %p, src_level %u, dst_texture %p, level_count %u.\n",
- device, src_texture, src_level, dst_texture, level_count);
-
- if (wined3d_texture_get_level_width(src_texture, src_level) != dst_texture->resource.width
- || wined3d_texture_get_level_height(src_texture, src_level) != dst_texture->resource.height
- || wined3d_texture_get_level_depth(src_texture, src_level) != dst_texture->resource.depth)
- {
- WARN("Source and destination dimensions do not match.\n");
- return WINED3DERR_INVALIDCALL;
- }
-
- context = context_acquire(device, NULL, 0);
+ TRACE("context %p, src_texture %p, src_level %u, dst_texture %p, level_count %u.\n",
+ context, src_texture, src_level, dst_texture, level_count);
/* Only a prepare, since we're uploading entire volumes. */
wined3d_texture_prepare_texture(dst_texture, context, FALSE);
@@ -3685,81 +3674,34 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device,
for (i = 0; i < level_count; ++i)
{
- if (FAILED(hr = wined3d_resource_map(&src_texture->resource,
+ if (FAILED(wined3d_resource_map(&src_texture->resource,
src_level + i, &src, NULL, WINED3D_MAP_READONLY)))
- goto done;
+ return;
data.buffer_object = 0;
data.addr = src.data;
wined3d_texture_upload_data(dst_texture, i, context, NULL, &data, src.row_pitch, src.slice_pitch);
wined3d_texture_invalidate_location(dst_texture, i, ~WINED3D_LOCATION_TEXTURE_RGB);
- if (FAILED(hr = wined3d_resource_unmap(&src_texture->resource, src_level + i)))
- goto done;
+ if (FAILED(wined3d_resource_unmap(&src_texture->resource, src_level + i)))
+ return;
}
-
-done:
- context_release(context);
- return hr;
}
-HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device,
- struct wined3d_texture *src_texture, struct wined3d_texture *dst_texture)
+/* Context activation is done by the caller */
@ -149,11 +94,12 @@ index 62ea164dfd..5bd7f1075d 100644
+ struct wined3d_texture *dst_texture)
{
unsigned int src_size, dst_size, src_skip_levels = 0;
- unsigned int layer_count, level_count, i, j;
- enum wined3d_resource_type type;
- HRESULT hr;
unsigned int layer_count, level_count, i, j;
unsigned int row_pitch, slice_pitch;
enum wined3d_resource_type type;
- struct wined3d_context *context;
+ unsigned int level_count, i, j;
struct wined3d_bo_address data;
HRESULT hr;
RECT r;
- TRACE("device %p, src_texture %p, dst_texture %p.\n", device, src_texture, dst_texture);
@ -177,14 +123,14 @@ index 62ea164dfd..5bd7f1075d 100644
- }
-
- /* Verify that the source and destination textures are the same type. */
- type = src_texture->resource.type;
type = src_texture->resource.type;
- if (dst_texture->resource.type != type)
- {
- WARN("Source and destination have different types, returning WINED3DERR_INVALIDCALL.\n");
- return WINED3DERR_INVALIDCALL;
- }
-
- layer_count = src_texture->layer_count;
layer_count = src_texture->layer_count;
- if (layer_count != dst_texture->layer_count)
- {
- WARN("Source and destination have different layer counts.\n");
@ -200,43 +146,26 @@ index 62ea164dfd..5bd7f1075d 100644
level_count = min(wined3d_texture_get_level_count(src_texture),
wined3d_texture_get_level_count(dst_texture));
src_size = max(src_texture->resource.width, src_texture->resource.height);
dst_size = max(dst_texture->resource.width, dst_texture->resource.height);
- if (type == WINED3D_RTYPE_TEXTURE_3D)
+ if (dst_texture->resource.type == WINED3D_RTYPE_TEXTURE_3D)
{
src_size = max(src_size, src_texture->resource.depth);
dst_size = max(dst_size, dst_texture->resource.depth);
@@ -3771,12 +3713,10 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device,
@@ -3725,18 +3686,8 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device,
++src_skip_levels;
}
- if (wined3d_texture_get_level_width(src_texture, src_skip_levels) != dst_texture->resource.width
- || wined3d_texture_get_level_height(src_texture, src_skip_levels) != dst_texture->resource.height
- || wined3d_texture_get_level_depth(src_texture, src_skip_levels) != dst_texture->resource.depth)
- {
- WARN("Source and destination dimensions do not match.\n");
- return WINED3DERR_INVALIDCALL;
- }
-
/* Make sure that the destination texture is loaded. */
- context = context_acquire(device, NULL, 0);
wined3d_texture_load(dst_texture, context, FALSE);
- context_release(context);
/* Update every surface level of the texture. */
- switch (type)
+ switch (dst_texture->resource.type)
{
case WINED3D_RTYPE_TEXTURE_2D:
{
@@ -3785,12 +3725,13 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device,
struct wined3d_surface *src_surface;
struct wined3d_surface *dst_surface;
- for (i = 0; i < layer_count; ++i)
+ for (i = 0; i < src_texture->layer_count; ++i)
{
for (j = 0; j < level_count; ++j)
{
unsigned int src_sub_resource_idx = i * src_levels + j + src_skip_levels;
unsigned int dst_sub_resource_idx = i * dst_levels + j;
+ HRESULT hr;
/* Use wined3d_texture_blt() instead of uploading directly if we need conversion. */
if (dst_texture->resource.format->convert
@@ -3802,7 +3743,7 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device,
switch (type)
@@ -3765,7 +3716,7 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device,
src_texture, src_sub_resource_idx, &r, 0, NULL, WINED3D_TEXF_POINT)))
{
WARN("Failed to update surface, hr %#x.\n", hr);
@ -245,7 +174,7 @@ index 62ea164dfd..5bd7f1075d 100644
}
continue;
}
@@ -3812,25 +3753,106 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device,
@@ -3775,16 +3726,14 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device,
if (FAILED(hr = surface_upload_from_surface(dst_surface, NULL, src_surface, NULL)))
{
WARN("Failed to update surface, hr %#x.\n", hr);
@ -259,18 +188,33 @@ index 62ea164dfd..5bd7f1075d 100644
}
case WINED3D_RTYPE_TEXTURE_3D:
- if (FAILED(hr = wined3d_device_update_texture_3d(device,
- src_texture, src_skip_levels, dst_texture, level_count)))
- WARN("Failed to update 3D texture, hr %#x.\n", hr);
- return hr;
+ wined3d_device_update_texture_3d(context,
+ src_texture, src_skip_levels, dst_texture, level_count);
- context = context_acquire(device, NULL, 0);
-
/* Only a prepare, since we're uploading entire volumes. */
wined3d_texture_prepare_texture(dst_texture, context, FALSE);
wined3d_texture_bind_and_dirtify(dst_texture, context, FALSE);
@@ -3796,8 +3745,7 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device,
{
WARN("Failed to load source sub-resource %u into %s.\n", src_skip_levels + j,
wined3d_debug_location(src_texture->resource.map_binding));
- context_release(context);
- return WINED3DERR_INVALIDCALL;
+ return;
}
wined3d_texture_get_memory(src_texture, src_skip_levels + j, &data, src_texture->resource.map_binding);
@@ -3807,16 +3755,87 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device,
wined3d_const_bo_address(&data), row_pitch, slice_pitch);
wined3d_texture_invalidate_location(dst_texture, j, ~WINED3D_LOCATION_TEXTURE_RGB);
}
-
- context_release(context);
- return WINED3D_OK;
+ break;
default:
- FIXME("Unsupported texture type %#x.\n", type);
FIXME("Unsupported texture type %#x.\n", type);
- return WINED3DERR_INVALIDCALL;
+ FIXME("Unsupported texture type %#x.\n", dst_texture->resource.type);
}
}
@ -322,34 +266,25 @@ index 62ea164dfd..5bd7f1075d 100644
+ return WINED3DERR_INVALIDCALL;
+ }
+
+ switch (type)
+ src_size = max(src_texture->resource.width, src_texture->resource.height);
+ dst_size = max(dst_texture->resource.width, dst_texture->resource.height);
+ if (type == WINED3D_RTYPE_TEXTURE_3D)
+ {
+ case WINED3D_RTYPE_TEXTURE_2D:
+ break;
+ src_size = max(src_size, src_texture->resource.depth);
+ dst_size = max(dst_size, dst_texture->resource.depth);
+ }
+ while (src_size > dst_size)
+ {
+ src_size >>= 1;
+ ++src_skip_levels;
+ }
+
+ case WINED3D_RTYPE_TEXTURE_3D:
+ src_size = max(src_texture->resource.width, src_texture->resource.height);
+ src_size = max(src_size, src_texture->resource.depth);
+ dst_size = max(dst_texture->resource.width, dst_texture->resource.height);
+ dst_size = max(dst_size, dst_texture->resource.depth);
+
+ while (src_size > dst_size)
+ {
+ src_size >>= 1;
+ ++src_skip_levels;
+ }
+
+ if (wined3d_texture_get_level_width(src_texture, src_skip_levels) != dst_texture->resource.width
+ || wined3d_texture_get_level_height(src_texture, src_skip_levels) != dst_texture->resource.height
+ || wined3d_texture_get_level_depth(src_texture, src_skip_levels) != dst_texture->resource.depth)
+ {
+ WARN("Source and destination dimensions do not match.\n");
+ return WINED3DERR_INVALIDCALL;
+ }
+ break;
+
+ default:
+ break;
+ if (wined3d_texture_get_level_width(src_texture, src_skip_levels) != dst_texture->resource.width
+ || wined3d_texture_get_level_height(src_texture, src_skip_levels) != dst_texture->resource.height
+ || wined3d_texture_get_level_depth(src_texture, src_skip_levels) != dst_texture->resource.depth)
+ {
+ WARN("Source and destination dimensions do not match.\n");
+ return WINED3DERR_INVALIDCALL;
+ }
+
+ wined3d_cs_emit_update_texture(device->cs, src_texture, dst_texture);
@ -361,10 +296,10 @@ index 62ea164dfd..5bd7f1075d 100644
{
const struct wined3d_state *state = &device->state;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 04f2fdf1b8..e021012dac 100644
index 437a1c1437..eab448fa29 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2725,6 +2725,8 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL
@@ -2733,6 +2733,8 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL
void device_resource_add(struct wined3d_device *device, struct wined3d_resource *resource) DECLSPEC_HIDDEN;
void device_resource_released(struct wined3d_device *device, struct wined3d_resource *resource) DECLSPEC_HIDDEN;
void device_invalidate_state(const struct wined3d_device *device, DWORD state) DECLSPEC_HIDDEN;
@ -373,7 +308,7 @@ index 04f2fdf1b8..e021012dac 100644
static inline BOOL isStateDirty(const struct wined3d_context *context, DWORD state)
{
@@ -3313,6 +3315,8 @@ void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resou
@@ -3321,6 +3323,8 @@ void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resou
void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_resource *resource,
unsigned int sub_resource_idx, const struct wined3d_box *box, const void *data, unsigned int row_pitch,
unsigned int slice_pitch) DECLSPEC_HIDDEN;

View File

@ -39,7 +39,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -3841,6 +3841,11 @@ struct wined3d_context *context_acquire(const struct wined3d_device *device,
@@ -3860,6 +3860,11 @@ struct wined3d_context *context_acquire(const struct wined3d_device *device,
TRACE("device %p, texture %p, sub_resource_idx %u.\n", device, texture, sub_resource_idx);
@ -2574,134 +2574,65 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
device->inScene = FALSE;
return WINED3D_OK;
}
@@ -3663,11 +3708,17 @@ void CDECL wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device
@@ -3663,18 +3708,27 @@ void CDECL wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device
start_idx, index_count, start_instance, instance_count, TRUE);
}
+#if !defined(STAGING_CSMT)
static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device,
HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device,
struct wined3d_texture *src_texture, struct wined3d_texture *dst_texture)
+#else /* STAGING_CSMT */
+/* Context activation is done by the caller. */
+static void wined3d_device_update_texture_3d(struct wined3d_context *context,
+#endif /* STAGING_CSMT */
struct wined3d_texture *src_texture, unsigned int src_level,
struct wined3d_texture *dst_texture, unsigned int level_count)
{
struct wined3d_const_bo_address data;
+#if !defined(STAGING_CSMT)
struct wined3d_context *context;
struct wined3d_map_desc src;
HRESULT hr = WINED3D_OK;
@@ -3685,6 +3736,13 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device,
}
context = context_acquire(device, NULL, 0);
+#else /* STAGING_CSMT */
+ struct wined3d_map_desc src;
+ unsigned int i;
+
+ TRACE("context %p, src_texture %p, src_level %u, dst_texture %p, level_count %u.\n",
+ context, src_texture, src_level, dst_texture, level_count);
+#endif /* STAGING_CSMT */
/* Only a prepare, since we're uploading entire volumes. */
wined3d_texture_prepare_texture(dst_texture, context, FALSE);
@@ -3692,15 +3750,22 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device,
for (i = 0; i < level_count; ++i)
{
+#if !defined(STAGING_CSMT)
if (FAILED(hr = wined3d_resource_map(&src_texture->resource,
src_level + i, &src, NULL, WINED3D_MAP_READONLY)))
goto done;
+#else /* STAGING_CSMT */
+ if (FAILED(wined3d_resource_map(&src_texture->resource,
+ src_level + i, &src, NULL, WINED3D_MAP_READONLY)))
+ return;
+#endif /* STAGING_CSMT */
data.buffer_object = 0;
data.addr = src.data;
wined3d_texture_upload_data(dst_texture, i, context, NULL, &data, src.row_pitch, src.slice_pitch);
wined3d_texture_invalidate_location(dst_texture, i, ~WINED3D_LOCATION_TEXTURE_RGB);
+#if !defined(STAGING_CSMT)
if (FAILED(hr = wined3d_resource_unmap(&src_texture->resource, src_level + i)))
goto done;
}
@@ -3760,13 +3825,31 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device,
WARN("Source and destination formats do not match.\n");
return WINED3DERR_INVALIDCALL;
}
+#else /* STAGING_CSMT */
+ if (FAILED(wined3d_resource_unmap(&src_texture->resource, src_level + i)))
+ return;
+ }
+}
+
+/* Context activation is done by the caller */
+void device_exec_update_texture(struct wined3d_context *context, struct wined3d_texture *src_texture,
+ struct wined3d_texture *dst_texture)
+{
+ unsigned int src_size, dst_size, src_skip_levels = 0;
+ unsigned int level_count, i, j;
+ RECT r;
+#endif /* STAGING_CSMT */
{
unsigned int src_size, dst_size, src_skip_levels = 0;
unsigned int layer_count, level_count, i, j;
unsigned int row_pitch, slice_pitch;
enum wined3d_resource_type type;
+#if !defined(STAGING_CSMT)
struct wined3d_context *context;
+#endif /* STAGING_CSMT */
struct wined3d_bo_address data;
HRESULT hr;
RECT r;
+#if !defined(STAGING_CSMT)
TRACE("device %p, src_texture %p, dst_texture %p.\n", device, src_texture, dst_texture);
/* Verify that the source and destination textures are non-NULL. */
@@ -3716,6 +3770,10 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device,
return WINED3DERR_INVALIDCALL;
}
+#else /* STAGING_CSMT */
+ type = src_texture->resource.type;
+ layer_count = src_texture->layer_count;
+#endif /* STAGING_CSMT */
level_count = min(wined3d_texture_get_level_count(src_texture),
wined3d_texture_get_level_count(dst_texture));
src_size = max(src_texture->resource.width, src_texture->resource.height);
dst_size = max(dst_texture->resource.width, dst_texture->resource.height);
+#if !defined(STAGING_CSMT)
if (type == WINED3D_RTYPE_TEXTURE_3D)
+#else /* STAGING_CSMT */
+ if (dst_texture->resource.type == WINED3D_RTYPE_TEXTURE_3D)
+#endif /* STAGING_CSMT */
{
src_size = max(src_size, src_texture->resource.depth);
dst_size = max(dst_size, dst_texture->resource.depth);
@@ -3778,12 +3861,19 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device,
@@ -3732,6 +3790,7 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device,
++src_skip_levels;
}
/* Make sure that the destination texture is loaded. */
+#if !defined(STAGING_CSMT)
if (wined3d_texture_get_level_width(src_texture, src_skip_levels) != dst_texture->resource.width
|| wined3d_texture_get_level_height(src_texture, src_skip_levels) != dst_texture->resource.height
|| wined3d_texture_get_level_depth(src_texture, src_skip_levels) != dst_texture->resource.depth)
@@ -3744,6 +3803,10 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device,
context = context_acquire(device, NULL, 0);
wined3d_texture_load(dst_texture, context, FALSE);
context_release(context);
+#else /* STAGING_CSMT */
+ /* Make sure that the destination texture is loaded. */
+ wined3d_texture_load(dst_texture, context, FALSE);
+#endif /* STAGING_CSMT */
/* Update every surface level of the texture. */
switch (type)
+#else /* STAGING_CSMT */
+ wined3d_texture_load(dst_texture, context, FALSE);
+
+ /* Update every surface level of the texture. */
+ switch (dst_texture->resource.type)
+#endif /* STAGING_CSMT */
{
case WINED3D_RTYPE_TEXTURE_2D:
{
@@ -3792,12 +3882,19 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device,
struct wined3d_surface *src_surface;
struct wined3d_surface *dst_surface;
+#if !defined(STAGING_CSMT)
for (i = 0; i < layer_count; ++i)
+#else /* STAGING_CSMT */
+ for (i = 0; i < src_texture->layer_count; ++i)
+#endif /* STAGING_CSMT */
{
for (j = 0; j < level_count; ++j)
{
unsigned int src_sub_resource_idx = i * src_levels + j + src_skip_levels;
unsigned int dst_sub_resource_idx = i * dst_levels + j;
+#if defined(STAGING_CSMT)
+ HRESULT hr;
+#endif /* STAGING_CSMT */
/* Use wined3d_texture_blt() instead of uploading directly if we need conversion. */
if (dst_texture->resource.format->convert
@@ -3809,7 +3906,11 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device,
@@ -3772,7 +3835,11 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device,
src_texture, src_sub_resource_idx, &r, 0, NULL, WINED3D_TEXF_POINT)))
{
WARN("Failed to update surface, hr %#x.\n", hr);
@ -2713,7 +2644,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
}
continue;
}
@@ -3819,14 +3920,23 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device,
@@ -3782,16 +3849,26 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device,
if (FAILED(hr = surface_upload_from_surface(dst_surface, NULL, src_surface, NULL)))
{
WARN("Failed to update surface, hr %#x.\n", hr);
@ -2734,20 +2665,41 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
case WINED3D_RTYPE_TEXTURE_3D:
+#if !defined(STAGING_CSMT)
if (FAILED(hr = wined3d_device_update_texture_3d(device,
src_texture, src_skip_levels, dst_texture, level_count)))
WARN("Failed to update 3D texture, hr %#x.\n", hr);
@@ -3835,9 +3945,102 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device,
context = context_acquire(device, NULL, 0);
+#endif /* STAGING_CSMT */
/* Only a prepare, since we're uploading entire volumes. */
wined3d_texture_prepare_texture(dst_texture, context, FALSE);
wined3d_texture_bind_and_dirtify(dst_texture, context, FALSE);
@@ -3803,8 +3880,12 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device,
{
WARN("Failed to load source sub-resource %u into %s.\n", src_skip_levels + j,
wined3d_debug_location(src_texture->resource.map_binding));
+#if !defined(STAGING_CSMT)
context_release(context);
return WINED3DERR_INVALIDCALL;
+#else /* STAGING_CSMT */
+ return;
+#endif /* STAGING_CSMT */
}
wined3d_texture_get_memory(src_texture, src_skip_levels + j, &data, src_texture->resource.map_binding);
@@ -3814,16 +3895,98 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device,
wined3d_const_bo_address(&data), row_pitch, slice_pitch);
wined3d_texture_invalidate_location(dst_texture, j, ~WINED3D_LOCATION_TEXTURE_RGB);
}
+#if !defined(STAGING_CSMT)
context_release(context);
return WINED3D_OK;
+#else /* STAGING_CSMT */
+ break;
+#endif /* STAGING_CSMT */
default:
FIXME("Unsupported texture type %#x.\n", type);
+#if !defined(STAGING_CSMT)
return WINED3DERR_INVALIDCALL;
+#else /* STAGING_CSMT */
+ wined3d_device_update_texture_3d(context,
+ src_texture, src_skip_levels, dst_texture, level_count);
+ break;
+
+ default:
+ FIXME("Unsupported texture type %#x.\n", dst_texture->resource.type);
+#endif /* STAGING_CSMT */
}
}
@ -2801,34 +2753,25 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
+ return WINED3DERR_INVALIDCALL;
+ }
+
+ switch (type)
+ src_size = max(src_texture->resource.width, src_texture->resource.height);
+ dst_size = max(dst_texture->resource.width, dst_texture->resource.height);
+ if (type == WINED3D_RTYPE_TEXTURE_3D)
+ {
+ case WINED3D_RTYPE_TEXTURE_2D:
+ break;
+ src_size = max(src_size, src_texture->resource.depth);
+ dst_size = max(dst_size, dst_texture->resource.depth);
+ }
+ while (src_size > dst_size)
+ {
+ src_size >>= 1;
+ ++src_skip_levels;
+ }
+
+ case WINED3D_RTYPE_TEXTURE_3D:
+ src_size = max(src_texture->resource.width, src_texture->resource.height);
+ src_size = max(src_size, src_texture->resource.depth);
+ dst_size = max(dst_texture->resource.width, dst_texture->resource.height);
+ dst_size = max(dst_size, dst_texture->resource.depth);
+
+ while (src_size > dst_size)
+ {
+ src_size >>= 1;
+ ++src_skip_levels;
+ }
+
+ if (wined3d_texture_get_level_width(src_texture, src_skip_levels) != dst_texture->resource.width
+ || wined3d_texture_get_level_height(src_texture, src_skip_levels) != dst_texture->resource.height
+ || wined3d_texture_get_level_depth(src_texture, src_skip_levels) != dst_texture->resource.depth)
+ {
+ WARN("Source and destination dimensions do not match.\n");
+ return WINED3DERR_INVALIDCALL;
+ }
+ break;
+
+ default:
+ break;
+ if (wined3d_texture_get_level_width(src_texture, src_skip_levels) != dst_texture->resource.width
+ || wined3d_texture_get_level_height(src_texture, src_skip_levels) != dst_texture->resource.height
+ || wined3d_texture_get_level_depth(src_texture, src_skip_levels) != dst_texture->resource.depth)
+ {
+ WARN("Source and destination dimensions do not match.\n");
+ return WINED3DERR_INVALIDCALL;
+ }
+
+ wined3d_cs_emit_update_texture(device->cs, src_texture, dst_texture);
@ -2840,7 +2783,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device, DWORD *num_passes)
{
const struct wined3d_state *state = &device->state;
@@ -4149,6 +4352,7 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev
@@ -4129,6 +4292,7 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev
return WINED3DERR_INVALIDCALL;
}
@ -2848,7 +2791,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
if (dst_texture->sub_resources[dst_sub_resource_idx].map_count)
{
WARN("Destination sub-resource %u is mapped.\n", dst_sub_resource_idx);
@@ -4159,6 +4363,18 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev
@@ -4139,6 +4303,18 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev
{
WARN("Source sub-resource %u is mapped.\n", src_sub_resource_idx);
return WINED3DERR_INVALIDCALL;
@ -2867,7 +2810,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
}
if (!src_box)
@@ -4871,7 +5087,11 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
@@ -4851,7 +5027,11 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
{
if (reset_state)
hr = wined3d_device_create_primary_opengl_context(device);
@ -2879,7 +2822,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
}
/* All done. There is no need to reload resources or shaders, this will happen automatically on the
@@ -5184,3 +5404,58 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL
@@ -5164,3 +5344,58 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL
else
return CallWindowProcA(proc, window, message, wparam, lparam);
}
@ -3458,7 +3401,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c
--- a/dlls/wined3d/view.c
+++ b/dlls/wined3d/view.c
@@ -594,6 +594,10 @@ static void wined3d_shader_resource_view_cs_init(void *object)
@@ -632,6 +632,10 @@ static void wined3d_shader_resource_view_cs_init(void *object)
debug_d3dformat(resource->format->id), debug_d3dformat(view_format->id));
}
}
@ -3469,7 +3412,7 @@ diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c
}
static HRESULT wined3d_shader_resource_view_init(struct wined3d_shader_resource_view *view,
@@ -610,6 +614,9 @@ static HRESULT wined3d_shader_resource_view_init(struct wined3d_shader_resource_
@@ -648,6 +652,9 @@ static HRESULT wined3d_shader_resource_view_init(struct wined3d_shader_resource_
wined3d_resource_incref(view->resource = resource);
@ -3479,7 +3422,7 @@ diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c
wined3d_cs_init_object(resource->device->cs, wined3d_shader_resource_view_cs_init, view);
return WINED3D_OK;
@@ -791,6 +798,10 @@ static void wined3d_unordered_access_view_cs_init(void *object)
@@ -829,6 +836,10 @@ static void wined3d_unordered_access_view_cs_init(void *object)
desc, texture, view->format);
}
}
@ -3490,7 +3433,7 @@ diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c
}
static HRESULT wined3d_unordered_access_view_init(struct wined3d_unordered_access_view *view,
@@ -810,6 +821,9 @@ static HRESULT wined3d_unordered_access_view_init(struct wined3d_unordered_acces
@@ -848,6 +859,9 @@ static HRESULT wined3d_unordered_access_view_init(struct wined3d_unordered_acces
wined3d_resource_incref(view->resource = resource);
@ -3568,7 +3511,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
};
struct wined3d_timestamp_query
@@ -2614,6 +2624,16 @@ struct wined3d_state
@@ -2622,6 +2632,16 @@ struct wined3d_state
struct wined3d_rasterizer_state *rasterizer_state;
};
@ -3585,7 +3528,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
#define WINED3D_UNMAPPED_STAGE ~0u
/* Multithreaded flag. Removed from the public header to signal that
@@ -2725,6 +2745,14 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL
@@ -2733,6 +2753,14 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL
void device_resource_add(struct wined3d_device *device, struct wined3d_resource *resource) DECLSPEC_HIDDEN;
void device_resource_released(struct wined3d_device *device, struct wined3d_resource *resource) DECLSPEC_HIDDEN;
void device_invalidate_state(const struct wined3d_device *device, DWORD state) DECLSPEC_HIDDEN;
@ -3600,7 +3543,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
static inline BOOL isStateDirty(const struct wined3d_context *context, DWORD state)
{
@@ -2801,11 +2829,13 @@ static inline void wined3d_resource_release(struct wined3d_resource *resource)
@@ -2809,11 +2837,13 @@ static inline void wined3d_resource_release(struct wined3d_resource *resource)
InterlockedDecrement(&resource->access_count);
}
@ -3614,7 +3557,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
void resource_cleanup(struct wined3d_resource *resource) DECLSPEC_HIDDEN;
HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *device,
enum wined3d_resource_type type, const struct wined3d_format *format,
@@ -2916,7 +2946,11 @@ struct wined3d_texture
@@ -2924,7 +2954,11 @@ struct wined3d_texture
unsigned int map_count;
DWORD locations;
@ -3626,7 +3569,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
} sub_resources[1];
};
@@ -3217,6 +3251,7 @@ enum wined3d_push_constants
@@ -3225,6 +3259,7 @@ enum wined3d_push_constants
WINED3D_PUSH_CONSTANTS_PS_B,
};
@ -3634,7 +3577,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
struct wined3d_cs_ops
{
void *(*require_space)(struct wined3d_cs *cs, size_t size);
@@ -3224,6 +3259,33 @@ struct wined3d_cs_ops
@@ -3232,6 +3267,33 @@ struct wined3d_cs_ops
void (*push_constants)(struct wined3d_cs *cs, enum wined3d_push_constants p,
unsigned int start_idx, unsigned int count, const void *constants);
};
@ -3668,7 +3611,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
struct wined3d_cs
{
@@ -3234,8 +3296,31 @@ struct wined3d_cs
@@ -3242,8 +3304,31 @@ struct wined3d_cs
size_t data_size, start, end;
void *data;
@ -3700,7 +3643,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) DECLSPEC_HIDDEN;
void wined3d_cs_destroy(struct wined3d_cs *cs) DECLSPEC_HIDDEN;
void wined3d_cs_destroy_object(struct wined3d_cs *cs,
@@ -3253,10 +3338,20 @@ void wined3d_cs_emit_dispatch(struct wined3d_cs *cs,
@@ -3261,10 +3346,20 @@ void wined3d_cs_emit_dispatch(struct wined3d_cs *cs,
void wined3d_cs_emit_draw(struct wined3d_cs *cs, GLenum primitive_type, int base_vertex_idx,
unsigned int start_idx, unsigned int index_count, unsigned int start_instance,
unsigned int instance_count, BOOL indexed) DECLSPEC_HIDDEN;
@ -3721,7 +3664,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx,
const struct wined3d_vec4 *plane) DECLSPEC_HIDDEN;
@@ -3304,10 +3399,20 @@ void wined3d_cs_emit_set_unordered_access_view(struct wined3d_cs *cs, enum wined
@@ -3312,10 +3407,20 @@ void wined3d_cs_emit_set_unordered_access_view(struct wined3d_cs *cs, enum wined
void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs,
struct wined3d_vertex_declaration *declaration) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_viewport *viewport) DECLSPEC_HIDDEN;
@ -3742,7 +3685,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
void wined3d_cs_init_object(struct wined3d_cs *cs,
void (*callback)(void *object), void *object) DECLSPEC_HIDDEN;
HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource, unsigned int sub_resource_idx,
@@ -3315,12 +3420,14 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource,
@@ -3323,12 +3428,14 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource,
HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resource,
unsigned int sub_resource_idx) DECLSPEC_HIDDEN;