Rebase against 61a1a266faa9fa7c959136b0ab0b5d7e01326878.

This commit is contained in:
Sebastian Lackner 2017-04-11 05:15:20 +02:00
parent fbc61357d3
commit e5d2247213
5 changed files with 531 additions and 302 deletions

View File

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

View File

@ -1,17 +1,17 @@
From 2a7eaa9e87e874b19ee60afa4cdf9c6bf23a0dd6 Mon Sep 17 00:00:00 2001
From a8f6de27d548772a55d15580bdab50b3658628d7 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 | 175 +++++++++++++++++++++++------------------
dlls/wined3d/cs.c | 37 ++++++++
dlls/wined3d/device.c | 190 +++++++++++++++++++++++------------------
dlls/wined3d/wined3d_private.h | 4 +
3 files changed, 141 insertions(+), 75 deletions(-)
3 files changed, 147 insertions(+), 84 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 811a8af1ce..1c67ab0f1c 100644
index 1b9c199e91..b6c56ca164 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -68,6 +68,7 @@ enum wined3d_cs_op
@ -35,7 +35,7 @@ index 811a8af1ce..1c67ab0f1c 100644
static void wined3d_cs_exec_sync(struct wined3d_cs *cs, const void *data)
{
}
@@ -1999,6 +2006,35 @@ void wined3d_cs_emit_push_constants(struct wined3d_cs *cs, enum wined3d_push_con
@@ -2078,6 +2085,35 @@ void wined3d_cs_emit_push_constants(struct wined3d_cs *cs, enum wined3d_push_con
cs->ops->submit(cs);
}
@ -71,7 +71,7 @@ index 811a8af1ce..1c67ab0f1c 100644
static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_SYNC */ wined3d_cs_exec_sync,
@@ -2043,6 +2079,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
@@ -2122,6 +2158,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_BLT_SUB_RESOURCE */ wined3d_cs_exec_blt_sub_resource,
/* WINED3D_CS_OP_UPDATE_SUB_RESOURCE */ wined3d_cs_exec_update_sub_resource,
/* WINED3D_CS_OP_PUSH_CONSTANTS */ wined3d_cs_exec_push_constants,
@ -80,10 +80,10 @@ index 811a8af1ce..1c67ab0f1c 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 bac505d3a8..acc1916747 100644
index 62ea164dfd..5bd7f1075d 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3656,34 +3656,17 @@ void CDECL wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device
@@ -3656,28 +3656,17 @@ void CDECL wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device
start_idx, index_count, start_instance, instance_count, TRUE);
}
@ -102,12 +102,6 @@ index bac505d3a8..acc1916747 100644
- 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 (src_texture->resource.format != dst_texture->resource.format)
- {
- WARN("Source and destination formats do not match.\n");
- return WINED3DERR_INVALIDCALL;
- }
-
- 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)
@ -122,7 +116,7 @@ index bac505d3a8..acc1916747 100644
/* Only a prepare, since we're uploading entire volumes. */
wined3d_texture_prepare_texture(dst_texture, context, FALSE);
@@ -3691,32 +3674,89 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device,
@@ -3685,81 +3674,34 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device,
for (i = 0; i < level_count; ++i)
{
@ -142,129 +136,197 @@ index bac505d3a8..acc1916747 100644
+ 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 */
+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;
+
+ 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 (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);
+ }
+ while (src_size > dst_size)
+ {
+ src_size >>= 1;
+ ++src_skip_levels;
+ }
+
+ /* Make sure that the destination texture is loaded. */
+ wined3d_texture_load(dst_texture, context, FALSE);
+
+ /* Update every surface level of the texture. */
+ switch (dst_texture->resource.type)
+ {
+ case WINED3D_RTYPE_TEXTURE_2D:
+ {
+ unsigned int src_levels = src_texture->level_count;
+ unsigned int dst_levels = dst_texture->level_count;
+ struct wined3d_surface *src_surface;
+ struct wined3d_surface *dst_surface;
+
+ for (i = 0; i < src_texture->layer_count; ++i)
+ {
+ for (j = 0; j < level_count; ++j)
+ {
+ HRESULT hr;
+ src_surface = src_texture->sub_resources[i * src_levels + j + src_skip_levels].u.surface;
+ dst_surface = dst_texture->sub_resources[i * dst_levels + j].u.surface;
+ if (FAILED(hr = surface_upload_from_surface(dst_surface, NULL, src_surface, NULL)))
+ {
+ WARN("Failed to update surface, hr %#x.\n", hr);
+ return;
+ }
+ }
+ }
+ break;
+ }
+
+ case WINED3D_RTYPE_TEXTURE_3D:
+ 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);
+ }
}
HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device,
struct wined3d_texture *src_texture, struct wined3d_texture *dst_texture)
{
unsigned int src_size, dst_size, src_skip_levels = 0;
- unsigned int layer_count, level_count, i, j;
+ unsigned int layer_count;
enum wined3d_resource_type type;
- enum wined3d_resource_type type;
- HRESULT hr;
- struct wined3d_context *context;
+ unsigned int level_count, i, j;
RECT r;
TRACE("device %p, src_texture %p, dst_texture %p.\n", device, src_texture, dst_texture);
@@ -3753,63 +3793,48 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device,
return WINED3DERR_INVALIDCALL;
}
- level_count = min(wined3d_texture_get_level_count(src_texture),
- wined3d_texture_get_level_count(dst_texture));
- TRACE("device %p, src_texture %p, dst_texture %p.\n", device, src_texture, 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)
- /* Verify that the source and destination textures are non-NULL. */
- if (!src_texture || !dst_texture)
- {
- src_size = max(src_size, src_texture->resource.depth);
- dst_size = max(dst_size, dst_texture->resource.depth);
- WARN("Source and destination textures must be non-NULL, returning WINED3DERR_INVALIDCALL.\n");
- return WINED3DERR_INVALIDCALL;
- }
- while (src_size > dst_size)
+ /* FIXME: This isn't necessary for 2D textures, but currently surface_upload_from_surface
+ * rejects mismatching formats, and we can't report the error back after dispatching the
+ * call. */
+ if (src_texture->resource.format != dst_texture->resource.format)
-
- if (src_texture->resource.pool != WINED3D_POOL_SYSTEM_MEM)
- {
- WARN("Source texture not in WINED3D_POOL_SYSTEM_MEM, returning WINED3DERR_INVALIDCALL.\n");
- return WINED3DERR_INVALIDCALL;
- }
- if (dst_texture->resource.pool != WINED3D_POOL_DEFAULT)
- {
- WARN("Destination texture not in WINED3D_POOL_DEFAULT, returning WINED3DERR_INVALIDCALL.\n");
- return WINED3DERR_INVALIDCALL;
- }
-
- /* Verify that the source and destination textures are the same 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;
- if (layer_count != dst_texture->layer_count)
- {
- WARN("Source and destination have different layer counts.\n");
- return WINED3DERR_INVALIDCALL;
- }
-
- if (src_texture->resource.format != dst_texture->resource.format)
- {
- WARN("Source and destination formats do not match.\n");
- return WINED3DERR_INVALIDCALL;
- }
-
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 >>= 1;
- ++src_skip_levels;
+ WARN("Source and destination formats do not match.\n");
+ return WINED3DERR_INVALIDCALL;
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,
}
- /* Make sure that the destination texture is loaded. */
/* Make sure that the destination texture is loaded. */
- context = context_acquire(device, NULL, 0);
- wined3d_texture_load(dst_texture, context, FALSE);
wined3d_texture_load(dst_texture, context, FALSE);
- context_release(context);
-
- /* Update every surface level of the texture. */
switch (type)
/* Update every surface level of the texture. */
- switch (type)
+ switch (dst_texture->resource.type)
{
case WINED3D_RTYPE_TEXTURE_2D:
- {
- unsigned int src_levels = src_texture->level_count;
- unsigned int dst_levels = dst_texture->level_count;
- struct wined3d_surface *src_surface;
- struct wined3d_surface *dst_surface;
+ break;
{
@@ -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,
src_texture, src_sub_resource_idx, &r, 0, NULL, WINED3D_TEXF_POINT)))
{
WARN("Failed to update surface, hr %#x.\n", hr);
- return hr;
+ return;
}
continue;
}
@@ -3812,25 +3753,106 @@ 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);
- return hr;
+ return;
}
}
}
- return WINED3D_OK;
+ break;
}
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);
+ break;
default:
- FIXME("Unsupported texture type %#x.\n", type);
- return WINED3DERR_INVALIDCALL;
+ FIXME("Unsupported texture type %#x.\n", dst_texture->resource.type);
}
}
+HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device,
+ struct wined3d_texture *src_texture, struct wined3d_texture *dst_texture)
+{
+ unsigned int src_size, dst_size, src_skip_levels = 0;
+ unsigned int layer_count;
+ enum wined3d_resource_type type;
+
+ 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. */
+ if (!src_texture || !dst_texture)
+ {
+ WARN("Source and destination textures must be non-NULL, returning WINED3DERR_INVALIDCALL.\n");
+ return WINED3DERR_INVALIDCALL;
+ }
+
+ if (src_texture->resource.pool != WINED3D_POOL_SYSTEM_MEM)
+ {
+ WARN("Source texture not in WINED3D_POOL_SYSTEM_MEM, returning WINED3DERR_INVALIDCALL.\n");
+ return WINED3DERR_INVALIDCALL;
+ }
+ if (dst_texture->resource.pool != WINED3D_POOL_DEFAULT)
+ {
+ WARN("Destination texture not in WINED3D_POOL_DEFAULT, returning WINED3DERR_INVALIDCALL.\n");
+ return WINED3DERR_INVALIDCALL;
+ }
+
+ /* Verify that the source and destination textures are the same 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;
+ if (layer_count != dst_texture->layer_count)
+ {
+ WARN("Source and destination have different layer counts.\n");
+ return WINED3DERR_INVALIDCALL;
+ }
+
+ if (src_texture->resource.format != dst_texture->resource.format)
+ {
+ WARN("Source and destination formats do not match.\n");
+ return WINED3DERR_INVALIDCALL;
+ }
+
+ switch (type)
+ {
+ case WINED3D_RTYPE_TEXTURE_2D:
+ break;
+
+ 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);
@ -272,28 +334,11 @@ index bac505d3a8..acc1916747 100644
+ dst_size = max(dst_size, dst_texture->resource.depth);
+
+ while (src_size > dst_size)
{
- for (j = 0; j < level_count; ++j)
- {
- src_surface = src_texture->sub_resources[i * src_levels + j + src_skip_levels].u.surface;
- dst_surface = dst_texture->sub_resources[i * dst_levels + j].u.surface;
- if (FAILED(hr = surface_upload_from_surface(dst_surface, NULL, src_surface, NULL)))
- {
- WARN("Failed to update surface, hr %#x.\n", hr);
- return hr;
- }
- }
+ {
+ src_size >>= 1;
+ ++src_skip_levels;
}
- return WINED3D_OK;
- }
- 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;
+ }
+
+ 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)
@ -302,24 +347,24 @@ index bac505d3a8..acc1916747 100644
+ return WINED3DERR_INVALIDCALL;
+ }
+ break;
default:
- FIXME("Unsupported texture type %#x.\n", type);
- return WINED3DERR_INVALIDCALL;
+
+ default:
+ break;
}
+ }
+
+ wined3d_cs_emit_update_texture(device->cs, src_texture, dst_texture);
+
+ return WINED3D_OK;
}
+}
+
HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device, DWORD *num_passes)
{
const struct wined3d_state *state = &device->state;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index d5bc41defb..b9839e6c41 100644
index 04f2fdf1b8..e021012dac 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2715,6 +2715,8 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL
@@ -2725,6 +2725,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;
@ -328,7 +373,7 @@ index d5bc41defb..b9839e6c41 100644
static inline BOOL isStateDirty(const struct wined3d_context *context, DWORD state)
{
@@ -3302,6 +3304,8 @@ void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resou
@@ -3313,6 +3315,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

@ -1,21 +1,21 @@
From 18746e1192dc09909f0e2478d35667e526230371 Mon Sep 17 00:00:00 2001
From 6b760fb77f50a2f5632656c048f4fb3c2f015cf7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Tue, 1 Oct 2013 14:31:56 +0200
Subject: wined3d: Hackily introduce a multithreaded command stream
---
dlls/wined3d/context.c | 3 +
dlls/wined3d/cs.c | 428 ++++++++++++++++++++++++++++++++++++-----
dlls/wined3d/cs.c | 441 +++++++++++++++++++++++++++++++++++------
dlls/wined3d/device.c | 2 +-
dlls/wined3d/wined3d_main.c | 10 +
dlls/wined3d/wined3d_private.h | 33 +++-
5 files changed, 419 insertions(+), 57 deletions(-)
dlls/wined3d/wined3d_private.h | 33 ++-
5 files changed, 426 insertions(+), 63 deletions(-)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 71c683d119..2db127af3a 100644
index 6b05c0a71c..cbf63fdac7 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -3787,6 +3787,9 @@ struct wined3d_context *context_acquire(const struct wined3d_device *device,
@@ -3841,6 +3841,9 @@ 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);
@ -26,7 +26,7 @@ index 71c683d119..2db127af3a 100644
current_context = NULL;
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index e380f9edcb..81695b7b14 100644
index db84f087dd..cdf71e7c3c 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -18,6 +18,7 @@
@ -791,7 +791,63 @@ index e380f9edcb..81695b7b14 100644
{
const struct wined3d_cs_blt_sub_resource *op = data;
@@ -1895,6 +1985,8 @@ static void wined3d_cs_exec_blt_sub_resource(struct wined3d_cs *cs, const void *
@@ -1896,14 +1986,14 @@ static void wined3d_cs_exec_blt_sub_resource(struct wined3d_cs *cs, const void *
{
FIXME("Flags %#x not implemented for %s resources.\n",
op->flags, debug_d3dresourcetype(op->dst_resource->type));
- return;
+ goto done;
}
if (op->src_resource->format != op->dst_resource->format)
{
FIXME("Format conversion not implemented for %s resources.\n",
debug_d3dresourcetype(op->dst_resource->type));
- return;
+ goto done;
}
update_w = op->dst_box.right - op->dst_box.left;
@@ -1915,14 +2005,14 @@ static void wined3d_cs_exec_blt_sub_resource(struct wined3d_cs *cs, const void *
{
FIXME("Stretching not implemented for %s resources.\n",
debug_d3dresourcetype(op->dst_resource->type));
- return;
+ goto done;
}
if (op->src_box.left || op->src_box.top || op->src_box.front)
{
FIXME("Source box %s not supported for %s resources.\n",
debug_box(&op->src_box), debug_d3dresourcetype(op->dst_resource->type));
- return;
+ goto done;
}
dst_texture = texture_from_resource(op->dst_resource);
@@ -1936,7 +2026,7 @@ static void wined3d_cs_exec_blt_sub_resource(struct wined3d_cs *cs, const void *
ERR("Failed to load source sub-resource into %s.\n",
wined3d_debug_location(src_texture->resource.map_binding));
context_release(context);
- return;
+ goto done;
}
level = op->dst_sub_resource_idx % dst_texture->level_count;
@@ -1951,7 +2041,7 @@ static void wined3d_cs_exec_blt_sub_resource(struct wined3d_cs *cs, const void *
{
ERR("Failed to load destination sub-resource.\n");
context_release(context);
- return;
+ goto done;
}
wined3d_texture_get_memory(src_texture, op->src_sub_resource_idx, &addr, src_texture->resource.map_binding);
@@ -1971,9 +2061,12 @@ static void wined3d_cs_exec_blt_sub_resource(struct wined3d_cs *cs, const void *
FIXME("Not implemented for %s resources.\n", debug_d3dresourcetype(op->dst_resource->type));
}
+done:
if (op->src_resource)
wined3d_resource_release(op->src_resource);
wined3d_resource_release(op->dst_resource);
@ -800,7 +856,7 @@ index e380f9edcb..81695b7b14 100644
}
void wined3d_cs_emit_blt_sub_resource(struct wined3d_cs *cs, struct wined3d_resource *dst_resource,
@@ -1924,7 +2016,7 @@ void wined3d_cs_emit_blt_sub_resource(struct wined3d_cs *cs, struct wined3d_reso
@@ -2003,7 +2096,7 @@ void wined3d_cs_emit_blt_sub_resource(struct wined3d_cs *cs, struct wined3d_reso
cs->ops->submit(cs);
}
@ -809,7 +865,7 @@ index e380f9edcb..81695b7b14 100644
{
const struct wined3d_cs_update_sub_resource *op = data;
const struct wined3d_box *box = &op->box;
@@ -1974,6 +2066,7 @@ static void wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const voi
@@ -2053,6 +2146,7 @@ static void wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const voi
done:
wined3d_resource_release(op->resource);
@ -817,7 +873,7 @@ index e380f9edcb..81695b7b14 100644
}
void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_resource *resource,
@@ -2018,10 +2111,11 @@ push_constant_info[] =
@@ -2097,10 +2191,11 @@ push_constant_info[] =
{FIELD_OFFSET(struct wined3d_state, ps_consts_b), sizeof(BOOL), WINED3D_SHADER_CONST_PS_B},
};
@ -830,7 +886,7 @@ index e380f9edcb..81695b7b14 100644
unsigned int context_count;
unsigned int i;
size_t offset;
@@ -2037,6 +2131,8 @@ static void wined3d_cs_exec_push_constants(struct wined3d_cs *cs, const void *da
@@ -2116,6 +2211,8 @@ static void wined3d_cs_exec_push_constants(struct wined3d_cs *cs, const void *da
{
device->contexts[i]->constant_update_mask |= push_constant_info[op->p].mask;
}
@ -839,7 +895,7 @@ index e380f9edcb..81695b7b14 100644
}
void wined3d_cs_emit_push_constants(struct wined3d_cs *cs, enum wined3d_push_constants p,
@@ -2054,7 +2150,7 @@ void wined3d_cs_emit_push_constants(struct wined3d_cs *cs, enum wined3d_push_con
@@ -2133,7 +2230,7 @@ void wined3d_cs_emit_push_constants(struct wined3d_cs *cs, enum wined3d_push_con
cs->ops->submit(cs);
}
@ -848,7 +904,7 @@ index e380f9edcb..81695b7b14 100644
{
const struct wined3d_cs_update_texture *op = data;
struct wined3d_context *context;
@@ -2065,6 +2161,8 @@ static void wined3d_cs_exec_update_texture(struct wined3d_cs *cs, const void *da
@@ -2144,6 +2241,8 @@ static void wined3d_cs_exec_update_texture(struct wined3d_cs *cs, const void *da
wined3d_resource_release(&op->src->resource);
wined3d_resource_release(&op->dst->resource);
@ -857,7 +913,7 @@ index e380f9edcb..81695b7b14 100644
}
void wined3d_cs_emit_update_texture(struct wined3d_cs *cs, struct wined3d_texture *src,
@@ -2083,11 +2181,13 @@ void wined3d_cs_emit_update_texture(struct wined3d_cs *cs, struct wined3d_textur
@@ -2162,11 +2261,13 @@ void wined3d_cs_emit_update_texture(struct wined3d_cs *cs, struct wined3d_textur
cs->ops->submit(cs);
}
@ -872,7 +928,7 @@ index e380f9edcb..81695b7b14 100644
}
void wined3d_cs_emit_update_swap_interval(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain)
@@ -2101,7 +2201,7 @@ void wined3d_cs_emit_update_swap_interval(struct wined3d_cs *cs, struct wined3d_
@@ -2180,7 +2281,7 @@ void wined3d_cs_emit_update_swap_interval(struct wined3d_cs *cs, struct wined3d_
cs->ops->submit_and_wait(cs);
}
@ -881,7 +937,7 @@ index e380f9edcb..81695b7b14 100644
{
const struct wined3d_cs_texture_add_dirty_region *op = data;
struct wined3d_texture *texture = op->texture;
@@ -2119,6 +2219,8 @@ static void wined3d_cs_exec_texture_add_dirty_region(struct wined3d_cs *cs, cons
@@ -2198,6 +2299,8 @@ static void wined3d_cs_exec_texture_add_dirty_region(struct wined3d_cs *cs, cons
context_release(context);
wined3d_resource_release(&texture->resource);
@ -890,7 +946,7 @@ index e380f9edcb..81695b7b14 100644
}
void wined3d_cs_emit_texture_add_dirty_region(struct wined3d_cs *cs,
@@ -2140,7 +2242,7 @@ void wined3d_cs_emit_texture_add_dirty_region(struct wined3d_cs *cs,
@@ -2219,7 +2322,7 @@ void wined3d_cs_emit_texture_add_dirty_region(struct wined3d_cs *cs,
cs->ops->submit(cs);
}
@ -899,7 +955,7 @@ index e380f9edcb..81695b7b14 100644
{
/* WINED3D_CS_OP_SYNC */ wined3d_cs_exec_sync,
/* WINED3D_CS_OP_GLFINISH */ wined3d_cs_exec_glfinish,
@@ -2241,6 +2343,201 @@ static const struct wined3d_cs_ops wined3d_cs_st_ops =
@@ -2320,6 +2423,201 @@ static const struct wined3d_cs_ops wined3d_cs_st_ops =
wined3d_cs_st_submit,
};
@ -1101,7 +1157,7 @@ index e380f9edcb..81695b7b14 100644
struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
{
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
@@ -2270,12 +2567,41 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
@@ -2349,12 +2647,41 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
return NULL;
}
@ -1144,7 +1200,7 @@ index e380f9edcb..81695b7b14 100644
HeapFree(GetProcessHeap(), 0, cs->data);
HeapFree(GetProcessHeap(), 0, cs);
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 6a07197eb7..7cebd54adc 100644
index fff869d863..37d1272f78 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1307,7 +1307,7 @@ UINT CDECL wined3d_device_get_available_texture_mem(const struct wined3d_device
@ -1187,7 +1243,7 @@ index 1ce5937f17..4ef747ca89 100644
if (hkey) RegCloseKey( hkey );
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 7cef5c4dcb..99f598f4fe 100644
index 40b1e8753a..2699ee33b5 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -390,6 +390,7 @@ struct wined3d_settings
@ -1198,7 +1254,7 @@ index 7cef5c4dcb..99f598f4fe 100644
};
extern struct wined3d_settings wined3d_settings DECLSPEC_HIDDEN;
@@ -2805,11 +2806,6 @@ static inline void wined3d_resource_release(struct wined3d_resource *resource)
@@ -2816,11 +2817,6 @@ static inline void wined3d_resource_release(struct wined3d_resource *resource)
InterlockedDecrement(&resource->access_count);
}
@ -1210,7 +1266,7 @@ index 7cef5c4dcb..99f598f4fe 100644
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,
@@ -3221,6 +3217,21 @@ enum wined3d_push_constants
@@ -3232,6 +3228,21 @@ enum wined3d_push_constants
WINED3D_PUSH_CONSTANTS_PS_B,
};
@ -1232,7 +1288,7 @@ index 7cef5c4dcb..99f598f4fe 100644
struct wined3d_cs_ops
{
void *(*require_space)(struct wined3d_cs *cs, size_t size);
@@ -3238,9 +3249,21 @@ struct wined3d_cs
@@ -3249,9 +3260,21 @@ struct wined3d_cs
size_t data_size, start, end;
void *data;

View File

@ -1696,7 +1696,83 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
{
const struct wined3d_cs_blt_sub_resource *op = data;
@@ -1770,6 +2502,10 @@ static void wined3d_cs_exec_blt_sub_resource(struct wined3d_cs *cs, const void *
@@ -1771,14 +2503,22 @@ static void wined3d_cs_exec_blt_sub_resource(struct wined3d_cs *cs, const void *
{
FIXME("Flags %#x not implemented for %s resources.\n",
op->flags, debug_d3dresourcetype(op->dst_resource->type));
+#if !defined(STAGING_CSMT)
return;
+#else /* STAGING_CSMT */
+ goto done;
+#endif /* STAGING_CSMT */
}
if (op->src_resource->format != op->dst_resource->format)
{
FIXME("Format conversion not implemented for %s resources.\n",
debug_d3dresourcetype(op->dst_resource->type));
+#if !defined(STAGING_CSMT)
return;
+#else /* STAGING_CSMT */
+ goto done;
+#endif /* STAGING_CSMT */
}
update_w = op->dst_box.right - op->dst_box.left;
@@ -1790,14 +2530,22 @@ static void wined3d_cs_exec_blt_sub_resource(struct wined3d_cs *cs, const void *
{
FIXME("Stretching not implemented for %s resources.\n",
debug_d3dresourcetype(op->dst_resource->type));
+#if !defined(STAGING_CSMT)
return;
+#else /* STAGING_CSMT */
+ goto done;
+#endif /* STAGING_CSMT */
}
if (op->src_box.left || op->src_box.top || op->src_box.front)
{
FIXME("Source box %s not supported for %s resources.\n",
debug_box(&op->src_box), debug_d3dresourcetype(op->dst_resource->type));
+#if !defined(STAGING_CSMT)
return;
+#else /* STAGING_CSMT */
+ goto done;
+#endif /* STAGING_CSMT */
}
dst_texture = texture_from_resource(op->dst_resource);
@@ -1811,7 +2559,11 @@ static void wined3d_cs_exec_blt_sub_resource(struct wined3d_cs *cs, const void *
ERR("Failed to load source sub-resource into %s.\n",
wined3d_debug_location(src_texture->resource.map_binding));
context_release(context);
+#if !defined(STAGING_CSMT)
return;
+#else /* STAGING_CSMT */
+ goto done;
+#endif /* STAGING_CSMT */
}
level = op->dst_sub_resource_idx % dst_texture->level_count;
@@ -1826,7 +2578,11 @@ static void wined3d_cs_exec_blt_sub_resource(struct wined3d_cs *cs, const void *
{
ERR("Failed to load destination sub-resource.\n");
context_release(context);
+#if !defined(STAGING_CSMT)
return;
+#else /* STAGING_CSMT */
+ goto done;
+#endif /* STAGING_CSMT */
}
wined3d_texture_get_memory(src_texture, op->src_sub_resource_idx, &addr, src_texture->resource.map_binding);
@@ -1846,9 +2602,16 @@ static void wined3d_cs_exec_blt_sub_resource(struct wined3d_cs *cs, const void *
FIXME("Not implemented for %s resources.\n", debug_d3dresourcetype(op->dst_resource->type));
}
+#if defined(STAGING_CSMT)
+done:
+#endif /* STAGING_CSMT */
if (op->src_resource)
wined3d_resource_release(op->src_resource);
wined3d_resource_release(op->dst_resource);
@ -1707,7 +1783,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
}
void wined3d_cs_emit_blt_sub_resource(struct wined3d_cs *cs, struct wined3d_resource *dst_resource,
@@ -1779,7 +2515,11 @@ void wined3d_cs_emit_blt_sub_resource(struct wined3d_cs *cs, struct wined3d_reso
@@ -1858,7 +2621,11 @@ void wined3d_cs_emit_blt_sub_resource(struct wined3d_cs *cs, struct wined3d_reso
{
struct wined3d_cs_blt_sub_resource *op;
@ -1719,7 +1795,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
op->opcode = WINED3D_CS_OP_BLT_SUB_RESOURCE;
op->dst_resource = dst_resource;
op->dst_sub_resource_idx = dst_sub_resource_idx;
@@ -1799,7 +2539,11 @@ void wined3d_cs_emit_blt_sub_resource(struct wined3d_cs *cs, struct wined3d_reso
@@ -1878,7 +2645,11 @@ void wined3d_cs_emit_blt_sub_resource(struct wined3d_cs *cs, struct wined3d_reso
cs->ops->submit(cs);
}
@ -1731,7 +1807,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
{
const struct wined3d_cs_update_sub_resource *op = data;
const struct wined3d_box *box = &op->box;
@@ -1849,6 +2593,9 @@ static void wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const voi
@@ -1928,6 +2699,9 @@ static void wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const voi
done:
wined3d_resource_release(op->resource);
@ -1741,7 +1817,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
}
void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_resource *resource,
@@ -1856,9 +2603,60 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r
@@ -1935,9 +2709,60 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r
unsigned int slice_pitch)
{
struct wined3d_cs_update_sub_resource *op;
@ -1802,7 +1878,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
op->resource = resource;
op->sub_resource_idx = sub_resource_idx;
op->box = *box;
@@ -1868,11 +2666,173 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r
@@ -1947,11 +2772,173 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r
wined3d_resource_acquire(resource);
@ -1976,7 +2052,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
/* WINED3D_CS_OP_PRESENT */ wined3d_cs_exec_present,
/* WINED3D_CS_OP_CLEAR */ wined3d_cs_exec_clear,
/* WINED3D_CS_OP_DISPATCH */ wined3d_cs_exec_dispatch,
@@ -1906,15 +2866,28 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
@@ -1985,15 +2972,28 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_RESET_STATE */ wined3d_cs_exec_reset_state,
/* WINED3D_CS_OP_CALLBACK */ wined3d_cs_exec_callback,
/* WINED3D_CS_OP_QUERY_ISSUE */ wined3d_cs_exec_query_issue,
@ -2005,7 +2081,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
{
if (size > (cs->data_size - cs->end))
{
@@ -1958,6 +2931,7 @@ static void wined3d_cs_st_submit(struct wined3d_cs *cs)
@@ -2037,6 +3037,7 @@ static void wined3d_cs_st_submit(struct wined3d_cs *cs)
HeapFree(GetProcessHeap(), 0, data);
}
@ -2013,7 +2089,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
static void wined3d_cs_st_push_constants(struct wined3d_cs *cs, enum wined3d_push_constants p,
unsigned int start_idx, unsigned int count, const void *constants)
{
@@ -1998,15 +2972,271 @@ static void wined3d_cs_st_push_constants(struct wined3d_cs *cs, enum wined3d_pus
@@ -2077,15 +3078,271 @@ static void wined3d_cs_st_push_constants(struct wined3d_cs *cs, enum wined3d_pus
for (i = 0, context_count = device->context_count; i < context_count; ++i)
{
device->contexts[i]->constant_update_mask |= push_constant_info[p].mask;
@ -2285,7 +2361,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
{
@@ -2037,12 +3267,57 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
@@ -2116,12 +3373,57 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
return NULL;
}
@ -2516,7 +2592,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
struct wined3d_context *context;
struct wined3d_map_desc src;
HRESULT hr = WINED3D_OK;
@@ -3691,6 +3742,13 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device,
@@ -3685,6 +3736,13 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device,
}
context = context_acquire(device, NULL, 0);
@ -2530,7 +2606,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
/* Only a prepare, since we're uploading entire volumes. */
wined3d_texture_prepare_texture(dst_texture, context, FALSE);
@@ -3698,15 +3756,22 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device,
@@ -3692,15 +3750,22 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device,
for (i = 0; i < level_count; ++i)
{
@ -2553,10 +2629,10 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
if (FAILED(hr = wined3d_resource_unmap(&src_texture->resource, src_level + i)))
goto done;
}
@@ -3714,16 +3779,89 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device,
done:
context_release(context);
return hr;
@@ -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;
@ -2569,115 +2645,165 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
+{
+ unsigned int src_size, dst_size, src_skip_levels = 0;
+ unsigned int level_count, i, j;
+
+ 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);
+ RECT r;
+#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)
+ {
+ 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;
+ }
+
+ /* Make sure that the destination texture is loaded. */
+#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,
}
/* Make sure that the destination texture is loaded. */
+#if !defined(STAGING_CSMT)
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)
+#else /* STAGING_CSMT */
+ wined3d_texture_load(dst_texture, context, FALSE);
+
+ /* Update every surface level of the texture. */
+ switch (dst_texture->resource.type)
+ {
+ case WINED3D_RTYPE_TEXTURE_2D:
+ {
+ unsigned int src_levels = src_texture->level_count;
+ unsigned int dst_levels = dst_texture->level_count;
+ struct wined3d_surface *src_surface;
+ struct wined3d_surface *dst_surface;
+
+#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)
+ {
+ for (j = 0; j < level_count; ++j)
+ {
+#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;
+ src_surface = src_texture->sub_resources[i * src_levels + j + src_skip_levels].u.surface;
+ dst_surface = dst_texture->sub_resources[i * dst_levels + j].u.surface;
+ if (FAILED(hr = surface_upload_from_surface(dst_surface, NULL, src_surface, NULL)))
+ {
+ WARN("Failed to update surface, hr %#x.\n", 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,
src_texture, src_sub_resource_idx, &r, 0, NULL, WINED3D_TEXF_POINT)))
{
WARN("Failed to update surface, hr %#x.\n", hr);
+#if !defined(STAGING_CSMT)
return hr;
+#else /* STAGING_CSMT */
+ return;
+#endif /* STAGING_CSMT */
}
continue;
}
@@ -3819,14 +3920,23 @@ 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);
+#if !defined(STAGING_CSMT)
return hr;
+#else /* STAGING_CSMT */
+ return;
+ }
+ }
+ }
+#endif /* STAGING_CSMT */
}
}
}
+#if !defined(STAGING_CSMT)
return WINED3D_OK;
+#else /* STAGING_CSMT */
+ break;
+ }
+
+ case WINED3D_RTYPE_TEXTURE_3D:
+#endif /* STAGING_CSMT */
}
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,
default:
FIXME("Unsupported texture type %#x.\n", type);
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 */
}
}
HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device,
struct wined3d_texture *src_texture, struct wined3d_texture *dst_texture)
{
unsigned int src_size, dst_size, src_skip_levels = 0;
+#if !defined(STAGING_CSMT)
unsigned int layer_count, level_count, i, j;
enum wined3d_resource_type type;
HRESULT hr;
struct wined3d_context *context;
+#else /* STAGING_CSMT */
+#if defined(STAGING_CSMT)
+HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device,
+ struct wined3d_texture *src_texture, struct wined3d_texture *dst_texture)
+{
+ unsigned int src_size, dst_size, src_skip_levels = 0;
+ unsigned int layer_count;
+ enum wined3d_resource_type type;
+#endif /* STAGING_CSMT */
TRACE("device %p, src_texture %p, dst_texture %p.\n", device, src_texture, dst_texture);
@@ -3760,6 +3898,7 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device,
return WINED3DERR_INVALIDCALL;
}
+#if !defined(STAGING_CSMT)
level_count = min(wined3d_texture_get_level_count(src_texture),
wined3d_texture_get_level_count(dst_texture));
@@ -3782,9 +3921,21 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device,
context_release(context);
/* Update every surface level of the texture. */
+#else /* STAGING_CSMT */
+ /* FIXME: This isn't necessary for 2D textures, but currently surface_upload_from_surface
+ * rejects mismatching formats, and we can't report the error back after dispatching the
+ * call. */
+
+ 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. */
+ if (!src_texture || !dst_texture)
+ {
+ WARN("Source and destination textures must be non-NULL, returning WINED3DERR_INVALIDCALL.\n");
+ return WINED3DERR_INVALIDCALL;
+ }
+
+ if (src_texture->resource.pool != WINED3D_POOL_SYSTEM_MEM)
+ {
+ WARN("Source texture not in WINED3D_POOL_SYSTEM_MEM, returning WINED3DERR_INVALIDCALL.\n");
+ return WINED3DERR_INVALIDCALL;
+ }
+ if (dst_texture->resource.pool != WINED3D_POOL_DEFAULT)
+ {
+ WARN("Destination texture not in WINED3D_POOL_DEFAULT, returning WINED3DERR_INVALIDCALL.\n");
+ return WINED3DERR_INVALIDCALL;
+ }
+
+ /* Verify that the source and destination textures are the same 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;
+ if (layer_count != dst_texture->layer_count)
+ {
+ WARN("Source and destination have different layer counts.\n");
+ return WINED3DERR_INVALIDCALL;
+ }
+
+ if (src_texture->resource.format != dst_texture->resource.format)
+ {
+ WARN("Source and destination formats do not match.\n");
+ return WINED3DERR_INVALIDCALL;
+ }
+
+#endif /* STAGING_CSMT */
switch (type)
{
case WINED3D_RTYPE_TEXTURE_2D:
+#if !defined(STAGING_CSMT)
{
unsigned int src_levels = src_texture->level_count;
unsigned int dst_levels = dst_texture->level_count;
@@ -3817,6 +3968,38 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device,
FIXME("Unsupported texture type %#x.\n", type);
return WINED3DERR_INVALIDCALL;
}
+#else /* STAGING_CSMT */
+ switch (type)
+ {
+ case WINED3D_RTYPE_TEXTURE_2D:
+ break;
+
+ case WINED3D_RTYPE_TEXTURE_3D:
@ -2708,11 +2834,13 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
+ wined3d_cs_emit_update_texture(device->cs, src_texture, dst_texture);
+
+ return WINED3D_OK;
+}
+
+#endif /* STAGING_CSMT */
}
HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device, DWORD *num_passes)
@@ -4149,6 +4332,7 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev
{
const struct wined3d_state *state = &device->state;
@@ -4149,6 +4352,7 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev
return WINED3DERR_INVALIDCALL;
}
@ -2720,7 +2848,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 +4343,18 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev
@@ -4159,6 +4363,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;
@ -2739,7 +2867,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
}
if (!src_box)
@@ -4885,7 +5081,11 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
@@ -4871,7 +5087,11 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
{
if (reset_state)
hr = wined3d_device_create_primary_opengl_context(device);
@ -2751,7 +2879,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
@@ -5198,3 +5398,58 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL
@@ -5184,3 +5404,58 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL
else
return CallWindowProcA(proc, window, message, wparam, lparam);
}
@ -2914,7 +3042,7 @@ diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -2474,7 +2474,11 @@ static BOOL surface_load_texture(struct wined3d_surface *surface,
@@ -2446,7 +2446,11 @@ static BOOL surface_load_texture(struct wined3d_surface *surface,
/* Don't use PBOs for converted surfaces. During PBO conversion we look at
* WINED3D_TEXTURE_CONVERTED but it isn't set (yet) in all cases it is
* getting called. */
@ -3330,7 +3458,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
@@ -595,6 +595,10 @@ static void wined3d_shader_resource_view_cs_init(void *object)
@@ -594,6 +594,10 @@ static void wined3d_shader_resource_view_cs_init(void *object)
debug_d3dformat(resource->format->id), debug_d3dformat(view_format->id));
}
}
@ -3341,7 +3469,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,
@@ -611,6 +615,9 @@ static HRESULT wined3d_shader_resource_view_init(struct wined3d_shader_resource_
@@ -610,6 +614,9 @@ static HRESULT wined3d_shader_resource_view_init(struct wined3d_shader_resource_
wined3d_resource_incref(view->resource = resource);
@ -3351,7 +3479,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;
@@ -792,6 +799,10 @@ static void wined3d_unordered_access_view_cs_init(void *object)
@@ -791,6 +798,10 @@ static void wined3d_unordered_access_view_cs_init(void *object)
desc, texture, view->format);
}
}
@ -3362,7 +3490,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,
@@ -811,6 +822,9 @@ static HRESULT wined3d_unordered_access_view_init(struct wined3d_unordered_acces
@@ -810,6 +821,9 @@ static HRESULT wined3d_unordered_access_view_init(struct wined3d_unordered_acces
wined3d_resource_incref(view->resource = resource);
@ -3472,7 +3600,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)
{
@@ -2800,11 +2828,13 @@ static inline void wined3d_resource_release(struct wined3d_resource *resource)
@@ -2801,11 +2829,13 @@ static inline void wined3d_resource_release(struct wined3d_resource *resource)
InterlockedDecrement(&resource->access_count);
}
@ -3486,7 +3614,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,
@@ -2915,7 +2945,11 @@ struct wined3d_texture
@@ -2916,7 +2946,11 @@ struct wined3d_texture
unsigned int map_count;
DWORD locations;
@ -3498,7 +3626,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
} sub_resources[1];
};
@@ -3216,6 +3250,7 @@ enum wined3d_push_constants
@@ -3217,6 +3251,7 @@ enum wined3d_push_constants
WINED3D_PUSH_CONSTANTS_PS_B,
};
@ -3506,7 +3634,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);
@@ -3223,6 +3258,33 @@ struct wined3d_cs_ops
@@ -3224,6 +3259,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);
};
@ -3540,7 +3668,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
struct wined3d_cs
{
@@ -3233,8 +3295,31 @@ struct wined3d_cs
@@ -3234,8 +3296,31 @@ struct wined3d_cs
size_t data_size, start, end;
void *data;
@ -3572,7 +3700,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,
@@ -3252,10 +3337,20 @@ void wined3d_cs_emit_dispatch(struct wined3d_cs *cs,
@@ -3253,10 +3338,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;
@ -3593,7 +3721,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;
@@ -3303,10 +3398,20 @@ void wined3d_cs_emit_set_unordered_access_view(struct wined3d_cs *cs, enum wined
@@ -3304,10 +3399,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;
@ -3614,7 +3742,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,
@@ -3314,12 +3419,14 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource,
@@ -3315,12 +3420,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;

View File

@ -1,4 +1,4 @@
From 31990eb50ee15e12d709efcf1e21d3a9a2c20fb9 Mon Sep 17 00:00:00 2001
From 0e6a390ce17ae3d5d7fd05fb904b430ef3f6afaa Mon Sep 17 00:00:00 2001
From: Christian Costa <titan.costa@gmail.com>
Date: Tue, 4 Nov 2014 22:41:45 +0100
Subject: wined3d: Improve DXTn support and export conversion functions for
@ -13,7 +13,7 @@ Subject: wined3d: Improve DXTn support and export conversion functions for
5 files changed, 161 insertions(+), 10 deletions(-)
diff --git a/dlls/wined3d/dxtn.c b/dlls/wined3d/dxtn.c
index ce98949..77f7d55 100644
index ce989490ef..77f7d550a5 100644
--- a/dlls/wined3d/dxtn.c
+++ b/dlls/wined3d/dxtn.c
@@ -25,6 +25,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d);
@ -153,10 +153,10 @@ index ce98949..77f7d55 100644
#undef LOAD_FUNCPTR
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 3668c25..1e9e02c 100644
index a9b24419f9..26c75b6d88 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -1709,6 +1709,30 @@ static void convert_dxt1_x8r8g8b8(const BYTE *src, BYTE *dst,
@@ -1269,6 +1269,30 @@ static void convert_dxt1_x8r8g8b8(const BYTE *src, BYTE *dst,
wined3d_dxt1_decode(src, dst, pitch_in, pitch_out, WINED3DFMT_B8G8R8X8_UNORM, w, h);
}
@ -187,7 +187,7 @@ index 3668c25..1e9e02c 100644
static void convert_a8r8g8b8_dxt1(const BYTE *src, BYTE *dst,
DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h)
{
@@ -1775,8 +1799,15 @@ static const struct d3dfmt_converter_desc converters[] =
@@ -1335,8 +1359,15 @@ static const struct d3dfmt_converter_desc converters[] =
static const struct d3dfmt_converter_desc dxtn_converters[] =
{
@ -204,10 +204,10 @@ index 3668c25..1e9e02c 100644
{WINED3DFMT_B8G8R8X8_UNORM, WINED3DFMT_DXT1, convert_x8r8g8b8_dxt1},
{WINED3DFMT_B5G5R5A1_UNORM, WINED3DFMT_DXT1, convert_a1r5g5b5_dxt1},
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index 21cb0db..b7bf46d 100644
index 12246122f0..ed943dcf69 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -269,3 +269,11 @@
@@ -295,3 +295,11 @@
@ cdecl wined3d_vertex_declaration_decref(ptr)
@ cdecl wined3d_vertex_declaration_get_parent(ptr)
@ cdecl wined3d_vertex_declaration_incref(ptr)
@ -220,10 +220,10 @@ index 21cb0db..b7bf46d 100644
+@ cdecl wined3d_dxt5_decode(ptr ptr long long long long long)
+@ cdecl wined3d_dxt5_encode(ptr ptr long long long long long)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index e14786c..e0696e1 100644
index 0ee4c9dc38..b88d89105e 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3483,17 +3483,7 @@ static inline struct wined3d_surface *context_get_rt_surface(const struct wined3
@@ -4007,17 +4007,7 @@ static inline struct wined3d_surface *context_get_rt_surface(const struct wined3
return texture->sub_resources[context->current_rt.sub_resource_idx].u.surface;
}
@ -242,11 +242,11 @@ index e14786c..e0696e1 100644
/* The WNDCLASS-Name for the fake window which we use to retrieve the GL capabilities */
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index cb057ab..baad228 100644
index 25c75f251a..bb85326a90 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2514,4 +2514,18 @@ static inline unsigned int wined3d_log2i(unsigned int x)
#endif
@@ -2679,4 +2679,18 @@ static inline void wined3d_box_set(struct wined3d_box *box, unsigned int left, u
box->back = back;
}
+BOOL wined3d_dxt1_decode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out,
@ -265,5 +265,5 @@ index cb057ab..baad228 100644
+
#endif /* __WINE_WINED3D_H */
--
2.7.1
2.11.0