Rebase against 0c0c86a8c7c93e7edbca8a7840c945f4159c3059.

FIXME: We should do all operations through the command stream.
This commit is contained in:
Sebastian Lackner 2016-06-12 01:22:23 +02:00
parent c92ffa58c0
commit 52f5a405e9
4 changed files with 79 additions and 34 deletions

View File

@ -51,7 +51,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "2a5b4fd884801a7f394ade49142fbfdba195243c"
echo "0c0c86a8c7c93e7edbca8a7840c945f4159c3059"
}
# Show version information

View File

@ -1,14 +1,14 @@
From 6541a3abde1a6198a7aaba56dbf3b9600b1d070c Mon Sep 17 00:00:00 2001
From 2dd5269b65ca49e2fb0b1d569e9a72366cb5da41 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefandoesinger@gmx.at>
Date: Sun, 24 Apr 2016 13:51:03 +0100
Subject: wined3d: Wait for the CS before destroying views.
---
dlls/wined3d/view.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
dlls/wined3d/view.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c
index 773dccf..5ad4ab0 100644
index 1604443..adc6b2c 100644
--- a/dlls/wined3d/view.c
+++ b/dlls/wined3d/view.c
@@ -41,6 +41,14 @@ ULONG CDECL wined3d_rendertarget_view_decref(struct wined3d_rendertarget_view *v
@ -37,6 +37,14 @@ index 773dccf..5ad4ab0 100644
+ FIXME("Waiting for cs.\n");
+ device->cs->ops->finish(device->cs);
+ }
+
if (view->object)
{
const struct wined3d_gl_info *gl_info;
@@ -196,6 +212,7 @@ ULONG CDECL wined3d_shader_resource_view_decref(struct wined3d_shader_resource_v
checkGLcall("glDeleteTextures");
context_release(context);
}
+
/* Call wined3d_object_destroyed() before releasing the resource,
* since releasing the resource may end up destroying the parent. */

View File

@ -1,16 +1,16 @@
From 393cb1985fb3948fef885d5142f3519242fe58d4 Mon Sep 17 00:00:00 2001
From c9eddaea0012e092e914b997cbeda8ebf5d00ba4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Thu, 5 Nov 2015 16:39:01 +0100
Subject: wined3d: Destroy shader resource views through the CS.
---
dlls/wined3d/cs.c | 28 ++++++++++++++++++++++++++++
dlls/wined3d/view.c | 13 ++++++-------
dlls/wined3d/view.c | 37 ++++++++++++++++++-------------------
dlls/wined3d/wined3d_private.h | 4 ++++
3 files changed, 38 insertions(+), 7 deletions(-)
3 files changed, 50 insertions(+), 19 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 4ec6260..6de25ab 100644
index bf446aa..9965e9b 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -86,6 +86,7 @@ enum wined3d_cs_op
@ -21,7 +21,7 @@ index 4ec6260..6de25ab 100644
WINED3D_CS_OP_STOP,
};
@@ -510,6 +511,12 @@ struct wined3d_cs_sampler_destroy
@@ -514,6 +515,12 @@ struct wined3d_cs_sampler_destroy
struct wined3d_sampler *sampler;
};
@ -34,7 +34,7 @@ index 4ec6260..6de25ab 100644
static void wined3d_cs_mt_submit(struct wined3d_cs *cs, size_t size)
{
LONG new_val = (cs->queue.head + size) & (WINED3D_CS_QUEUE_SIZE - 1);
@@ -2578,6 +2585,26 @@ void wined3d_cs_emit_sampler_destroy(struct wined3d_cs *cs, struct wined3d_sampl
@@ -2575,6 +2582,26 @@ void wined3d_cs_emit_sampler_destroy(struct wined3d_cs *cs, struct wined3d_sampl
cs->ops->submit(cs, sizeof(*op));
}
@ -61,7 +61,7 @@ index 4ec6260..6de25ab 100644
static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_NOP */ wined3d_cs_exec_nop,
@@ -2642,6 +2669,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
@@ -2639,6 +2666,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_BUFFER_CLEANUP */ wined3d_cs_exec_buffer_cleanup,
/* WINED3D_CS_OP_TEXTURE_CLEANUP */ wined3d_cs_exec_texture_cleanup,
/* WINED3D_CS_OP_SAMPLER_DESTROY */ wined3d_cs_exec_sampler_destroy,
@ -70,22 +70,34 @@ index 4ec6260..6de25ab 100644
static inline void *_wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, BOOL prio)
diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c
index 1a8e88c..7ed4ad9 100644
index 070694e..7797c58 100644
--- a/dlls/wined3d/view.c
+++ b/dlls/wined3d/view.c
@@ -184,6 +184,11 @@ ULONG CDECL wined3d_shader_resource_view_incref(struct wined3d_shader_resource_v
@@ -184,6 +184,23 @@ ULONG CDECL wined3d_shader_resource_view_incref(struct wined3d_shader_resource_v
return refcount;
}
+void wined3d_shader_resource_view_destroy_cs(struct wined3d_shader_resource_view *view)
+{
+ if (view->object)
+ {
+ const struct wined3d_gl_info *gl_info;
+ struct wined3d_context *context;
+
+ context = context_acquire(view->resource->device, NULL);
+ gl_info = context->gl_info;
+ gl_info->gl_ops.gl.p_glDeleteTextures(1, &view->object);
+ checkGLcall("glDeleteTextures");
+ context_release(context);
+ }
+
+ HeapFree(GetProcessHeap(), 0, view);
+}
+
ULONG CDECL wined3d_shader_resource_view_decref(struct wined3d_shader_resource_view *view)
{
ULONG refcount = InterlockedDecrement(&view->refcount);
@@ -194,17 +199,11 @@ ULONG CDECL wined3d_shader_resource_view_decref(struct wined3d_shader_resource_v
@@ -194,29 +211,11 @@ ULONG CDECL wined3d_shader_resource_view_decref(struct wined3d_shader_resource_v
{
struct wined3d_device *device = view->resource->device;
@ -94,6 +106,18 @@ index 1a8e88c..7ed4ad9 100644
- FIXME("Waiting for cs.\n");
- device->cs->ops->finish(device->cs);
- }
-
- if (view->object)
- {
- const struct wined3d_gl_info *gl_info;
- struct wined3d_context *context;
-
- context = context_acquire(view->resource->device, NULL);
- gl_info = context->gl_info;
- gl_info->gl_ops.gl.p_glDeleteTextures(1, &view->object);
- checkGLcall("glDeleteTextures");
- context_release(context);
- }
-
/* Call wined3d_object_destroyed() before releasing the resource,
* since releasing the resource may end up destroying the parent. */
@ -105,10 +129,10 @@ index 1a8e88c..7ed4ad9 100644
return refcount;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index dc1386a..5a4f71b 100644
index 51ffe6f..c285702 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3059,6 +3059,8 @@ void wined3d_cs_emit_resource_cleanup(struct wined3d_cs *cs,
@@ -3096,6 +3096,8 @@ void wined3d_cs_emit_resource_cleanup(struct wined3d_cs *cs,
void wined3d_cs_emit_buffer_cleanup(struct wined3d_cs *cs, struct wined3d_buffer *buffer) DECLSPEC_HIDDEN;
void wined3d_cs_emit_texture_cleanup(struct wined3d_cs *cs, struct wined3d_texture *texture) DECLSPEC_HIDDEN;
void wined3d_cs_emit_sampler_destroy(struct wined3d_cs *cs, struct wined3d_sampler *sampler) DECLSPEC_HIDDEN;
@ -117,9 +141,9 @@ index dc1386a..5a4f71b 100644
/* Direct3D terminology with little modifications. We do not have an issued state
* because only the driver knows about it, but we have a created state because d3d
@@ -3197,6 +3199,8 @@ struct wined3d_shader_resource_view
const struct wined3d_parent_ops *parent_ops;
};
@@ -3240,6 +3242,8 @@ struct wined3d_shader_resource_view
void wined3d_shader_resource_view_bind(struct wined3d_shader_resource_view *view,
struct wined3d_context *context) DECLSPEC_HIDDEN;
+void wined3d_shader_resource_view_destroy_cs(struct wined3d_shader_resource_view *view) DECLSPEC_HIDDEN;
+

View File

@ -673,7 +673,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
}
static void context_map_stage(struct wined3d_context *context, DWORD stage, DWORD unit)
@@ -3371,7 +3409,11 @@
@@ -3362,7 +3400,11 @@
const struct wined3d_device *device, const struct wined3d_state *state)
{
const struct StateEntry *state_table = context->state_table;
@ -685,7 +685,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
unsigned int i;
WORD map;
@@ -3404,12 +3446,17 @@
@@ -3395,12 +3437,17 @@
for (i = 0, map = context->stream_info.use_map; map; map >>= 1, ++i)
{
if (map & 1)
@ -703,7 +703,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
}
if (state->index_buffer)
{
@@ -3528,9 +3575,11 @@
@@ -3519,9 +3566,11 @@
TRACE("device %p, target %p.\n", device, target);
@ -6962,7 +6962,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -4464,7 +4464,11 @@
@@ -4465,7 +4465,11 @@
float y_offset = context->render_offscreen
? (center_offset - (2.0f * y) - h) / h
: (center_offset - (2.0f * y) - h) / -h;
@ -6974,7 +6974,7 @@ diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
state->render_states[WINED3D_RS_ZENABLE] : WINED3D_ZB_FALSE;
float z_scale = zenable ? 2.0f : 0.0f;
float z_offset = zenable ? -1.0f : 0.0f;
@@ -5261,7 +5265,11 @@
@@ -5262,7 +5266,11 @@
break;
}
}
@ -7059,13 +7059,15 @@ diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c
}
return refcount;
@@ -184,11 +194,13 @@
@@ -184,6 +194,7 @@
return refcount;
}
+#if defined(STAGING_CSMT)
void wined3d_shader_resource_view_destroy_cs(struct wined3d_shader_resource_view *view)
{
if (view->object)
@@ -201,6 +212,7 @@
HeapFree(GetProcessHeap(), 0, view);
}
@ -7073,7 +7075,7 @@ diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c
ULONG CDECL wined3d_shader_resource_view_decref(struct wined3d_shader_resource_view *view)
{
ULONG refcount = InterlockedDecrement(&view->refcount);
@@ -197,6 +209,7 @@
@@ -209,6 +221,7 @@
if (!refcount)
{
@ -7081,11 +7083,22 @@ diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c
struct wined3d_device *device = view->resource->device;
/* Call wined3d_object_destroyed() before releasing the resource,
@@ -204,6 +217,13 @@
@@ -216,6 +229,24 @@
view->parent_ops->wined3d_object_destroyed(view->parent);
wined3d_resource_decref(view->resource);
wined3d_cs_emit_shader_resource_view_destroy(device->cs, view);
+#else /* STAGING_CSMT */
+ if (view->object)
+ {
+ const struct wined3d_gl_info *gl_info;
+ struct wined3d_context *context;
+
+ context = context_acquire(view->resource->device, NULL);
+ gl_info = context->gl_info;
+ gl_info->gl_ops.gl.p_glDeleteTextures(1, &view->object);
+ checkGLcall("glDeleteTextures");
+ context_release(context);
+ }
+ /* Call wined3d_object_destroyed() before releasing the resource,
+ * since releasing the resource may end up destroying the parent. */
+ view->parent_ops->wined3d_object_destroyed(view->parent);
@ -7711,15 +7724,15 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
struct wined3d_shader_resource_view
{
LONG refcount;
@@ -3257,6 +3419,7 @@
const struct wined3d_parent_ops *parent_ops;
};
@@ -3263,6 +3425,7 @@
void wined3d_shader_resource_view_bind(struct wined3d_shader_resource_view *view,
struct wined3d_context *context) DECLSPEC_HIDDEN;
+#if defined(STAGING_CSMT)
void wined3d_shader_resource_view_destroy_cs(struct wined3d_shader_resource_view *view) DECLSPEC_HIDDEN;
struct wined3d_swapchain_ops
@@ -3264,6 +3427,12 @@
@@ -3270,6 +3433,12 @@
void (*swapchain_present)(struct wined3d_swapchain *swapchain,
const RECT *src_rect, const RECT *dst_rect, DWORD flags,
struct wined3d_rendertarget_view *depth_stencil);
@ -7732,7 +7745,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
void (*swapchain_frontbuffer_updated)(struct wined3d_swapchain *swapchain);
};
@@ -3299,8 +3468,10 @@
@@ -3305,8 +3474,10 @@
void wined3d_swapchain_activate(struct wined3d_swapchain *swapchain, BOOL activate) DECLSPEC_HIDDEN;
struct wined3d_context *swapchain_get_context(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
@ -7743,7 +7756,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
void swapchain_destroy_contexts(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
HDC swapchain_get_backup_dc(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
void swapchain_update_draw_bindings(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
@@ -3512,7 +3683,9 @@
@@ -3518,7 +3689,9 @@
void shader_generate_main(const struct wined3d_shader *shader, struct wined3d_string_buffer *buffer,
const struct wined3d_shader_reg_maps *reg_maps, const DWORD *byte_code, void *backend_ctx) DECLSPEC_HIDDEN;
BOOL shader_match_semantic(const char *semantic_name, enum wined3d_decl_usage usage) DECLSPEC_HIDDEN;