d3d11: Delay destroying unordered access view until it is no longer referenced.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
668650335d
commit
5b30550311
|
@ -54,8 +54,6 @@
|
||||||
|
|
||||||
struct d3d_device;
|
struct d3d_device;
|
||||||
|
|
||||||
extern const struct wined3d_parent_ops d3d_null_wined3d_parent_ops DECLSPEC_HIDDEN;
|
|
||||||
|
|
||||||
/* TRACE helper functions */
|
/* TRACE helper functions */
|
||||||
const char *debug_d3d10_primitive_topology(D3D10_PRIMITIVE_TOPOLOGY topology) DECLSPEC_HIDDEN;
|
const char *debug_d3d10_primitive_topology(D3D10_PRIMITIVE_TOPOLOGY topology) DECLSPEC_HIDDEN;
|
||||||
const char *debug_dxgi_format(DXGI_FORMAT format) DECLSPEC_HIDDEN;
|
const char *debug_dxgi_format(DXGI_FORMAT format) DECLSPEC_HIDDEN;
|
||||||
|
|
|
@ -27,7 +27,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d11);
|
||||||
|
|
||||||
static void STDMETHODCALLTYPE d3d_null_wined3d_object_destroyed(void *parent) {}
|
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,
|
d3d_null_wined3d_object_destroyed,
|
||||||
};
|
};
|
||||||
|
|
|
@ -2377,6 +2377,14 @@ static ULONG STDMETHODCALLTYPE d3d11_unordered_access_view_AddRef(ID3D11Unordere
|
||||||
|
|
||||||
TRACE("%p increasing refcount to %u.\n", view, refcount);
|
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;
|
return refcount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2389,12 +2397,13 @@ static ULONG STDMETHODCALLTYPE d3d11_unordered_access_view_Release(ID3D11Unorder
|
||||||
|
|
||||||
if (!refcount)
|
if (!refcount)
|
||||||
{
|
{
|
||||||
|
ID3D11Device *device = view->device;
|
||||||
|
|
||||||
wined3d_mutex_lock();
|
wined3d_mutex_lock();
|
||||||
wined3d_unordered_access_view_decref(view->wined3d_view);
|
wined3d_unordered_access_view_decref(view->wined3d_view);
|
||||||
ID3D11Device_Release(view->device);
|
|
||||||
wined3d_private_store_cleanup(&view->private_store);
|
|
||||||
wined3d_mutex_unlock();
|
wined3d_mutex_unlock();
|
||||||
HeapFree(GetProcessHeap(), 0, view);
|
|
||||||
|
ID3D11Device_Release(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
return refcount;
|
return refcount;
|
||||||
|
@ -2477,6 +2486,19 @@ static const struct ID3D11UnorderedAccessViewVtbl d3d11_unordered_access_view_vt
|
||||||
d3d11_unordered_access_view_GetDesc,
|
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)
|
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
|
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,
|
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();
|
wined3d_mutex_unlock();
|
||||||
WARN("Failed to create wined3d unordered access view, hr %#x.\n", hr);
|
WARN("Failed to create wined3d unordered access view, hr %#x.\n", hr);
|
||||||
|
|
Loading…
Reference in New Issue