You've already forked wine-staging
mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-09-12 18:50:20 -07:00
Rebase against b1203af6ba44ff8858ee9ca50fc05f4f3f633892.
This commit is contained in:
@@ -1,135 +1,18 @@
|
||||
From fdbfdf6df22ea87be4390c3d8913417b6177cbd7 Mon Sep 17 00:00:00 2001
|
||||
From caad9fff0e12134e72b964f7a9bcd2924e25709c 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.
|
||||
|
||||
---
|
||||
dlls/wined3d/cs.c | 51 ++++++++++++++++++++++++++++++++++++------
|
||||
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 +++
|
||||
6 files changed, 68 insertions(+), 7 deletions(-)
|
||||
dlls/wined3d/cs.c | 8 ++++----
|
||||
dlls/wined3d/view.c | 6 ++++++
|
||||
2 files changed, 10 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
|
||||
index b4e819cf01..833ab4b4c1 100644
|
||||
index 7331f31dd3f..5daff0c96fd 100644
|
||||
--- a/dlls/wined3d/cs.c
|
||||
+++ b/dlls/wined3d/cs.c
|
||||
@@ -31,6 +31,7 @@ enum wined3d_cs_op
|
||||
WINED3D_CS_OP_CLEAR,
|
||||
WINED3D_CS_OP_DISPATCH,
|
||||
WINED3D_CS_OP_DRAW,
|
||||
+ WINED3D_CS_OP_FINISH,
|
||||
WINED3D_CS_OP_FLUSH,
|
||||
WINED3D_CS_OP_SET_PREDICATION,
|
||||
WINED3D_CS_OP_SET_VIEWPORT,
|
||||
@@ -127,6 +128,11 @@ struct wined3d_cs_draw
|
||||
BOOL indexed;
|
||||
};
|
||||
|
||||
+struct wined3d_cs_finish
|
||||
+{
|
||||
+ enum wined3d_cs_op opcode;
|
||||
+};
|
||||
+
|
||||
struct wined3d_cs_flush
|
||||
{
|
||||
enum wined3d_cs_op opcode;
|
||||
@@ -418,6 +424,16 @@ static void wined3d_cs_exec_nop(struct wined3d_cs *cs, const void *data)
|
||||
{
|
||||
}
|
||||
|
||||
+void wined3d_cs_emit_sync(struct wined3d_cs *cs)
|
||||
+{
|
||||
+ struct wined3d_cs_nop *op;
|
||||
+
|
||||
+ op = cs->ops->require_space(cs, sizeof(*op));
|
||||
+ op->opcode = WINED3D_CS_OP_NOP;
|
||||
+
|
||||
+ cs->ops->submit_and_wait(cs);
|
||||
+}
|
||||
+
|
||||
static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data)
|
||||
{
|
||||
const struct wined3d_cs_present *op = data;
|
||||
@@ -797,6 +813,24 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, GLenum primitive_type, int base
|
||||
cs->ops->submit(cs);
|
||||
}
|
||||
|
||||
+static void wined3d_cs_exec_finish(struct wined3d_cs *cs, const void *data)
|
||||
+{
|
||||
+ struct wined3d_context *context = context_get_current();
|
||||
+
|
||||
+ if (context)
|
||||
+ context->gl_info->gl_ops.gl.p_glFinish();
|
||||
+}
|
||||
+
|
||||
+void wined3d_cs_emit_finish(struct wined3d_cs *cs)
|
||||
+{
|
||||
+ struct wined3d_cs_finish *op;
|
||||
+
|
||||
+ op = cs->ops->require_space(cs, sizeof(*op));
|
||||
+ op->opcode = WINED3D_CS_OP_FINISH;
|
||||
+
|
||||
+ cs->ops->submit_and_wait(cs);
|
||||
+}
|
||||
+
|
||||
static void wined3d_cs_exec_flush(struct wined3d_cs *cs, const void *data)
|
||||
{
|
||||
struct wined3d_context *context;
|
||||
@@ -1865,7 +1899,7 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource,
|
||||
op->flags = flags;
|
||||
op->hr = &hr;
|
||||
|
||||
- cs->ops->submit(cs);
|
||||
+ cs->ops->submit_and_wait(cs);
|
||||
|
||||
return hr;
|
||||
}
|
||||
@@ -1889,7 +1923,7 @@ HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resourc
|
||||
op->sub_resource_idx = sub_resource_idx;
|
||||
op->hr = &hr;
|
||||
|
||||
- cs->ops->submit(cs);
|
||||
+ cs->ops->submit_and_wait(cs);
|
||||
|
||||
return hr;
|
||||
}
|
||||
@@ -2111,7 +2145,7 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r
|
||||
|
||||
wined3d_resource_acquire(resource);
|
||||
|
||||
- cs->ops->submit(cs);
|
||||
+ cs->ops->submit_and_wait(cs);
|
||||
}
|
||||
|
||||
static void wined3d_cs_exec_add_dirty_texture_region(struct wined3d_cs *cs, const void *data)
|
||||
@@ -2167,6 +2201,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
|
||||
/* WINED3D_CS_OP_CLEAR */ wined3d_cs_exec_clear,
|
||||
/* WINED3D_CS_OP_DISPATCH */ wined3d_cs_exec_dispatch,
|
||||
/* WINED3D_CS_OP_DRAW */ wined3d_cs_exec_draw,
|
||||
+ /* WINED3D_CS_OP_FINISH */ wined3d_cs_exec_finish,
|
||||
/* WINED3D_CS_OP_FLUSH */ wined3d_cs_exec_flush,
|
||||
/* WINED3D_CS_OP_SET_PREDICATION */ wined3d_cs_exec_set_predication,
|
||||
/* WINED3D_CS_OP_SET_VIEWPORT */ wined3d_cs_exec_set_viewport,
|
||||
@@ -2258,6 +2293,7 @@ static const struct wined3d_cs_ops wined3d_cs_st_ops =
|
||||
{
|
||||
wined3d_cs_st_require_space,
|
||||
wined3d_cs_st_submit,
|
||||
+ wined3d_cs_st_submit,
|
||||
wined3d_cs_st_push_constants,
|
||||
};
|
||||
|
||||
@@ -2355,6 +2391,7 @@ static const struct wined3d_cs_ops wined3d_cs_mt_ops =
|
||||
{
|
||||
wined3d_cs_mt_require_space,
|
||||
wined3d_cs_mt_submit,
|
||||
+ wined3d_cs_mt_submit,
|
||||
wined3d_cs_mt_push_constants,
|
||||
};
|
||||
|
||||
@@ -2504,10 +2541,6 @@ fail:
|
||||
@@ -2554,10 +2554,6 @@ fail:
|
||||
|
||||
void wined3d_cs_destroy(struct wined3d_cs *cs)
|
||||
{
|
||||
@@ -140,7 +23,7 @@ index b4e819cf01..833ab4b4c1 100644
|
||||
if (cs->thread)
|
||||
{
|
||||
wined3d_cs_emit_stop(cs);
|
||||
@@ -2516,5 +2549,9 @@ void wined3d_cs_destroy(struct wined3d_cs *cs)
|
||||
@@ -2566,5 +2562,9 @@ void wined3d_cs_destroy(struct wined3d_cs *cs)
|
||||
ERR("Closing event failed.\n");
|
||||
}
|
||||
|
||||
@@ -150,104 +33,11 @@ index b4e819cf01..833ab4b4c1 100644
|
||||
+
|
||||
HeapFree(GetProcessHeap(), 0, cs);
|
||||
}
|
||||
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
|
||||
index c86d243c00..22e474303b 100644
|
||||
--- a/dlls/wined3d/device.c
|
||||
+++ b/dlls/wined3d/device.c
|
||||
@@ -1023,6 +1023,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);
|
||||
+ wined3d_cs_emit_sync(device->cs);
|
||||
}
|
||||
|
||||
static void wined3d_device_create_primary_opengl_context_cs(void *object)
|
||||
@@ -1061,6 +1062,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);
|
||||
+ wined3d_cs_emit_sync(device->cs);
|
||||
if (!device->swapchains[0]->num_contexts)
|
||||
return E_FAIL;
|
||||
|
||||
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
|
||||
index 3be9a92a06..5482e3024e 100644
|
||||
--- a/dlls/wined3d/swapchain.c
|
||||
+++ b/dlls/wined3d/swapchain.c
|
||||
@@ -66,6 +66,7 @@ static void swapchain_cleanup(struct wined3d_swapchain *swapchain)
|
||||
}
|
||||
|
||||
wined3d_cs_destroy_object(swapchain->device->cs, wined3d_swapchain_destroy_object, swapchain);
|
||||
+ wined3d_cs_emit_sync(swapchain->device->cs);
|
||||
|
||||
/* Restore the screen resolution if we rendered in fullscreen.
|
||||
* This will restore the screen resolution to what it was before creating
|
||||
@@ -900,6 +901,7 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3
|
||||
}
|
||||
|
||||
wined3d_cs_init_object(device->cs, wined3d_swapchain_cs_init, swapchain);
|
||||
+ wined3d_cs_emit_sync(device->cs);
|
||||
|
||||
if (!swapchain->context[0])
|
||||
{
|
||||
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
|
||||
index 288ef8078a..c259bbfe8c 100644
|
||||
--- a/dlls/wined3d/texture.c
|
||||
+++ b/dlls/wined3d/texture.c
|
||||
@@ -1387,6 +1387,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;
|
||||
}
|
||||
|
||||
@@ -1447,7 +1448,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;
|
||||
}
|
||||
@@ -2840,6 +2844,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);
|
||||
@@ -3627,7 +3632,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;
|
||||
|
||||
@@ -3671,7 +3679,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 dc225f4f81..cd09c9c8ee 100644
|
||||
index 0a458803a72..0184b21cdb9 100644
|
||||
--- a/dlls/wined3d/view.c
|
||||
+++ b/dlls/wined3d/view.c
|
||||
@@ -632,6 +632,8 @@ static void wined3d_shader_resource_view_cs_init(void *object)
|
||||
@@ -716,6 +716,8 @@ static void wined3d_shader_resource_view_cs_init(void *object)
|
||||
debug_d3dformat(resource->format->id), debug_d3dformat(view_format->id));
|
||||
}
|
||||
}
|
||||
@@ -256,7 +46,7 @@ index dc225f4f81..cd09c9c8ee 100644
|
||||
}
|
||||
|
||||
static HRESULT wined3d_shader_resource_view_init(struct wined3d_shader_resource_view *view,
|
||||
@@ -648,6 +650,7 @@ static HRESULT wined3d_shader_resource_view_init(struct wined3d_shader_resource_
|
||||
@@ -732,6 +734,7 @@ static HRESULT wined3d_shader_resource_view_init(struct wined3d_shader_resource_
|
||||
|
||||
wined3d_resource_incref(view->resource = resource);
|
||||
|
||||
@@ -264,7 +54,7 @@ index dc225f4f81..cd09c9c8ee 100644
|
||||
wined3d_cs_init_object(resource->device->cs, wined3d_shader_resource_view_cs_init, view);
|
||||
|
||||
return WINED3D_OK;
|
||||
@@ -829,6 +832,8 @@ static void wined3d_unordered_access_view_cs_init(void *object)
|
||||
@@ -898,6 +901,8 @@ static void wined3d_unordered_access_view_cs_init(void *object)
|
||||
desc, texture, view->format);
|
||||
}
|
||||
}
|
||||
@@ -273,7 +63,7 @@ index dc225f4f81..cd09c9c8ee 100644
|
||||
}
|
||||
|
||||
static HRESULT wined3d_unordered_access_view_init(struct wined3d_unordered_access_view *view,
|
||||
@@ -848,6 +853,7 @@ static HRESULT wined3d_unordered_access_view_init(struct wined3d_unordered_acces
|
||||
@@ -917,6 +922,7 @@ static HRESULT wined3d_unordered_access_view_init(struct wined3d_unordered_acces
|
||||
|
||||
wined3d_resource_incref(view->resource = resource);
|
||||
|
||||
@@ -281,34 +71,6 @@ index dc225f4f81..cd09c9c8ee 100644
|
||||
wined3d_cs_init_object(resource->device->cs, wined3d_unordered_access_view_cs_init, view);
|
||||
|
||||
return WINED3D_OK;
|
||||
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
|
||||
index df8427d1b7..de832d8125 100644
|
||||
--- a/dlls/wined3d/wined3d_private.h
|
||||
+++ b/dlls/wined3d/wined3d_private.h
|
||||
@@ -3248,6 +3248,7 @@ struct wined3d_cs_ops
|
||||
{
|
||||
void *(*require_space)(struct wined3d_cs *cs, size_t size);
|
||||
void (*submit)(struct wined3d_cs *cs);
|
||||
+ void (*submit_and_wait)(struct wined3d_cs *cs);
|
||||
void (*push_constants)(struct wined3d_cs *cs, enum wined3d_push_constants p,
|
||||
unsigned int start_idx, unsigned int count, const void *constants);
|
||||
};
|
||||
@@ -3289,6 +3290,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;
|
||||
+void wined3d_cs_emit_finish(struct wined3d_cs *cs) DECLSPEC_HIDDEN;
|
||||
void wined3d_cs_emit_flush(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,
|
||||
@@ -3341,6 +3343,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;
|
||||
+void wined3d_cs_emit_sync(struct wined3d_cs *cs);
|
||||
void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource) DECLSPEC_HIDDEN;
|
||||
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,
|
||||
--
|
||||
2.12.2
|
||||
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
From b53b6032e3923711099eb7aaf6d1cedbd0c3a866 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
|
||||
Date: Wed, 10 Apr 2013 19:10:41 +0200
|
||||
Subject: wined3d: Prevent the command stream from running ahead too far
|
||||
|
||||
---
|
||||
dlls/wined3d/cs.c | 16 ++++++++++++++++
|
||||
dlls/wined3d/wined3d_private.h | 2 ++
|
||||
2 files changed, 18 insertions(+)
|
||||
|
||||
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
|
||||
index 96c88f068b..f7d8f86d5c 100644
|
||||
--- a/dlls/wined3d/cs.c
|
||||
+++ b/dlls/wined3d/cs.c
|
||||
@@ -445,6 +445,8 @@ static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data)
|
||||
|
||||
swapchain->swapchain_ops->swapchain_present(swapchain, &op->src_rect, &op->dst_rect, op->flags);
|
||||
|
||||
+ InterlockedDecrement(&cs->pending_presents);
|
||||
+
|
||||
wined3d_resource_release(&swapchain->front_buffer->resource);
|
||||
for (i = 0; i < swapchain->desc.backbuffer_count; ++i)
|
||||
{
|
||||
@@ -457,6 +459,7 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw
|
||||
{
|
||||
struct wined3d_cs_present *op;
|
||||
unsigned int i;
|
||||
+ LONG pending;
|
||||
|
||||
op = cs->ops->require_space(cs, sizeof(*op));
|
||||
op->opcode = WINED3D_CS_OP_PRESENT;
|
||||
@@ -472,7 +475,20 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw
|
||||
wined3d_resource_acquire(&swapchain->back_buffers[i]->resource);
|
||||
}
|
||||
|
||||
+ pending = InterlockedIncrement(&cs->pending_presents);
|
||||
+
|
||||
cs->ops->submit(cs);
|
||||
+
|
||||
+ /* D3D10 documentation suggests that Windows allows the game to run
|
||||
+ * 3 frames ahead of the GPU. Increasing this above 1 causes uneven
|
||||
+ * animation in some games, most notably StarCraft II. The framerates
|
||||
+ * don't show this problem. The issue is more noticable with vsync
|
||||
+ * on, but also happens with vsync off.
|
||||
+ *
|
||||
+ * In Counter-Strike: Source a frame difference of 3 causes noticable
|
||||
+ * input delay that makes the game unplayable. */
|
||||
+ while (pending > 1)
|
||||
+ pending = InterlockedCompareExchange(&cs->pending_presents, 0, 0);
|
||||
}
|
||||
|
||||
static void wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data)
|
||||
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
|
||||
index de832d8125..0001cffc12 100644
|
||||
--- a/dlls/wined3d/wined3d_private.h
|
||||
+++ b/dlls/wined3d/wined3d_private.h
|
||||
@@ -3269,6 +3269,8 @@ struct wined3d_cs
|
||||
|
||||
HANDLE event;
|
||||
BOOL waiting_for_event;
|
||||
+
|
||||
+ LONG pending_presents;
|
||||
};
|
||||
|
||||
struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) DECLSPEC_HIDDEN;
|
||||
--
|
||||
2.12.2
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
From bc0a87c3b6553fae719b2181bc878e8b9e59838c Mon Sep 17 00:00:00 2001
|
||||
From ee2d4cc10c524a813e4eefcf3935c63479bb84be Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
|
||||
Date: Mon, 29 Apr 2013 18:49:53 +0200
|
||||
Subject: wined3d: Send blits through the command stream.
|
||||
@@ -6,15 +6,15 @@ Subject: wined3d: Send blits through the command stream.
|
||||
This needs more work. This patch breaks error handling, and the split
|
||||
between surface_blt and surface_blt_ugly isn't particularly nice.
|
||||
---
|
||||
dlls/wined3d/device.c | 18 +++++++++---------
|
||||
dlls/wined3d/texture.c | 9 +++++++--
|
||||
2 files changed, 16 insertions(+), 11 deletions(-)
|
||||
dlls/wined3d/device.c | 19 ++++++++++---------
|
||||
dlls/wined3d/texture.c | 10 ++++++++--
|
||||
2 files changed, 18 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
|
||||
index 8fced7ece3..9dc893bfeb 100644
|
||||
index cbb0406dccf..613df2077a5 100644
|
||||
--- a/dlls/wined3d/device.c
|
||||
+++ b/dlls/wined3d/device.c
|
||||
@@ -4148,16 +4148,16 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev
|
||||
@@ -4199,16 +4199,17 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,8 @@ index 8fced7ece3..9dc893bfeb 100644
|
||||
- {
|
||||
- WARN("Source sub-resource %u is mapped.\n", src_sub_resource_idx);
|
||||
- return WINED3DERR_INVALIDCALL;
|
||||
+ wined3d_cs_emit_sync(dst_texture->resource.device->cs);
|
||||
+ struct wined3d_device *device = dst_texture->resource.device;
|
||||
+ device->cs->ops->finish(device->cs);
|
||||
+ if (dst_texture->sub_resources[dst_sub_resource_idx].map_count ||
|
||||
+ src_texture->sub_resources[src_sub_resource_idx].map_count)
|
||||
+ {
|
||||
@@ -41,16 +42,17 @@ index 8fced7ece3..9dc893bfeb 100644
|
||||
|
||||
if (!src_box)
|
||||
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
|
||||
index 8a92a77872..2b249c26c0 100644
|
||||
index ebc317bd43d..d43ee068a30 100644
|
||||
--- a/dlls/wined3d/texture.c
|
||||
+++ b/dlls/wined3d/texture.c
|
||||
@@ -3301,8 +3301,13 @@ HRESULT CDECL wined3d_texture_blt(struct wined3d_texture *dst_texture, unsigned
|
||||
@@ -3231,8 +3231,14 @@ HRESULT CDECL wined3d_texture_blt(struct wined3d_texture *dst_texture, unsigned
|
||||
if (dst_texture->sub_resources[dst_sub_resource_idx].map_count
|
||||
|| src_texture->sub_resources[src_sub_resource_idx].map_count)
|
||||
{
|
||||
- WARN("Sub-resource is busy, returning WINEDDERR_SURFACEBUSY.\n");
|
||||
- return WINEDDERR_SURFACEBUSY;
|
||||
+ wined3d_cs_emit_sync(dst_texture->resource.device->cs);
|
||||
+ struct wined3d_device *device = dst_texture->resource.device;
|
||||
+ device->cs->ops->finish(device->cs);
|
||||
+ if (dst_texture->sub_resources[dst_sub_resource_idx].map_count
|
||||
+ || (src_texture && src_texture->sub_resources[src_sub_resource_idx].map_count))
|
||||
+ {
|
||||
@@ -61,5 +63,5 @@ index 8a92a77872..2b249c26c0 100644
|
||||
|
||||
if ((src_format_flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL))
|
||||
--
|
||||
2.11.0
|
||||
2.12.2
|
||||
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
From 35fd800789c10045216d6649ce568264f0cf68da Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
|
||||
Date: Wed, 10 Apr 2013 20:09:55 +0200
|
||||
Subject: wined3d: Wait for the cs to finish before destroying the device
|
||||
|
||||
---
|
||||
dlls/wined3d/device.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
|
||||
index cd0ffbe32f7..61c862de138 100644
|
||||
--- a/dlls/wined3d/device.c
|
||||
+++ b/dlls/wined3d/device.c
|
||||
@@ -1183,6 +1183,8 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device)
|
||||
if (!device->d3d_initialized)
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
|
||||
+ wined3d_cs_emit_sync(device->cs);
|
||||
+
|
||||
if (device->logo_texture)
|
||||
wined3d_texture_decref(device->logo_texture);
|
||||
if (device->cursor_texture)
|
||||
--
|
||||
2.11.0
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
From 994f9e8861db01f02f2dc8724a27ee0e7eea5100 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
|
||||
Date: Thu, 5 Nov 2015 17:46:50 +0100
|
||||
Subject: wined3d: Add swapchain waits.
|
||||
|
||||
---
|
||||
dlls/wined3d/swapchain.c | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
|
||||
index 592cbd96db4..1566d21a944 100644
|
||||
--- a/dlls/wined3d/swapchain.c
|
||||
+++ b/dlls/wined3d/swapchain.c
|
||||
@@ -112,6 +112,10 @@ ULONG CDECL wined3d_swapchain_decref(struct wined3d_swapchain *swapchain)
|
||||
|
||||
if (!refcount)
|
||||
{
|
||||
+ struct wined3d_device *device = swapchain->device;
|
||||
+
|
||||
+ wined3d_cs_emit_sync(device->cs);
|
||||
+
|
||||
swapchain_cleanup(swapchain);
|
||||
swapchain->parent_ops->wined3d_object_destroyed(swapchain->parent);
|
||||
HeapFree(GetProcessHeap(), 0, swapchain);
|
||||
@@ -1307,6 +1311,7 @@ HRESULT CDECL wined3d_swapchain_resize_buffers(struct wined3d_swapchain *swapcha
|
||||
enum wined3d_multisample_type multisample_type, unsigned int multisample_quality)
|
||||
{
|
||||
BOOL update_desc = FALSE;
|
||||
+ struct wined3d_device *device = swapchain->device;
|
||||
|
||||
TRACE("swapchain %p, buffer_count %u, width %u, height %u, format %s, "
|
||||
"multisample_type %#x, multisample_quality %#x.\n",
|
||||
@@ -1318,6 +1323,8 @@ HRESULT CDECL wined3d_swapchain_resize_buffers(struct wined3d_swapchain *swapcha
|
||||
if (buffer_count && buffer_count != swapchain->desc.backbuffer_count)
|
||||
FIXME("Cannot change the back buffer count yet.\n");
|
||||
|
||||
+ wined3d_cs_emit_sync(device->cs);
|
||||
+
|
||||
if (!width || !height)
|
||||
{
|
||||
/* The application is requesting that either the swapchain width or
|
||||
--
|
||||
2.11.0
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
From f37495b98b6c9ddd4624326dfb5658e184978917 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Sun, 19 Feb 2017 07:01:45 +0100
|
||||
Subject: wined3d: Run the cs asynchronously.
|
||||
|
||||
---
|
||||
dlls/wined3d/cs.c | 19 ++++++++++++++++++-
|
||||
1 file changed, 18 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
|
||||
index 659cfdf7c3..73d5c48e86 100644
|
||||
--- a/dlls/wined3d/cs.c
|
||||
+++ b/dlls/wined3d/cs.c
|
||||
@@ -2333,6 +2333,23 @@ static void wined3d_cs_mt_submit(struct wined3d_cs *cs)
|
||||
|
||||
if (InterlockedCompareExchange(&cs->waiting_for_event, FALSE, TRUE))
|
||||
SetEvent(cs->event);
|
||||
+}
|
||||
+
|
||||
+static void wined3d_cs_mt_submit_and_wait(struct wined3d_cs *cs)
|
||||
+{
|
||||
+ struct wined3d_cs_queue *queue = &cs->queue;
|
||||
+ struct wined3d_cs_packet *packet;
|
||||
+ size_t packet_size;
|
||||
+
|
||||
+ if (cs->thread_id == GetCurrentThreadId())
|
||||
+ return wined3d_cs_st_submit(cs);
|
||||
+
|
||||
+ packet = (struct wined3d_cs_packet *)&queue->data[queue->head];
|
||||
+ packet_size = FIELD_OFFSET(struct wined3d_cs_packet, data[packet->size]);
|
||||
+ InterlockedExchange(&queue->head, (queue->head + packet_size) & (WINED3D_CS_QUEUE_SIZE - 1));
|
||||
+
|
||||
+ if (InterlockedCompareExchange(&cs->waiting_for_event, FALSE, TRUE))
|
||||
+ SetEvent(cs->event);
|
||||
|
||||
while (!wined3d_cs_queue_is_empty(queue))
|
||||
wined3d_pause();
|
||||
@@ -2407,7 +2424,7 @@ static const struct wined3d_cs_ops wined3d_cs_mt_ops =
|
||||
{
|
||||
wined3d_cs_mt_require_space,
|
||||
wined3d_cs_mt_submit,
|
||||
- wined3d_cs_mt_submit,
|
||||
+ wined3d_cs_mt_submit_and_wait,
|
||||
wined3d_cs_mt_push_constants,
|
||||
};
|
||||
|
||||
--
|
||||
2.12.2
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
From 4dfea261298432bd9f02c415e99ba770c9c3fe21 Mon Sep 17 00:00:00 2001
|
||||
From 1ad08ef9f2b5f2830990b179bb38041212b3459e Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Wed, 8 Feb 2017 00:21:56 +0100
|
||||
Subject: wined3d: Use priority queue for maps/unmaps.
|
||||
@@ -9,21 +9,21 @@ Subject: wined3d: Use priority queue for maps/unmaps.
|
||||
2 files changed, 8 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
|
||||
index b874b1f41f2..3e7defdeb1b 100644
|
||||
index c74fd1749ca..cb49f38acd3 100644
|
||||
--- a/dlls/wined3d/cs.c
|
||||
+++ b/dlls/wined3d/cs.c
|
||||
@@ -1800,7 +1800,7 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource,
|
||||
struct wined3d_cs_map *op;
|
||||
HRESULT hr;
|
||||
@@ -1874,7 +1874,7 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource,
|
||||
* increasing the map count would be visible to applications. */
|
||||
wined3d_not_from_cs(cs);
|
||||
|
||||
- op = cs->ops->require_space(cs, sizeof(*op), 0);
|
||||
+ op = cs->ops->require_space(cs, sizeof(*op), 1);
|
||||
op->opcode = WINED3D_CS_OP_MAP;
|
||||
op->resource = resource;
|
||||
op->sub_resource_idx = sub_resource_idx;
|
||||
@@ -1829,7 +1829,7 @@ HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resourc
|
||||
struct wined3d_cs_unmap *op;
|
||||
HRESULT hr;
|
||||
@@ -1904,7 +1904,7 @@ HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resourc
|
||||
|
||||
wined3d_not_from_cs(cs);
|
||||
|
||||
- op = cs->ops->require_space(cs, sizeof(*op), 0);
|
||||
+ op = cs->ops->require_space(cs, sizeof(*op), 1);
|
||||
@@ -31,10 +31,10 @@ index b874b1f41f2..3e7defdeb1b 100644
|
||||
op->resource = resource;
|
||||
op->sub_resource_idx = sub_resource_idx;
|
||||
diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c
|
||||
index 1f465fa1f2f..b64147aa437 100644
|
||||
index e343067f943..fffa6fbf25c 100644
|
||||
--- a/dlls/wined3d/resource.c
|
||||
+++ b/dlls/wined3d/resource.c
|
||||
@@ -356,6 +356,9 @@ HRESULT CDECL wined3d_resource_map(struct wined3d_resource *resource, unsigned i
|
||||
@@ -363,6 +363,9 @@ HRESULT CDECL wined3d_resource_map(struct wined3d_resource *resource, unsigned i
|
||||
|
||||
flags = wined3d_resource_sanitise_map_flags(resource, flags);
|
||||
|
||||
@@ -44,7 +44,7 @@ index 1f465fa1f2f..b64147aa437 100644
|
||||
return wined3d_cs_map(resource->device->cs, resource, sub_resource_idx, map_desc, box, flags);
|
||||
}
|
||||
|
||||
@@ -371,6 +374,9 @@ HRESULT CDECL wined3d_resource_unmap(struct wined3d_resource *resource, unsigned
|
||||
@@ -378,6 +381,9 @@ HRESULT CDECL wined3d_resource_unmap(struct wined3d_resource *resource, unsigned
|
||||
{
|
||||
TRACE("resource %p, sub_resource_idx %u.\n", resource, sub_resource_idx);
|
||||
|
||||
@@ -55,5 +55,5 @@ index 1f465fa1f2f..b64147aa437 100644
|
||||
}
|
||||
|
||||
--
|
||||
2.11.0
|
||||
2.12.2
|
||||
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
From 8f135be1edd72169ffdf5f1e500909bc75661823 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Sun, 19 Feb 2017 08:30:44 +0100
|
||||
Subject: wined3d: Synchronize before resizing swapchain context array.
|
||||
|
||||
---
|
||||
dlls/wined3d/swapchain.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
|
||||
index 5963d7222f2..f7acf81bde2 100644
|
||||
--- a/dlls/wined3d/swapchain.c
|
||||
+++ b/dlls/wined3d/swapchain.c
|
||||
@@ -1125,6 +1125,8 @@ static struct wined3d_context *swapchain_create_context(struct wined3d_swapchain
|
||||
|
||||
TRACE("Creating a new context for swapchain %p, thread %u.\n", swapchain, GetCurrentThreadId());
|
||||
|
||||
+ wined3d_cs_emit_sync(swapchain->device->cs);
|
||||
+
|
||||
if (!(ctx = context_create(swapchain, swapchain->front_buffer, swapchain->ds_format)))
|
||||
{
|
||||
ERR("Failed to create a new context for the swapchain\n");
|
||||
--
|
||||
2.11.0
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
From 10c158a6010bc2aa8699701626fbba3945e50611 Mon Sep 17 00:00:00 2001
|
||||
From e17eeff3044b2a6417c3232b3e8a5fe4e28b059e Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Mon, 20 Feb 2017 00:27:25 +0100
|
||||
Subject: wined3d: Improve wined3d_cs_emit_update_sub_resource.
|
||||
@@ -10,10 +10,10 @@ Subject: wined3d: Improve wined3d_cs_emit_update_sub_resource.
|
||||
3 files changed, 69 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
|
||||
index 1d5e221292..cf3ea9f9ab 100644
|
||||
index c8bd8adc82e..7a380905179 100644
|
||||
--- a/dlls/wined3d/cs.c
|
||||
+++ b/dlls/wined3d/cs.c
|
||||
@@ -406,6 +406,7 @@ struct wined3d_cs_update_sub_resource
|
||||
@@ -400,6 +400,7 @@ struct wined3d_cs_update_sub_resource
|
||||
unsigned int sub_resource_idx;
|
||||
struct wined3d_box box;
|
||||
struct wined3d_sub_resource_data data;
|
||||
@@ -21,7 +21,7 @@ index 1d5e221292..cf3ea9f9ab 100644
|
||||
};
|
||||
|
||||
struct wined3d_cs_add_dirty_texture_region
|
||||
@@ -2149,6 +2150,49 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r
|
||||
@@ -2123,6 +2124,49 @@ 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;
|
||||
@@ -71,7 +71,7 @@ index 1d5e221292..cf3ea9f9ab 100644
|
||||
|
||||
op = cs->ops->require_space(cs, sizeof(*op), 1);
|
||||
op->opcode = WINED3D_CS_OP_UPDATE_SUB_RESOURCE;
|
||||
@@ -2258,6 +2302,11 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
|
||||
@@ -2234,6 +2278,11 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
|
||||
/* WINED3D_CS_OP_ADD_DIRTY_TEXTURE_REGION */ wined3d_cs_exec_add_dirty_texture_region,
|
||||
};
|
||||
|
||||
@@ -83,16 +83,16 @@ index 1d5e221292..cf3ea9f9ab 100644
|
||||
static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size, int priority)
|
||||
{
|
||||
if (size > (cs->data_size - cs->end))
|
||||
@@ -2307,6 +2356,7 @@ static void wined3d_cs_st_submit(struct wined3d_cs *cs)
|
||||
@@ -2287,6 +2336,7 @@ static void wined3d_cs_st_finish(struct wined3d_cs *cs)
|
||||
|
||||
static const struct wined3d_cs_ops wined3d_cs_st_ops =
|
||||
{
|
||||
+ wined3d_cs_st_check_space,
|
||||
wined3d_cs_st_require_space,
|
||||
wined3d_cs_st_submit,
|
||||
wined3d_cs_st_submit,
|
||||
@@ -2355,6 +2405,23 @@ static void wined3d_cs_mt_submit_and_wait(struct wined3d_cs *cs)
|
||||
wined3d_pause();
|
||||
wined3d_cs_st_finish,
|
||||
@@ -2315,6 +2365,23 @@ static void wined3d_cs_mt_submit(struct wined3d_cs *cs)
|
||||
SetEvent(cs->event);
|
||||
}
|
||||
|
||||
+static BOOL wined3d_cs_mt_check_space(struct wined3d_cs *cs, size_t size, int priority)
|
||||
@@ -115,19 +115,19 @@ index 1d5e221292..cf3ea9f9ab 100644
|
||||
static void *wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, int priority)
|
||||
{
|
||||
struct wined3d_cs_queue *queue = priority ? &cs->prio_queue : &cs->norm_queue;
|
||||
@@ -2423,6 +2490,7 @@ static void *wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, int
|
||||
@@ -2394,6 +2461,7 @@ static void wined3d_cs_mt_finish(struct wined3d_cs *cs)
|
||||
|
||||
static const struct wined3d_cs_ops wined3d_cs_mt_ops =
|
||||
{
|
||||
+ wined3d_cs_mt_check_space,
|
||||
wined3d_cs_mt_require_space,
|
||||
wined3d_cs_mt_submit,
|
||||
wined3d_cs_mt_submit_and_wait,
|
||||
wined3d_cs_mt_finish,
|
||||
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
|
||||
index e3fd896e39..5fceafdb13 100644
|
||||
index 26872ec5ec5..44e9a18fd22 100644
|
||||
--- a/dlls/wined3d/device.c
|
||||
+++ b/dlls/wined3d/device.c
|
||||
@@ -4119,8 +4119,6 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
|
||||
@@ -4256,8 +4256,6 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
|
||||
TRACE("device %p, resource %p, sub_resource_idx %u, box %s, data %p, row_pitch %u, depth_pitch %u.\n",
|
||||
device, resource, sub_resource_idx, debug_box(box), data, row_pitch, depth_pitch);
|
||||
|
||||
@@ -137,17 +137,17 @@ index e3fd896e39..5fceafdb13 100644
|
||||
{
|
||||
if (sub_resource_idx > 0)
|
||||
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
|
||||
index 8f6d720902..f0b07a6a64 100644
|
||||
index eca14c4a819..bde0e9f47b9 100644
|
||||
--- a/dlls/wined3d/wined3d_private.h
|
||||
+++ b/dlls/wined3d/wined3d_private.h
|
||||
@@ -3258,6 +3258,7 @@ struct wined3d_cs_queue
|
||||
@@ -3265,6 +3265,7 @@ struct wined3d_cs_queue
|
||||
|
||||
struct wined3d_cs_ops
|
||||
{
|
||||
+ BOOL (*check_space)(struct wined3d_cs *cs, size_t size, int priority);
|
||||
void *(*require_space)(struct wined3d_cs *cs, size_t size, int priority);
|
||||
void (*submit)(struct wined3d_cs *cs);
|
||||
void (*submit_and_wait)(struct wined3d_cs *cs);
|
||||
void (*finish)(struct wined3d_cs *cs);
|
||||
--
|
||||
2.12.2
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user