Added patch to revert changes to wined3d_buffer_upload_data.

This commit is contained in:
Sebastian Lackner 2017-02-08 19:56:48 +01:00
parent 74528271f3
commit 481488be9f
7 changed files with 227 additions and 101 deletions

View File

@ -410,6 +410,7 @@ patch_enable_all ()
enable_wined3d_GTX_560M="$1"
enable_wined3d_Limit_Vram="$1"
enable_wined3d_QUERY_Stubs="$1"
enable_wined3d_Revert_Buffer_Upload="$1"
enable_wined3d_Revert_Pixel_Center_Offset="$1"
enable_wined3d_Silence_FIXMEs="$1"
enable_wined3d_WINED3DFMT_R32G32_UINT="$1"
@ -1445,6 +1446,9 @@ patch_enable ()
wined3d-QUERY_Stubs)
enable_wined3d_QUERY_Stubs="$2"
;;
wined3d-Revert_Buffer_Upload)
enable_wined3d_Revert_Buffer_Upload="$2"
;;
wined3d-Revert_Pixel_Center_Offset)
enable_wined3d_Revert_Pixel_Center_Offset="$2"
;;
@ -1992,6 +1996,9 @@ if test "$enable_wined3d_CSMT_Helper" -eq 1; then
if test "$enable_wined3d_QUERY_Stubs" -gt 1; then
abort "Patchset wined3d-QUERY_Stubs disabled, but wined3d-CSMT_Helper depends on that."
fi
if test "$enable_wined3d_Revert_Buffer_Upload" -gt 1; then
abort "Patchset wined3d-Revert_Buffer_Upload disabled, but wined3d-CSMT_Helper depends on that."
fi
if test "$enable_wined3d_Revert_Pixel_Center_Offset" -gt 1; then
abort "Patchset wined3d-Revert_Pixel_Center_Offset disabled, but wined3d-CSMT_Helper depends on that."
fi
@ -2005,6 +2012,7 @@ if test "$enable_wined3d_CSMT_Helper" -eq 1; then
enable_wined3d_Accounting=1
enable_wined3d_DXTn=1
enable_wined3d_QUERY_Stubs=1
enable_wined3d_Revert_Buffer_Upload=1
enable_wined3d_Revert_Pixel_Center_Offset=1
enable_wined3d_Silence_FIXMEs=1
fi
@ -8378,6 +8386,18 @@ if test "$enable_wined3d_QUERY_Stubs" -eq 1; then
) >> "$patchlist"
fi
# Patchset wined3d-Revert_Buffer_Upload
# |
# | Modified files:
# | * dlls/wined3d/buffer.c, dlls/wined3d/device.c, dlls/wined3d/wined3d_private.h
# |
if test "$enable_wined3d_Revert_Buffer_Upload" -eq 1; then
patch_apply wined3d-Revert_Buffer_Upload/0001-Revert-wined3d-Implement-wined3d_buffer_upload_data-.patch
(
printf '%s\n' '+ { "Sebastian Lackner", "Revert \"wined3d: Implement wined3d_buffer_upload_data() on top of wined3d_buffer_upload_ranges().\".", 1 },';
) >> "$patchlist"
fi
# Patchset wined3d-Revert_Pixel_Center_Offset
# |
# | Modified files:
@ -8395,7 +8415,7 @@ fi
# | This patchset has the following (direct or indirect) dependencies:
# | * d3d11-Deferred_Context, makedep-PARENTSPEC, ntdll-Attach_Process_DLLs, ntdll-DllOverrides_WOW64, ntdll-
# | Loader_Machine_Type, ntdll-DllRedirects, wined3d-1DTextures, wined3d-Accounting, wined3d-DXTn, wined3d-QUERY_Stubs,
# | wined3d-Revert_Pixel_Center_Offset, wined3d-Silence_FIXMEs
# | wined3d-Revert_Buffer_Upload, wined3d-Revert_Pixel_Center_Offset, wined3d-Silence_FIXMEs
# |
# | Modified files:
# | * configure.ac, dlls/wined3d-csmt/Makefile.in, dlls/wined3d-csmt/version.rc
@ -8462,7 +8482,7 @@ fi
# | This patchset has the following (direct or indirect) dependencies:
# | * d3d11-Deferred_Context, makedep-PARENTSPEC, ntdll-Attach_Process_DLLs, ntdll-DllOverrides_WOW64, ntdll-
# | Loader_Machine_Type, ntdll-DllRedirects, wined3d-1DTextures, wined3d-Accounting, wined3d-DXTn, wined3d-QUERY_Stubs,
# | wined3d-Revert_Pixel_Center_Offset, wined3d-Silence_FIXMEs, wined3d-CSMT_Helper
# | wined3d-Revert_Buffer_Upload, wined3d-Revert_Pixel_Center_Offset, wined3d-Silence_FIXMEs, wined3d-CSMT_Helper
# |
# | This patchset fixes the following Wine bugs:
# | * [#11674] Support for CSMT (command stream) to increase graphic performance

View File

@ -4,6 +4,7 @@ Depends: wined3d-QUERY_Stubs
Depends: wined3d-1DTextures
Depends: wined3d-Silence_FIXMEs
Depends: wined3d-Revert_Pixel_Center_Offset
Depends: wined3d-Revert_Buffer_Upload
Depends: d3d11-Deferred_Context
Depends: makedep-PARENTSPEC
Depends: ntdll-DllRedirects

View File

@ -1,14 +1,14 @@
From e80c0036e971e778b35235ea504843d88f51c949 Mon Sep 17 00:00:00 2001
From a210ef716ab19691b52d1bbaf78d39afbf906d5f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Fri, 4 Sep 2015 15:22:49 +0200
Subject: wined3d: Send update_sub_resource calls through the command stream.
---
dlls/wined3d/cs.c | 69 ++++++++++++++++++++++++++++++++++++++++++
dlls/wined3d/device.c | 23 ++------------
dlls/wined3d/device.c | 22 +-------------
dlls/wined3d/texture.c | 2 +-
dlls/wined3d/wined3d_private.h | 5 +++
4 files changed, 77 insertions(+), 22 deletions(-)
4 files changed, 76 insertions(+), 22 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 9f7f8455a01..f021b9320e5 100644
@ -112,10 +112,10 @@ index 9f7f8455a01..f021b9320e5 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 f712113e86e..6395aaea6be 100644
index 4f4221c1223..a6b2996f112 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4224,8 +4224,6 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
@@ -4148,8 +4148,6 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
unsigned int depth_pitch)
{
unsigned int width, height, depth, level;
@ -124,15 +124,7 @@ index f712113e86e..6395aaea6be 100644
struct wined3d_texture *texture;
TRACE("device %p, resource %p, sub_resource_idx %u, box %s, data %p, row_pitch %u, depth_pitch %u.\n",
@@ -4234,6 +4232,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
if (resource->type == WINED3D_RTYPE_BUFFER)
{
struct wined3d_buffer *buffer = buffer_from_resource(resource);
+ struct wined3d_context *context;
if (sub_resource_idx > 0)
{
@@ -4282,25 +4281,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
@@ -4199,25 +4197,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
return;
}
@ -173,10 +165,10 @@ index 3e7922e8c8e..1b4fa46b55e 100644
{
UINT sub_count = texture->level_count * texture->layer_count;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index ff8c4e88bd4..85417862c60 100644
index 9a1b183dfaf..c8801cbaa09 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2874,6 +2874,8 @@ BOOL wined3d_texture_check_block_align(const struct wined3d_texture *texture,
@@ -2873,6 +2873,8 @@ BOOL wined3d_texture_check_block_align(const struct wined3d_texture *texture,
GLenum wined3d_texture_get_gl_buffer(const struct wined3d_texture *texture) DECLSPEC_HIDDEN;
void wined3d_texture_get_memory(struct wined3d_texture *texture, unsigned int sub_resource_idx,
struct wined3d_bo_address *data, DWORD locations) DECLSPEC_HIDDEN;
@ -185,7 +177,7 @@ index ff8c4e88bd4..85417862c60 100644
void wined3d_texture_invalidate_location(struct wined3d_texture *texture,
unsigned int sub_resource_idx, DWORD location) DECLSPEC_HIDDEN;
void wined3d_texture_load(struct wined3d_texture *texture,
@@ -3239,6 +3241,9 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs,
@@ -3238,6 +3240,9 @@ 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;
void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource) DECLSPEC_HIDDEN;

View File

@ -1,36 +1,28 @@
From 0565d5be2c6a7d904777fcd5de6903bec9a6ab1a Mon Sep 17 00:00:00 2001
From f0062383c0837e2faa414c042f4b93506a40501b Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Tue, 7 Feb 2017 14:01:52 +0100
Subject: wined3d: Send buffer update subresource requests through CS.
---
dlls/wined3d/cs.c | 19 +++++++++++++++++++
dlls/wined3d/device.c | 15 +--------------
2 files changed, 20 insertions(+), 14 deletions(-)
dlls/wined3d/cs.c | 11 +++++++++++
dlls/wined3d/device.c | 7 +------
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index cdd11e41c91..594662fbd83 100644
index cdd11e41c91..d2aacaa261a 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -2233,6 +2233,25 @@ static UINT wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const voi
@@ -2233,6 +2233,17 @@ static UINT wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const voi
struct wined3d_texture *texture;
unsigned int width, height, depth, level;
+ if (op->resource->type == WINED3D_RTYPE_BUFFER)
+ {
+ struct wined3d_buffer *buffer = buffer_from_resource(op->resource);
+ HRESULT hr;
+
+ context = context_acquire(op->resource->device, NULL);
+ if (!wined3d_buffer_load_location(buffer, context, WINED3D_LOCATION_BUFFER))
+ {
+ ERR("Failed to load buffer location.\n");
+ }
+ else
+ {
+ wined3d_buffer_upload_data(buffer, context, op->box, op->data);
+ wined3d_buffer_invalidate_location(buffer, ~WINED3D_LOCATION_BUFFER);
+ }
+ context_release(context);
+ if (FAILED(hr = wined3d_buffer_upload_data(buffer, op->box, op->data)))
+ WARN("Failed to update buffer data, hr %#x.\n", hr);
+
+ return sizeof(*op);
+ }
@ -39,15 +31,15 @@ index cdd11e41c91..594662fbd83 100644
level = op->sub_resource_idx % texture->level_count;
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 151e41bb2e3..5ac6e992bae 100644
index f3412088483..8a02e5db229 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4229,26 +4229,13 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
@@ -4153,18 +4153,13 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
if (resource->type == WINED3D_RTYPE_BUFFER)
{
- struct wined3d_buffer *buffer = buffer_from_resource(resource);
- struct wined3d_context *context;
- HRESULT hr;
-
if (sub_resource_idx > 0)
{
@ -55,16 +47,8 @@ index 151e41bb2e3..5ac6e992bae 100644
return;
}
- context = context_acquire(resource->device, NULL);
- if (!wined3d_buffer_load_location(buffer, context, WINED3D_LOCATION_BUFFER))
- {
- ERR("Failed to load buffer location.\n");
- return;
- }
-
- wined3d_buffer_upload_data(buffer, context, box, data);
- wined3d_buffer_invalidate_location(buffer, ~WINED3D_LOCATION_BUFFER);
- context_release(context);
- if (FAILED(hr = wined3d_buffer_upload_data(buffer, box, data)))
- WARN("Failed to update buffer data, hr %#x.\n", hr);
-
+ wined3d_cs_emit_update_sub_resource(device->cs, resource, sub_resource_idx, box, data, row_pitch, depth_pitch);
return;

View File

@ -2002,7 +2002,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
}
HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resource, unsigned int sub_resource_idx)
@@ -1482,19 +2411,813 @@ HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resourc
@@ -1482,19 +2411,805 @@ HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resourc
struct wined3d_cs_unmap *op;
HRESULT hr;
@ -2393,18 +2393,10 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
+ if (op->resource->type == WINED3D_RTYPE_BUFFER)
+ {
+ struct wined3d_buffer *buffer = buffer_from_resource(op->resource);
+ HRESULT hr;
+
+ context = context_acquire(op->resource->device, NULL);
+ if (!wined3d_buffer_load_location(buffer, context, WINED3D_LOCATION_BUFFER))
+ {
+ ERR("Failed to load buffer location.\n");
+ }
+ else
+ {
+ wined3d_buffer_upload_data(buffer, context, op->box, op->data);
+ wined3d_buffer_invalidate_location(buffer, ~WINED3D_LOCATION_BUFFER);
+ }
+ context_release(context);
+ if (FAILED(hr = wined3d_buffer_upload_data(buffer, op->box, op->data)))
+ WARN("Failed to update buffer data, hr %#x.\n", hr);
+
+ return sizeof(*op);
+ }
@ -2481,15 +2473,10 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
+ op->hr = &hr;
+
+ cs->ops->submit_and_wait(cs);
+#endif /* STAGING_CSMT */
+
+ return hr;
+}
+
+#if !defined(STAGING_CSMT)
static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
+#else /* STAGING_CSMT */
+static UINT wined3d_cs_exec_release_dc(struct wined3d_cs *cs, const void *data)
+{
+ const struct wined3d_cs_get_release_dc *op = data;
@ -2512,10 +2499,15 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
+ op->hr = &hr;
+
+ cs->ops->submit_and_wait(cs);
+#endif /* STAGING_CSMT */
+
+ return hr;
+}
+
+#if !defined(STAGING_CSMT)
static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
+#else /* STAGING_CSMT */
+static UINT wined3d_cs_exec_create_dummy_textures(struct wined3d_cs *cs, const void *data)
+{
+ const struct wined3d_cs_create_dummy_textures *op = data;
@ -2816,7 +2808,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,
@@ -1526,13 +3249,43 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
@@ -1526,13 +3241,43 @@ 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_DESTROY_OBJECT */ wined3d_cs_exec_destroy_object,
/* WINED3D_CS_OP_QUERY_ISSUE */ wined3d_cs_exec_query_issue,
@ -2860,7 +2852,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
{
if (size > cs->data_size)
{
@@ -1556,6 +3309,7 @@ static void wined3d_cs_st_submit(struct wined3d_cs *cs)
@@ -1556,6 +3301,7 @@ static void wined3d_cs_st_submit(struct wined3d_cs *cs)
wined3d_cs_op_handlers[opcode](cs, cs->data);
}
@ -2868,7 +2860,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)
{
@@ -1596,15 +3350,161 @@ static void wined3d_cs_st_push_constants(struct wined3d_cs *cs, enum wined3d_pus
@@ -1596,15 +3342,161 @@ 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;
@ -2897,7 +2889,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
+ block = wined3d_cs_get_block(cs, list);
+ cs->block_worker = block;
+ }
+ }
}
+ else
+ {
+ block = cs->block_main;
@ -2913,8 +2905,8 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
+ block->pos += size;
+
+ return data;
+}
+
}
+static void wined3d_cs_mt_submit(struct wined3d_cs *cs)
+{
+ struct wined3d_cs_block *block;
@ -2936,9 +2928,9 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
+ if (InterlockedCompareExchange(&cs->waiting_for_event, FALSE, TRUE))
+ SetEvent(cs->event);
+#endif /* STAGING_CSMT */
}
}
+ }
+}
+
+#if !defined(STAGING_CSMT)
static const struct wined3d_cs_ops wined3d_cs_st_ops =
{
@ -3030,7 +3022,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
{
@@ -1614,34 +3514,97 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
@@ -1614,34 +3506,97 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
if (!(cs = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*cs))))
return NULL;
@ -4010,12 +4002,13 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
struct wined3d_texture *texture;
TRACE("device %p, resource %p, sub_resource_idx %u, box %s, data %p, row_pitch %u, depth_pitch %u.\n",
@@ -4202,14 +4571,17 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
@@ -4202,18 +4571,24 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
if (resource->type == WINED3D_RTYPE_BUFFER)
{
+#if !defined(STAGING_CSMT)
struct wined3d_buffer *buffer = buffer_from_resource(resource);
HRESULT hr;
+#endif /* STAGING_CSMT */
if (sub_resource_idx > 0)
@ -4025,12 +4018,8 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
}
+#if !defined(STAGING_CSMT)
context = context_acquire(resource->device, NULL);
if (!wined3d_buffer_load_location(buffer, context, WINED3D_LOCATION_BUFFER))
{
@@ -4221,6 +4593,9 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
wined3d_buffer_invalidate_location(buffer, ~WINED3D_LOCATION_BUFFER);
context_release(context);
if (FAILED(hr = wined3d_buffer_upload_data(buffer, box, data)))
WARN("Failed to update buffer data, hr %#x.\n", hr);
+#else /* STAGING_CSMT */
+ wined3d_cs_emit_update_sub_resource(device->cs, resource, sub_resource_idx, box, data, row_pitch, depth_pitch);
@ -4038,7 +4027,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
return;
}
@@ -4251,6 +4626,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
@@ -4244,6 +4619,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
return;
}
@ -4046,7 +4035,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
addr.buffer_object = 0;
addr.addr = data;
@@ -4270,6 +4646,9 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
@@ -4263,6 +4639,9 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
wined3d_texture_validate_location(texture, sub_resource_idx, WINED3D_LOCATION_TEXTURE_RGB);
wined3d_texture_invalidate_location(texture, sub_resource_idx, ~WINED3D_LOCATION_TEXTURE_RGB);
@ -4056,7 +4045,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
}
HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *device,
@@ -4318,10 +4697,15 @@ HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *devi
@@ -4311,10 +4690,15 @@ HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *devi
return WINED3DERR_INVALIDCALL;
}
@ -4072,7 +4061,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
}
struct wined3d_rendertarget_view * CDECL wined3d_device_get_rendertarget_view(const struct wined3d_device *device,
@@ -4335,20 +4719,31 @@ struct wined3d_rendertarget_view * CDECL wined3d_device_get_rendertarget_view(co
@@ -4328,20 +4712,31 @@ struct wined3d_rendertarget_view * CDECL wined3d_device_get_rendertarget_view(co
return NULL;
}
@ -4104,7 +4093,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
TRACE("device %p, view_idx %u, view %p, set_viewport %#x.\n",
device, view_idx, view, set_viewport);
@@ -4385,13 +4780,21 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device
@@ -4378,13 +4773,21 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device
}
@ -4126,7 +4115,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
wined3d_cs_emit_set_rendertarget_view(device->cs, view_idx, view);
/* Release after the assignment, to prevent device_resource_released()
* from seeing the surface as still in use. */
@@ -4403,18 +4806,29 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device
@@ -4396,18 +4799,29 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device
void CDECL wined3d_device_set_depth_stencil_view(struct wined3d_device *device, struct wined3d_rendertarget_view *view)
{
@ -4156,7 +4145,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
wined3d_rendertarget_view_incref(view);
wined3d_cs_emit_set_depth_stencil_view(device->cs, view);
if (prev)
@@ -4648,19 +5062,26 @@ void CDECL wined3d_device_evict_managed_resources(struct wined3d_device *device)
@@ -4641,19 +5055,26 @@ void CDECL wined3d_device_evict_managed_resources(struct wined3d_device *device)
}
}
@ -4183,7 +4172,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
LIST_FOR_EACH_ENTRY(shader, &device->shaders, struct wined3d_shader, shader_list_entry)
{
device->shader_backend->shader_destroy(shader);
@@ -4692,12 +5113,30 @@ static void delete_opengl_contexts(struct wined3d_device *device, struct wined3d
@@ -4685,12 +5106,30 @@ static void delete_opengl_contexts(struct wined3d_device *device, struct wined3d
HeapFree(GetProcessHeap(), 0, swapchain->context);
swapchain->context = NULL;
@ -4214,7 +4203,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
HRESULT hr;
if (FAILED(hr = device->shader_backend->shader_alloc_private(device,
@@ -4714,6 +5153,7 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, stru
@@ -4707,6 +5146,7 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, stru
return hr;
}
@ -4222,7 +4211,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
/* Recreate the primary swapchain's context */
swapchain->context = HeapAlloc(GetProcessHeap(), 0, sizeof(*swapchain->context));
if (!swapchain->context)
@@ -4726,10 +5166,15 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, stru
@@ -4719,10 +5159,15 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, stru
target = swapchain->back_buffers ? swapchain->back_buffers[0] : swapchain->front_buffer;
if (!(context = context_create(swapchain, target, swapchain->ds_format)))
@ -4238,7 +4227,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
HeapFree(GetProcessHeap(), 0, swapchain->context);
return E_FAIL;
}
@@ -4739,6 +5184,12 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, stru
@@ -4732,6 +5177,12 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, stru
create_dummy_textures(device, context);
create_default_samplers(device, context);
context_release(context);
@ -4251,7 +4240,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
return WINED3D_OK;
}
@@ -4775,10 +5226,16 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
@@ -4768,10 +5219,16 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
wined3d_texture_decref(device->cursor_texture);
device->cursor_texture = NULL;
}
@ -4268,7 +4257,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
{
for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i)
{
@@ -4789,6 +5246,13 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
@@ -4782,6 +5239,13 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
if (reset_state)
{
@ -4282,7 +4271,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
LIST_FOR_EACH_ENTRY_SAFE(resource, cursor, &device->resources, struct wined3d_resource, resource_list_entry)
{
TRACE("Enumerating resource %p.\n", resource);
@@ -4953,27 +5417,48 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
@@ -4946,27 +5410,48 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
if (device->d3d_initialized)
delete_opengl_contexts(device, swapchain);
@ -4331,7 +4320,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
wined3d_cs_emit_set_scissor_rect(device->cs, &state->scissor_rect);
}
@@ -4981,7 +5466,11 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
@@ -4974,7 +5459,11 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
{
if (reset_state)
hr = create_primary_opengl_context(device, swapchain);
@ -4343,7 +4332,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
@@ -5065,11 +5554,19 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso
@@ -5058,11 +5547,19 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso
{
for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i)
{
@ -4363,7 +4352,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
ERR("Resource %p is still in use as depth/stencil buffer.\n", resource);
}
@@ -5195,8 +5692,17 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d,
@@ -5188,8 +5685,17 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d,
device->blitter = adapter->blitter;
@ -4381,7 +4370,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
device->update_state = &device->state;
if (!(device->cs = wined3d_cs_create(device)))
@@ -5290,3 +5796,58 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL
@@ -5283,3 +5789,58 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL
else
return CallWindowProcA(proc, window, message, wparam, lparam);
}

View File

@ -0,0 +1,139 @@
From d9a65443731686d1191b8ddd6c3fa340b4f3f766 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Wed, 8 Feb 2017 19:35:36 +0100
Subject: Revert "wined3d: Implement wined3d_buffer_upload_data() on top of
wined3d_buffer_upload_ranges()."
This reverts commit e2dbbec1af8ae2ea8813148d56e14c8c211ee334.
---
dlls/wined3d/buffer.c | 30 +++++++++++++++++++-----------
dlls/wined3d/device.c | 13 +++----------
dlls/wined3d/wined3d_private.h | 2 +-
3 files changed, 23 insertions(+), 22 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index de5ab17d1d7..e6e4d8379df 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -532,7 +532,7 @@ ULONG CDECL wined3d_buffer_incref(struct wined3d_buffer *buffer)
/* Context activation is done by the caller. */
static void wined3d_buffer_upload_ranges(struct wined3d_buffer *buffer, struct wined3d_context *context,
- const void *data, unsigned int data_offset, unsigned int range_count, const struct wined3d_map_range *ranges)
+ const void *data, unsigned int range_count, const struct wined3d_map_range *ranges)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
const struct wined3d_map_range *range;
@@ -543,7 +543,7 @@ static void wined3d_buffer_upload_ranges(struct wined3d_buffer *buffer, struct w
{
range = &ranges[range_count];
GL_EXTCALL(glBufferSubData(buffer->buffer_type_hint,
- range->offset, range->size, (BYTE *)data + range->offset - data_offset));
+ range->offset, range->size, (BYTE *)data + range->offset));
}
checkGLcall("glBufferSubData");
}
@@ -599,7 +599,7 @@ static void buffer_conversion_upload(struct wined3d_buffer *buffer, struct wined
}
}
- wined3d_buffer_upload_ranges(buffer, context, data, 0, buffer->modified_areas, buffer->maps);
+ wined3d_buffer_upload_ranges(buffer, context, data, buffer->modified_areas, buffer->maps);
HeapFree(GetProcessHeap(), 0, data);
}
@@ -683,7 +683,7 @@ BOOL wined3d_buffer_load_location(struct wined3d_buffer *buffer,
case WINED3D_LOCATION_BUFFER:
if (!buffer->conversion_map)
wined3d_buffer_upload_ranges(buffer, context, buffer->resource.heap_memory,
- 0, buffer->modified_areas, buffer->maps);
+ buffer->modified_areas, buffer->maps);
else
buffer_conversion_upload(buffer, context);
break;
@@ -1267,23 +1267,31 @@ HRESULT wined3d_buffer_copy(struct wined3d_buffer *dst_buffer, unsigned int dst_
return WINED3D_OK;
}
-void wined3d_buffer_upload_data(struct wined3d_buffer *buffer, struct wined3d_context *context,
+HRESULT wined3d_buffer_upload_data(struct wined3d_buffer *buffer,
const struct wined3d_box *box, const void *data)
{
- struct wined3d_map_range range;
+ UINT offset, size;
+ HRESULT hr;
+ BYTE *ptr;
if (box)
{
- range.offset = box->left;
- range.size = box->right - box->left;
+ offset = box->left;
+ size = box->right - box->left;
}
else
{
- range.offset = 0;
- range.size = buffer->resource.size;
+ offset = 0;
+ size = buffer->resource.size;
}
- wined3d_buffer_upload_ranges(buffer, context, data, range.offset, 1, &range);
+ if (FAILED(hr = wined3d_buffer_map(buffer, offset, size, &ptr, 0)))
+ return hr;
+
+ memcpy(ptr, data, size);
+
+ wined3d_buffer_unmap(buffer);
+ return WINED3D_OK;
}
static ULONG buffer_resource_incref(struct wined3d_resource *resource)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 0e969be247e..d2b332e0089 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4078,6 +4078,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
if (resource->type == WINED3D_RTYPE_BUFFER)
{
struct wined3d_buffer *buffer = buffer_from_resource(resource);
+ HRESULT hr;
if (sub_resource_idx > 0)
{
@@ -4085,16 +4086,8 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
return;
}
- context = context_acquire(resource->device, NULL);
- if (!wined3d_buffer_load_location(buffer, context, WINED3D_LOCATION_BUFFER))
- {
- ERR("Failed to load buffer location.\n");
- return;
- }
-
- wined3d_buffer_upload_data(buffer, context, box, data);
- wined3d_buffer_invalidate_location(buffer, ~WINED3D_LOCATION_BUFFER);
- context_release(context);
+ if (FAILED(hr = wined3d_buffer_upload_data(buffer, box, data)))
+ WARN("Failed to update buffer data, hr %#x.\n", hr);
return;
}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 7209ce8d170..3044f16d1ce 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3261,7 +3261,7 @@ BOOL wined3d_buffer_load_location(struct wined3d_buffer *buffer,
BYTE *wined3d_buffer_load_sysmem(struct wined3d_buffer *buffer, struct wined3d_context *context) DECLSPEC_HIDDEN;
HRESULT wined3d_buffer_copy(struct wined3d_buffer *dst_buffer, unsigned int dst_offset,
struct wined3d_buffer *src_buffer, unsigned int src_offset, unsigned int size) DECLSPEC_HIDDEN;
-void wined3d_buffer_upload_data(struct wined3d_buffer *buffer, struct wined3d_context *context,
+HRESULT wined3d_buffer_upload_data(struct wined3d_buffer *buffer,
const struct wined3d_box *box, const void *data) DECLSPEC_HIDDEN;
struct wined3d_rendertarget_view
--
2.11.0

View File

@ -0,0 +1 @@
Fixes: Revert changes to wined3d_buffer_upload_data which cause broken rendering in some apps