Rebase against 6a05069a43f1a8f0e69c4cedd134f8d7400b8a95.

This commit is contained in:
Sebastian Lackner 2017-03-19 01:38:27 +01:00
parent a56b7a18c3
commit 76b749edc9
11 changed files with 397 additions and 940 deletions

View File

@ -52,7 +52,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "a5031391f40c6196b9baccbf69f5ccbe3b59e17c"
echo "6a05069a43f1a8f0e69c4cedd134f8d7400b8a95"
}
# Show version information
@ -8498,10 +8498,8 @@ if test "$enable_wined3d_CSMT_Main" -eq 1; then
printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Send render target view clears through the command stream.", 1 },';
printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Get rid of the end_scene flush and finish.", 1 },';
printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Send update_texture calls through the CS.", 1 },';
printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Send getdc and releasedc through the command stream.", 1 },';
printf '%s\n' '+ { "Sebastian Lackner", "wined3d: Send query_poll through the command stream.", 1 },';
printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Update the swap interval through the CS in reset.", 1 },';
printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Create initial DCs through the CS.", 1 },';
printf '%s\n' '+ { "Nils Kuhnhenn", "wined3d: Fix context_acquire not being called from the command thread in wined3d_texture_add_dirty_region.", 1 },';
printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Wrap GL BOs in a structure.", 1 },';
printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Avoid destroying views in color and depth fills.", 1 },';
@ -8515,7 +8513,6 @@ if test "$enable_wined3d_CSMT_Main" -eq 1; then
printf '%s\n' '+ { "Sebastian Lackner", "wined3d: Use priority queue for query polls.", 1 },';
printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Don'\''t call glFinish before swapping.", 1 },';
printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Use an event to block the worker thread when it is idle.", 1 },';
printf '%s\n' '+ { "Sebastian Lackner", "wined3d: Use priority queue for get_dc / release_dc.", 1 },';
printf '%s\n' '+ { "Sebastian Lackner", "wined3d: Do not immediately submit stateblock updates.", 1 },';
printf '%s\n' '+ { "Sebastian Lackner", "wined3d: Use priority queue for update_sub_resource.", 1 },';
printf '%s\n' '+ { "Michael Müller", "wined3d: Use spin lock for cs list critical sections.", 1 },';

View File

@ -1,4 +1,4 @@
From 94dd5e43f248b35ad24938fbf7422fd455f5185d Mon Sep 17 00:00:00 2001
From d8e7bb3cf2730686403c387bb3ed9b79e513294f Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sun, 19 Feb 2017 00:57:12 +0100
Subject: wined3d: Add additional synchronization CS ops.
@ -7,12 +7,13 @@ Subject: wined3d: Add additional synchronization CS ops.
dlls/wined3d/cs.c | 53 +++++++++++++++++++++++++++++++++++++++---
dlls/wined3d/device.c | 2 ++
dlls/wined3d/swapchain.c | 2 ++
dlls/wined3d/texture.c | 11 +++++++++
dlls/wined3d/view.c | 6 +++++
dlls/wined3d/wined3d_private.h | 3 +++
5 files changed, 63 insertions(+), 3 deletions(-)
6 files changed, 74 insertions(+), 3 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 39071faef32..543528ae570 100644
index f5bf70d2ee..8c0abf449f 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -26,6 +26,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d);
@ -24,7 +25,7 @@ index 39071faef32..543528ae570 100644
WINED3D_CS_OP_PRESENT,
WINED3D_CS_OP_CLEAR,
WINED3D_CS_OP_DISPATCH,
@@ -66,6 +68,16 @@ enum wined3d_cs_op
@@ -67,6 +69,16 @@ enum wined3d_cs_op
WINED3D_CS_OP_UPDATE_SUB_RESOURCE,
};
@ -41,7 +42,7 @@ index 39071faef32..543528ae570 100644
struct wined3d_cs_present
{
enum wined3d_cs_op opcode;
@@ -354,6 +366,38 @@ struct wined3d_cs_update_sub_resource
@@ -369,6 +381,38 @@ struct wined3d_cs_update_sub_resource
struct wined3d_sub_resource_data data;
};
@ -80,7 +81,7 @@ index 39071faef32..543528ae570 100644
static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data)
{
const struct wined3d_cs_present *op = data;
@@ -1628,7 +1672,7 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource,
@@ -1643,7 +1687,7 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource,
op->flags = flags;
op->hr = &hr;
@ -89,7 +90,7 @@ index 39071faef32..543528ae570 100644
return hr;
}
@@ -1652,7 +1696,7 @@ HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resourc
@@ -1667,7 +1711,7 @@ HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resourc
op->sub_resource_idx = sub_resource_idx;
op->hr = &hr;
@ -98,7 +99,7 @@ index 39071faef32..543528ae570 100644
return hr;
}
@@ -1726,11 +1770,13 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r
@@ -1809,11 +1853,13 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r
wined3d_resource_acquire(resource);
@ -113,7 +114,7 @@ index 39071faef32..543528ae570 100644
/* WINED3D_CS_OP_PRESENT */ wined3d_cs_exec_present,
/* WINED3D_CS_OP_CLEAR */ wined3d_cs_exec_clear,
/* WINED3D_CS_OP_DISPATCH */ wined3d_cs_exec_dispatch,
@@ -1862,6 +1908,7 @@ static const struct wined3d_cs_ops wined3d_cs_st_ops =
@@ -1946,6 +1992,7 @@ static const struct wined3d_cs_ops wined3d_cs_st_ops =
{
wined3d_cs_st_require_space,
wined3d_cs_st_submit,
@ -122,10 +123,10 @@ index 39071faef32..543528ae570 100644
};
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 0baf7f1b7cc..ea27553e8c8 100644
index 94879b5de1..e328f32403 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1008,6 +1008,7 @@ static void wined3d_device_delete_opengl_contexts_cs(void *object)
@@ -1029,6 +1029,7 @@ static void wined3d_device_delete_opengl_contexts_cs(void *object)
static void wined3d_device_delete_opengl_contexts(struct wined3d_device *device)
{
wined3d_cs_destroy_object(device->cs, wined3d_device_delete_opengl_contexts_cs, device);
@ -133,7 +134,7 @@ index 0baf7f1b7cc..ea27553e8c8 100644
}
static void wined3d_device_create_primary_opengl_context_cs(void *object)
@@ -1043,6 +1044,7 @@ static void wined3d_device_create_primary_opengl_context_cs(void *object)
@@ -1064,6 +1065,7 @@ static void wined3d_device_create_primary_opengl_context_cs(void *object)
static HRESULT wined3d_device_create_primary_opengl_context(struct wined3d_device *device)
{
wined3d_cs_init_object(device->cs, wined3d_device_create_primary_opengl_context_cs, device);
@ -142,7 +143,7 @@ index 0baf7f1b7cc..ea27553e8c8 100644
return E_FAIL;
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index 25deaeb1ae9..bd23999fb1e 100644
index 25deaeb1ae..bd23999fb1 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -66,6 +66,7 @@ static void swapchain_cleanup(struct wined3d_swapchain *swapchain)
@ -161,8 +162,61 @@ index 25deaeb1ae9..bd23999fb1e 100644
if (!swapchain->context[0])
{
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 91f0cc36ed..0197f6daae 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -1391,6 +1391,7 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT
if (surface->dc)
{
wined3d_cs_destroy_object(device->cs, texture2d_destroy_dc, surface);
+ wined3d_cs_emit_sync(device->cs);
create_dib = TRUE;
}
@@ -1451,7 +1452,10 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT
wined3d_texture_invalidate_location(texture, 0, ~valid_location);
if (create_dib)
+ {
wined3d_cs_init_object(device->cs, texture2d_create_dc, surface);
+ wined3d_cs_emit_sync(device->cs);
+ }
return WINED3D_OK;
}
@@ -2856,6 +2860,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
if ((desc->usage & WINED3DUSAGE_OWNDC) || (device->wined3d->flags & WINED3D_NO3D))
{
wined3d_cs_init_object(device->cs, texture2d_create_dc, surface);
+ wined3d_cs_emit_sync(device->cs);
if (!surface->dc)
{
wined3d_texture_cleanup_sync(texture);
@@ -3653,7 +3658,10 @@ HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned i
return WINED3DERR_INVALIDCALL;
if (!surface->dc)
+ {
wined3d_cs_init_object(device->cs, texture2d_create_dc, surface);
+ wined3d_cs_emit_sync(device->cs);
+ }
if (!surface->dc)
return WINED3DERR_INVALIDCALL;
@@ -3697,7 +3705,10 @@ HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsign
}
if (!(texture->resource.usage & WINED3DUSAGE_OWNDC) && !(device->wined3d->flags & WINED3D_NO3D))
+ {
wined3d_cs_destroy_object(device->cs, texture2d_destroy_dc, surface);
+ wined3d_cs_emit_sync(device->cs);
+ }
--sub_resource->map_count;
if (!--texture->resource.map_count && texture->update_map_binding)
diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c
index 3cd20ea8fad..9b9e7eef4c6 100644
index 3cd20ea8fa..9b9e7eef4c 100644
--- a/dlls/wined3d/view.c
+++ b/dlls/wined3d/view.c
@@ -594,6 +594,8 @@ static void wined3d_shader_resource_view_cs_init(void *object)
@ -200,10 +254,10 @@ index 3cd20ea8fad..9b9e7eef4c6 100644
return WINED3D_OK;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index e8d771ecb32..d2e0052067f 100644
index 987f3dc70b..9918f13f08 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3198,6 +3198,7 @@ struct wined3d_cs_ops
@@ -3209,6 +3209,7 @@ struct wined3d_cs_ops
{
void *(*require_space)(struct wined3d_cs *cs, size_t size);
void (*submit)(struct wined3d_cs *cs);
@ -211,7 +265,7 @@ index e8d771ecb32..d2e0052067f 100644
void (*push_constants)(struct wined3d_cs *cs, enum wined3d_push_constants p,
unsigned int start_idx, unsigned int count, const void *constants);
};
@@ -3224,6 +3225,7 @@ void wined3d_cs_emit_dispatch(struct wined3d_cs *cs,
@@ -3239,6 +3240,7 @@ 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;
@ -219,7 +273,7 @@ index e8d771ecb32..d2e0052067f 100644
void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource) DECLSPEC_HIDDEN;
void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain,
const RECT *src_rect, const RECT *dst_rect, HWND dst_window_override, DWORD flags) DECLSPEC_HIDDEN;
@@ -3275,6 +3277,7 @@ void wined3d_cs_emit_set_unordered_access_view(struct wined3d_cs *cs, enum wined
@@ -3290,6 +3292,7 @@ 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;

View File

@ -1,260 +0,0 @@
From cdbc30321bd78951ffc6e2deaca50b1414ff7abe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Sun, 16 Mar 2014 14:13:42 +0100
Subject: wined3d: Send getdc and releasedc through the command stream.
Another hacky patch to avoid using GL outside the worker thread.
---
dlls/wined3d/cs.c | 60 +++++++++++++++++++++++++++++++
dlls/wined3d/texture.c | 81 +++++++++++++++++++++++++++---------------
dlls/wined3d/wined3d_private.h | 7 ++++
3 files changed, 119 insertions(+), 29 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index bbea6bbb454..2a3a984088d 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -70,6 +70,8 @@ enum wined3d_cs_op
WINED3D_CS_OP_PUSH_CONSTANTS,
WINED3D_CS_OP_CLEAR_RTV,
WINED3D_CS_OP_UPDATE_TEXTURE,
+ WINED3D_CS_OP_GET_DC,
+ WINED3D_CS_OP_RELEASE_DC,
};
struct wined3d_cs_sync
@@ -411,6 +413,14 @@ struct wined3d_cs_update_texture
struct wined3d_texture *src, *dst;
};
+struct wined3d_cs_get_release_dc
+{
+ enum wined3d_cs_op opcode;
+ struct wined3d_texture *texture;
+ unsigned int sub_resource_idx;
+ HRESULT *hr;
+};
+
static void wined3d_cs_exec_sync(struct wined3d_cs *cs, const void *data)
{
}
@@ -2024,6 +2034,54 @@ void wined3d_cs_emit_update_texture(struct wined3d_cs *cs, struct wined3d_textur
cs->ops->submit(cs);
}
+static void wined3d_cs_exec_get_dc(struct wined3d_cs *cs, const void *data)
+{
+ const struct wined3d_cs_get_release_dc *op = data;
+
+ *op->hr = wined3d_texture_get_dc_cs(op->texture, op->sub_resource_idx);
+}
+
+HRESULT wined3d_cs_emit_get_dc(struct wined3d_cs *cs, struct wined3d_texture *texture,
+ unsigned int sub_resource_idx)
+{
+ struct wined3d_cs_get_release_dc *op;
+ HRESULT hr;
+
+ op = cs->ops->require_space(cs, sizeof(*op));
+ op->opcode = WINED3D_CS_OP_GET_DC;
+ op->texture = texture;
+ op->sub_resource_idx = sub_resource_idx;
+ op->hr = &hr;
+
+ cs->ops->submit_and_wait(cs);
+
+ return hr;
+}
+
+static void wined3d_cs_exec_release_dc(struct wined3d_cs *cs, const void *data)
+{
+ const struct wined3d_cs_get_release_dc *op = data;
+
+ *op->hr = wined3d_texture_release_dc_cs(op->texture, op->sub_resource_idx);
+}
+
+HRESULT wined3d_cs_emit_release_dc(struct wined3d_cs *cs, struct wined3d_texture *texture,
+ unsigned int sub_resource_idx)
+{
+ struct wined3d_cs_get_release_dc *op;
+ HRESULT hr;
+
+ op = cs->ops->require_space(cs, sizeof(*op));
+ op->opcode = WINED3D_CS_OP_RELEASE_DC;
+ op->texture = texture;
+ op->sub_resource_idx = sub_resource_idx;
+ op->hr = &hr;
+
+ cs->ops->submit_and_wait(cs);
+
+ return hr;
+}
+
static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_SYNC */ wined3d_cs_exec_sync,
@@ -2070,6 +2128,8 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_PUSH_CONSTANTS */ wined3d_cs_exec_push_constants,
/* WINED3D_CS_OP_CLEAR_RTV */ wined3d_cs_exec_clear_rtv,
/* WINED3D_CS_OP_UPDATE_TEXTURE */ wined3d_cs_exec_update_texture,
+ /* WINED3D_CS_OP_GET_DC */ wined3d_cs_exec_get_dc,
+ /* WINED3D_CS_OP_RELEASE_DC */ wined3d_cs_exec_release_dc,
};
static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size)
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 60e53f55463..b692c504501 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -3509,13 +3509,41 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct
return WINED3D_OK;
}
+HRESULT wined3d_texture_get_dc_cs(struct wined3d_texture *texture, unsigned int sub_resource_idx)
+{
+ struct wined3d_device *device = texture->resource.device;
+ struct wined3d_context *context = NULL;
+ struct wined3d_texture_sub_resource *sub_resource = &texture->sub_resources[sub_resource_idx];
+ struct wined3d_surface *surface = sub_resource->u.surface;
+ HRESULT hr = WINED3D_OK;
+
+ if (device->d3d_initialized)
+ context = context_acquire(device, NULL, 0);
+
+ wined3d_texture_load_location(texture, sub_resource_idx, context, texture->resource.map_binding);
+ wined3d_texture_invalidate_location(texture, sub_resource_idx, ~texture->resource.map_binding);
+
+ if (!surface->dc)
+ hr = wined3d_surface_create_dc(surface);
+ if (context)
+ context_release(context);
+ if (FAILED(hr))
+ return hr;
+
+ if (!(texture->flags & WINED3D_TEXTURE_GET_DC_LENIENT))
+ texture->flags |= WINED3D_TEXTURE_DC_IN_USE;
+ ++texture->resource.map_count;
+ ++sub_resource->map_count;
+
+ return hr;
+}
+
HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned int sub_resource_idx, HDC *dc)
{
struct wined3d_device *device = texture->resource.device;
struct wined3d_texture_sub_resource *sub_resource;
- struct wined3d_context *context = NULL;
struct wined3d_surface *surface;
- HRESULT hr = WINED3D_OK;
+ HRESULT hr;
TRACE("texture %p, sub_resource_idx %u, dc %p.\n", texture, sub_resource_idx, dc);
@@ -3540,28 +3568,32 @@ HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned i
if (texture->resource.map_count && !(texture->flags & WINED3D_TEXTURE_GET_DC_LENIENT))
return WINED3DERR_INVALIDCALL;
- if (device->d3d_initialized)
- context = context_acquire(device, NULL, 0);
-
- wined3d_texture_load_location(texture, sub_resource_idx, context, texture->resource.map_binding);
- wined3d_texture_invalidate_location(texture, sub_resource_idx, ~texture->resource.map_binding);
-
- if (!surface->dc)
- hr = wined3d_surface_create_dc(surface);
- if (context)
- context_release(context);
+ hr = wined3d_cs_emit_get_dc(device->cs, texture, sub_resource_idx);
if (FAILED(hr))
- return WINED3DERR_INVALIDCALL;
-
- if (!(texture->flags & WINED3D_TEXTURE_GET_DC_LENIENT))
- texture->flags |= WINED3D_TEXTURE_DC_IN_USE;
- ++texture->resource.map_count;
- ++sub_resource->map_count;
+ return hr;
*dc = surface->dc;
TRACE("Returning dc %p.\n", *dc);
- return hr;
+ return WINED3D_OK;
+}
+
+HRESULT wined3d_texture_release_dc_cs(struct wined3d_texture *texture, unsigned int sub_resource_idx)
+{
+ struct wined3d_device *device = texture->resource.device;
+ struct wined3d_texture_sub_resource *sub_resource = &texture->sub_resources[sub_resource_idx];
+ struct wined3d_surface *surface = sub_resource->u.surface;
+
+ if (!(texture->resource.usage & WINED3DUSAGE_OWNDC) && !(device->wined3d->flags & WINED3D_NO3D))
+ wined3d_surface_destroy_dc(surface);
+
+ --sub_resource->map_count;
+ if (!--texture->resource.map_count && texture->update_map_binding)
+ wined3d_texture_update_map_binding(texture);
+ if (!(texture->flags & WINED3D_TEXTURE_GET_DC_LENIENT))
+ texture->flags &= ~WINED3D_TEXTURE_DC_IN_USE;
+
+ return WINED3D_OK;
}
HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsigned int sub_resource_idx, HDC dc)
@@ -3592,14 +3624,5 @@ HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsign
return WINED3DERR_INVALIDCALL;
}
- if (!(texture->resource.usage & WINED3DUSAGE_OWNDC) && !(device->wined3d->flags & WINED3D_NO3D))
- wined3d_surface_destroy_dc(surface);
-
- --sub_resource->map_count;
- if (!--texture->resource.map_count && texture->update_map_binding)
- wined3d_texture_update_map_binding(texture);
- if (!(texture->flags & WINED3D_TEXTURE_GET_DC_LENIENT))
- texture->flags &= ~WINED3D_TEXTURE_DC_IN_USE;
-
- return WINED3D_OK;
+ return wined3d_cs_emit_release_dc(device->cs, texture, sub_resource_idx);
}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index fcefe12d226..6373ee3df67 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2948,6 +2948,7 @@ void wined3d_texture_bind_and_dirtify(struct wined3d_texture *texture,
struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN;
HRESULT wined3d_texture_check_box_dimensions(const struct wined3d_texture *texture,
unsigned int level, const struct wined3d_box *box) DECLSPEC_HIDDEN;
+HRESULT wined3d_texture_get_dc_cs(struct wined3d_texture *texture, unsigned int sub_resource_idx) DECLSPEC_HIDDEN;
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;
@@ -2963,6 +2964,8 @@ BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned
struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN;
void wined3d_texture_prepare_texture(struct wined3d_texture *texture,
struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN;
+HRESULT wined3d_texture_release_dc_cs(struct wined3d_texture *texture,
+ unsigned int sub_resource_idx) DECLSPEC_HIDDEN;
void wined3d_texture_set_map_binding(struct wined3d_texture *texture, DWORD map_binding) DECLSPEC_HIDDEN;
void wined3d_texture_set_swapchain(struct wined3d_texture *texture,
struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
@@ -3235,6 +3238,8 @@ 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;
+HRESULT wined3d_cs_emit_get_dc(struct wined3d_cs *cs, struct wined3d_texture *texture,
+ unsigned int sub_resource_idx) DECLSPEC_HIDDEN;
void wined3d_cs_emit_glfinish(struct wined3d_cs *cs) DECLSPEC_HIDDEN;
void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource) DECLSPEC_HIDDEN;
void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain,
@@ -3242,6 +3247,8 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw
void wined3d_cs_emit_push_constants(struct wined3d_cs *cs, enum wined3d_push_constants p,
unsigned int start_idx, unsigned int count, const void *constants) DECLSPEC_HIDDEN;
void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *query, DWORD flags) DECLSPEC_HIDDEN;
+HRESULT wined3d_cs_emit_release_dc(struct wined3d_cs *cs, struct wined3d_texture *texture,
+ unsigned int sub_resource_idx) DECLSPEC_HIDDEN;
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;
--
2.11.0

View File

@ -1,4 +1,4 @@
From 9708948e10b9272abae5a4ffdad1b2e1be4b2dd4 Mon Sep 17 00:00:00 2001
From 644d2723fdf8d547bf5a0a4c43d119b6801dac77 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sun, 19 Feb 2017 01:58:25 +0100
Subject: wined3d: Send query_poll through the command stream.
@ -10,10 +10,10 @@ Subject: wined3d: Send query_poll through the command stream.
3 files changed, 36 insertions(+), 1 deletion(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 29b27176d34..81deae77363 100644
index bbea6bbb45..6d01424bda 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -59,6 +59,7 @@ enum wined3d_cs_op
@@ -61,6 +61,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_RESET_STATE,
WINED3D_CS_OP_CALLBACK,
WINED3D_CS_OP_QUERY_ISSUE,
@ -21,7 +21,7 @@ index 29b27176d34..81deae77363 100644
WINED3D_CS_OP_PRELOAD_RESOURCE,
WINED3D_CS_OP_UNLOAD_RESOURCE,
WINED3D_CS_OP_MAP,
@@ -319,6 +320,14 @@ struct wined3d_cs_query_issue
@@ -330,6 +331,14 @@ struct wined3d_cs_query_issue
DWORD flags;
};
@ -36,7 +36,7 @@ index 29b27176d34..81deae77363 100644
struct wined3d_cs_preload_resource
{
enum wined3d_cs_op opcode;
@@ -1584,6 +1593,30 @@ void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *qu
@@ -1665,6 +1674,30 @@ void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *qu
cs->ops->submit(cs);
}
@ -67,7 +67,7 @@ index 29b27176d34..81deae77363 100644
static void wined3d_cs_exec_preload_resource(struct wined3d_cs *cs, const void *data)
{
const struct wined3d_cs_preload_resource *op = data;
@@ -2087,6 +2120,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
@@ -2061,6 +2094,7 @@ 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,
@ -76,7 +76,7 @@ index 29b27176d34..81deae77363 100644
/* WINED3D_CS_OP_UNLOAD_RESOURCE */ wined3d_cs_exec_unload_resource,
/* WINED3D_CS_OP_MAP */ wined3d_cs_exec_map,
diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c
index bc3b15f30dd..15935ab4469 100644
index bc3b15f30d..15935ab446 100644
--- a/dlls/wined3d/query.c
+++ b/dlls/wined3d/query.c
@@ -350,7 +350,7 @@ HRESULT CDECL wined3d_query_get_data(struct wined3d_query *query,
@ -89,17 +89,17 @@ index bc3b15f30dd..15935ab4469 100644
if (data)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index da3ee393739..91b2215f287 100644
index 9301d10999..9d25bae822 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3220,6 +3220,7 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw
@@ -3252,6 +3252,7 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw
void wined3d_cs_emit_push_constants(struct wined3d_cs *cs, enum wined3d_push_constants p,
unsigned int start_idx, unsigned int count, const void *constants) DECLSPEC_HIDDEN;
void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *query, DWORD flags) DECLSPEC_HIDDEN;
+BOOL wined3d_cs_emit_query_poll(struct wined3d_cs *cs, struct wined3d_query *query, DWORD flags) DECLSPEC_HIDDEN;
HRESULT wined3d_cs_emit_release_dc(struct wined3d_cs *cs, struct wined3d_texture *texture,
unsigned int sub_resource_idx) DECLSPEC_HIDDEN;
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;
--
2.11.0

View File

@ -1,4 +1,4 @@
From 6f0d725b9aad64432838ef31d2d4a69336a4839d Mon Sep 17 00:00:00 2001
From d3e3b9bf7f27aa281a7e930f70018006ca20258e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefandoesinger@gmx.at>
Date: Sat, 7 May 2016 21:58:06 +0100
Subject: wined3d: Update the swap interval through the CS in reset.
@ -10,19 +10,19 @@ Subject: wined3d: Update the swap interval through the CS in reset.
3 files changed, 28 insertions(+), 1 deletion(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 07fccb41bfd..53883ff103c 100644
index 6d01424bda..1da3addcdd 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -73,6 +73,7 @@ enum wined3d_cs_op
@@ -71,6 +71,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_PUSH_CONSTANTS,
WINED3D_CS_OP_CLEAR_RTV,
WINED3D_CS_OP_UPDATE_TEXTURE,
WINED3D_CS_OP_GET_DC,
WINED3D_CS_OP_RELEASE_DC,
+ WINED3D_CS_OP_UPDATE_SWAP_INTERVAL,
};
struct wined3d_cs_sync
@@ -428,6 +429,12 @@ struct wined3d_cs_get_release_dc
HRESULT *hr;
@@ -420,6 +421,12 @@ struct wined3d_cs_update_texture
struct wined3d_texture *src, *dst;
};
+struct wined3d_cs_update_swap_interval
@ -34,8 +34,8 @@ index 07fccb41bfd..53883ff103c 100644
static void wined3d_cs_exec_sync(struct wined3d_cs *cs, const void *data)
{
}
@@ -2083,6 +2090,24 @@ HRESULT wined3d_cs_emit_release_dc(struct wined3d_cs *cs, struct wined3d_texture
return hr;
@@ -2057,6 +2064,24 @@ void wined3d_cs_emit_update_texture(struct wined3d_cs *cs, struct wined3d_textur
cs->ops->submit(cs);
}
+static void wined3d_cs_exec_update_swap_interval(struct wined3d_cs *cs, const void *data)
@ -59,19 +59,19 @@ index 07fccb41bfd..53883ff103c 100644
static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_SYNC */ wined3d_cs_exec_sync,
@@ -2132,6 +2157,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
@@ -2104,6 +2129,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_PUSH_CONSTANTS */ wined3d_cs_exec_push_constants,
/* WINED3D_CS_OP_CLEAR_RTV */ wined3d_cs_exec_clear_rtv,
/* WINED3D_CS_OP_UPDATE_TEXTURE */ wined3d_cs_exec_update_texture,
/* WINED3D_CS_OP_GET_DC */ wined3d_cs_exec_get_dc,
/* WINED3D_CS_OP_RELEASE_DC */ wined3d_cs_exec_release_dc,
+ /* WINED3D_CS_OP_UPDATE_SWAP_INTERVAL */ wined3d_cs_exec_update_swap_interval,
};
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 d244091782f..d0af77483e7 100644
index eb8c86f954..bf48c71564 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4833,7 +4833,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
@@ -4907,7 +4907,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
{
if (reset_state)
hr = wined3d_device_create_primary_opengl_context(device);
@ -81,10 +81,10 @@ index d244091782f..d0af77483e7 100644
/* All done. There is no need to reload resources or shaders, this will happen automatically on the
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 05c1b2d32a3..b8f2ade12dd 100644
index 9d25bae822..b5a27dcbac 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3304,6 +3304,7 @@ void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resou
@@ -3305,6 +3305,7 @@ 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,49 +0,0 @@
From 2aadab885c6dca2c21e7c7e598205d5e771f6538 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefandoesinger@gmx.at>
Date: Sat, 7 May 2016 22:31:28 +0100
Subject: wined3d: Create initial DCs through the CS.
---
dlls/wined3d/texture.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 2360c589902..70c4590f74a 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -1314,7 +1314,11 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT
wined3d_texture_invalidate_location(texture, 0, ~valid_location);
if (create_dib)
- wined3d_surface_create_dc(surface);
+ {
+ HDC dc;
+ wined3d_texture_get_dc(texture, 0, &dc);
+ wined3d_texture_release_dc(texture, 0, dc);
+ }
return WINED3D_OK;
}
@@ -2729,11 +2733,15 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
TRACE("Created surface level %u, layer %u @ %p.\n", i, j, surface);
- if (((desc->usage & WINED3DUSAGE_OWNDC) || (device->wined3d->flags & WINED3D_NO3D))
- && FAILED(hr = wined3d_surface_create_dc(surface)))
+ if ((desc->usage & WINED3DUSAGE_OWNDC) || (device->wined3d->flags & WINED3D_NO3D))
{
- wined3d_texture_cleanup_sync(texture);
- return hr;
+ HDC dc;
+ if (FAILED(hr = wined3d_texture_get_dc(texture, idx, &dc)))
+ {
+ wined3d_texture_cleanup_sync(texture);
+ return hr;
+ }
+ wined3d_texture_release_dc(texture, idx, dc);
}
}
}
--
2.11.0

View File

@ -1,4 +1,4 @@
From d8510f1a77606628c1868332f11f5dd8ec90f82e Mon Sep 17 00:00:00 2001
From b3788f5f7f5a57baeb565e5d3a08cfaf263de01e Mon Sep 17 00:00:00 2001
From: Nils Kuhnhenn <nils@volafile.io>
Date: Fri, 5 Aug 2016 20:28:46 +0200
Subject: wined3d: Fix context_acquire not being called from the command thread
@ -11,18 +11,18 @@ Subject: wined3d: Fix context_acquire not being called from the command thread
3 files changed, 51 insertions(+), 14 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 770760f78c7..8b13ca2f792 100644
index 1da3addcdd..d0c0d94537 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -74,6 +74,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_GET_DC,
WINED3D_CS_OP_RELEASE_DC,
@@ -72,6 +72,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_CLEAR_RTV,
WINED3D_CS_OP_UPDATE_TEXTURE,
WINED3D_CS_OP_UPDATE_SWAP_INTERVAL,
+ WINED3D_CS_OP_TEXTURE_ADD_DIRTY_REGION,
};
struct wined3d_cs_sync
@@ -435,6 +436,13 @@ struct wined3d_cs_update_swap_interval
@@ -427,6 +428,13 @@ struct wined3d_cs_update_swap_interval
struct wined3d_swapchain *swapchain;
};
@ -36,7 +36,7 @@ index 770760f78c7..8b13ca2f792 100644
static void wined3d_cs_exec_sync(struct wined3d_cs *cs, const void *data)
{
}
@@ -2092,6 +2100,45 @@ void wined3d_cs_emit_update_swap_interval(struct wined3d_cs *cs, struct wined3d_
@@ -2082,6 +2090,45 @@ void wined3d_cs_emit_update_swap_interval(struct wined3d_cs *cs, struct wined3d_
cs->ops->submit_and_wait(cs);
}
@ -82,19 +82,19 @@ index 770760f78c7..8b13ca2f792 100644
static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_SYNC */ wined3d_cs_exec_sync,
@@ -2142,6 +2189,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_GET_DC */ wined3d_cs_exec_get_dc,
/* WINED3D_CS_OP_RELEASE_DC */ wined3d_cs_exec_release_dc,
@@ -2130,6 +2177,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_CLEAR_RTV */ wined3d_cs_exec_clear_rtv,
/* WINED3D_CS_OP_UPDATE_TEXTURE */ wined3d_cs_exec_update_texture,
/* WINED3D_CS_OP_UPDATE_SWAP_INTERVAL */ wined3d_cs_exec_update_swap_interval,
+ /* WINED3D_CS_OP_TEXTURE_ADD_DIRTY_REGION */ wined3d_cs_exec_texture_add_dirty_region,
};
static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size)
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index baecda0b9ed..4c6a8e96611 100644
index 41da65112d..7edb214c2a 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -1523,7 +1523,6 @@ struct wined3d_texture_sub_resource *wined3d_texture_get_sub_resource(struct win
@@ -1658,7 +1658,6 @@ static struct wined3d_texture_sub_resource *wined3d_texture_get_sub_resource(str
HRESULT CDECL wined3d_texture_add_dirty_region(struct wined3d_texture *texture,
UINT layer, const struct wined3d_box *dirty_region)
{
@ -102,7 +102,7 @@ index baecda0b9ed..4c6a8e96611 100644
unsigned int sub_resource_idx;
TRACE("texture %p, layer %u, dirty_region %s.\n", texture, layer, debug_box(dirty_region));
@@ -1535,19 +1534,7 @@ HRESULT CDECL wined3d_texture_add_dirty_region(struct wined3d_texture *texture,
@@ -1670,19 +1669,7 @@ HRESULT CDECL wined3d_texture_add_dirty_region(struct wined3d_texture *texture,
}
sub_resource_idx = layer * texture->level_count;
@ -124,10 +124,10 @@ index baecda0b9ed..4c6a8e96611 100644
}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 6e215b8f2c4..efa3b879098 100644
index b5a27dcbac..c846148069 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3296,6 +3296,8 @@ void wined3d_cs_emit_set_unordered_access_view(struct wined3d_cs *cs, enum wined
@@ -3300,6 +3300,8 @@ 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;

View File

@ -1,56 +0,0 @@
From 125cc8384a0f759df49cbf0e753877c3057ba2d1 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Wed, 8 Feb 2017 11:57:52 +0100
Subject: wined3d: Use priority queue for get_dc / release_dc.
---
dlls/wined3d/cs.c | 4 ++--
dlls/wined3d/texture.c | 4 ++++
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 1c9d8e1d192..1d2d9d7b990 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -2210,7 +2210,7 @@ HRESULT wined3d_cs_emit_get_dc(struct wined3d_cs *cs, struct wined3d_texture *te
struct wined3d_cs_get_release_dc *op;
HRESULT hr;
- op = cs->ops->require_space(cs, sizeof(*op), 0);
+ op = cs->ops->require_space(cs, sizeof(*op), 1);
op->opcode = WINED3D_CS_OP_GET_DC;
op->texture = texture;
op->sub_resource_idx = sub_resource_idx;
@@ -2236,7 +2236,7 @@ HRESULT wined3d_cs_emit_release_dc(struct wined3d_cs *cs, struct wined3d_texture
struct wined3d_cs_get_release_dc *op;
HRESULT hr;
- op = cs->ops->require_space(cs, sizeof(*op), 0);
+ op = cs->ops->require_space(cs, sizeof(*op), 1);
op->opcode = WINED3D_CS_OP_RELEASE_DC;
op->texture = texture;
op->sub_resource_idx = sub_resource_idx;
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index bff7452e773..18ae2ae23cf 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -3536,6 +3536,8 @@ HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned i
if (texture->resource.map_count && !(texture->flags & WINED3D_TEXTURE_GET_DC_LENIENT))
return WINED3DERR_INVALIDCALL;
+ wined3d_resource_wait_idle(&texture->resource);
+
hr = wined3d_cs_emit_get_dc(device->cs, texture, sub_resource_idx);
if (FAILED(hr))
return hr;
@@ -3592,5 +3594,7 @@ HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsign
return WINED3DERR_INVALIDCALL;
}
+ wined3d_resource_wait_idle(&texture->resource);
+
return wined3d_cs_emit_release_dc(device->cs, texture, sub_resource_idx);
}
--
2.11.0

File diff suppressed because it is too large Load Diff