=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: d3d11: Delay destroying unordered access view until it is no longer referenced.
Alexandre Julliard
julliard at winehq.org
Thu Apr 27 15:49:10 CDT 2017
Module: wine
Branch: master
Commit: 5b305503112613c952b39e00003da1a1bfd30d3e
URL: http://source.winehq.org/git/wine.git/?a=commit;h=5b305503112613c952b39e00003da1a1bfd30d3e
Author: Józef Kucia <jkucia at codeweavers.com>
Date: Thu Apr 27 12:02:50 2017 +0200
d3d11: Delay destroying unordered access view until it is no longer referenced.
Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/d3d11/d3d11_private.h | 2 --
dlls/d3d11/device.c | 2 +-
dlls/d3d11/view.c | 30 ++++++++++++++++++++++++++----
3 files changed, 27 insertions(+), 7 deletions(-)
diff --git a/dlls/d3d11/d3d11_private.h b/dlls/d3d11/d3d11_private.h
index a8987cb..cbc8d7c 100644
--- a/dlls/d3d11/d3d11_private.h
+++ b/dlls/d3d11/d3d11_private.h
@@ -54,8 +54,6 @@
struct d3d_device;
-extern const struct wined3d_parent_ops d3d_null_wined3d_parent_ops DECLSPEC_HIDDEN;
-
/* TRACE helper functions */
const char *debug_d3d10_primitive_topology(D3D10_PRIMITIVE_TOPOLOGY topology) DECLSPEC_HIDDEN;
const char *debug_dxgi_format(DXGI_FORMAT format) DECLSPEC_HIDDEN;
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
index c5ead36..259f189 100644
--- a/dlls/d3d11/device.c
+++ b/dlls/d3d11/device.c
@@ -27,7 +27,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d11);
static void STDMETHODCALLTYPE d3d_null_wined3d_object_destroyed(void *parent) {}
-const struct wined3d_parent_ops d3d_null_wined3d_parent_ops =
+static const struct wined3d_parent_ops d3d_null_wined3d_parent_ops =
{
d3d_null_wined3d_object_destroyed,
};
diff --git a/dlls/d3d11/view.c b/dlls/d3d11/view.c
index f1478ba..f747c4b 100644
--- a/dlls/d3d11/view.c
+++ b/dlls/d3d11/view.c
@@ -2377,6 +2377,14 @@ static ULONG STDMETHODCALLTYPE d3d11_unordered_access_view_AddRef(ID3D11Unordere
TRACE("%p increasing refcount to %u.\n", view, refcount);
+ if (refcount == 1)
+ {
+ ID3D11Device_AddRef(view->device);
+ wined3d_mutex_lock();
+ wined3d_unordered_access_view_incref(view->wined3d_view);
+ wined3d_mutex_unlock();
+ }
+
return refcount;
}
@@ -2389,12 +2397,13 @@ static ULONG STDMETHODCALLTYPE d3d11_unordered_access_view_Release(ID3D11Unorder
if (!refcount)
{
+ ID3D11Device *device = view->device;
+
wined3d_mutex_lock();
wined3d_unordered_access_view_decref(view->wined3d_view);
- ID3D11Device_Release(view->device);
- wined3d_private_store_cleanup(&view->private_store);
wined3d_mutex_unlock();
- HeapFree(GetProcessHeap(), 0, view);
+
+ ID3D11Device_Release(device);
}
return refcount;
@@ -2477,6 +2486,19 @@ static const struct ID3D11UnorderedAccessViewVtbl d3d11_unordered_access_view_vt
d3d11_unordered_access_view_GetDesc,
};
+static void STDMETHODCALLTYPE d3d11_unordered_access_view_wined3d_object_destroyed(void *parent)
+{
+ struct d3d11_unordered_access_view *view = parent;
+
+ wined3d_private_store_cleanup(&view->private_store);
+ HeapFree(GetProcessHeap(), 0, parent);
+}
+
+static const struct wined3d_parent_ops d3d11_unordered_access_view_wined3d_parent_ops =
+{
+ d3d11_unordered_access_view_wined3d_object_destroyed,
+};
+
static unsigned int wined3d_view_flags_from_d3d11_buffer_uav_flags(unsigned int d3d11_flags)
{
unsigned int wined3d_flags = d3d11_flags & (WINED3D_VIEW_BUFFER_RAW
@@ -2577,7 +2599,7 @@ static HRESULT d3d11_unordered_access_view_init(struct d3d11_unordered_access_vi
}
if (FAILED(hr = wined3d_unordered_access_view_create(&wined3d_desc, wined3d_resource,
- view, &d3d_null_wined3d_parent_ops, &view->wined3d_view)))
+ view, &d3d11_unordered_access_view_wined3d_parent_ops, &view->wined3d_view)))
{
wined3d_mutex_unlock();
WARN("Failed to create wined3d unordered access view, hr %#x.\n", hr);
More information about the wine-cvs
mailing list