Commit a519188f authored by Jan Sikorski's avatar Jan Sikorski Committed by Alexandre Julliard

d3d11: Don't grab wined3d lock for reference decrementing functions.

Except wined3d_texture_decref(). Signed-off-by: 's avatarJan Sikorski <jsikorski@codeweavers.com> Signed-off-by: 's avatarHenri Verbeet <hverbeet@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 83166189
...@@ -88,11 +88,7 @@ static ULONG STDMETHODCALLTYPE d3d11_query_Release(ID3D11Query *iface) ...@@ -88,11 +88,7 @@ static ULONG STDMETHODCALLTYPE d3d11_query_Release(ID3D11Query *iface)
if (!refcount) if (!refcount)
{ {
ID3D11Device2 *device = query->device; ID3D11Device2 *device = query->device;
wined3d_mutex_lock();
wined3d_query_decref(query->wined3d_query); wined3d_query_decref(query->wined3d_query);
wined3d_mutex_unlock();
ID3D11Device2_Release(device); ID3D11Device2_Release(device);
} }
......
...@@ -86,9 +86,7 @@ static ULONG STDMETHODCALLTYPE d3d11_buffer_Release(ID3D11Buffer *iface) ...@@ -86,9 +86,7 @@ static ULONG STDMETHODCALLTYPE d3d11_buffer_Release(ID3D11Buffer *iface)
{ {
ID3D11Device2 *device = buffer->device; ID3D11Device2 *device = buffer->device;
wined3d_mutex_lock();
wined3d_buffer_decref(buffer->wined3d_buffer); wined3d_buffer_decref(buffer->wined3d_buffer);
wined3d_mutex_unlock();
/* Release the device last, it may cause the wined3d device to be /* Release the device last, it may cause the wined3d device to be
* destroyed. */ * destroyed. */
ID3D11Device2_Release(device); ID3D11Device2_Release(device);
......
...@@ -375,9 +375,7 @@ static ULONG STDMETHODCALLTYPE d3d11_command_list_Release(ID3D11CommandList *ifa ...@@ -375,9 +375,7 @@ static ULONG STDMETHODCALLTYPE d3d11_command_list_Release(ID3D11CommandList *ifa
if (!refcount) if (!refcount)
{ {
wined3d_mutex_lock();
wined3d_command_list_decref(list->wined3d_list); wined3d_command_list_decref(list->wined3d_list);
wined3d_mutex_unlock();
wined3d_private_store_cleanup(&list->private_store); wined3d_private_store_cleanup(&list->private_store);
ID3D11Device2_Release(list->device); ID3D11Device2_Release(list->device);
heap_free(list); heap_free(list);
...@@ -4541,9 +4539,7 @@ static ULONG STDMETHODCALLTYPE d3d_device_inner_Release(IUnknown *iface) ...@@ -4541,9 +4539,7 @@ static ULONG STDMETHODCALLTYPE d3d_device_inner_Release(IUnknown *iface)
d3d11_device_context_cleanup(&device->immediate_context); d3d11_device_context_cleanup(&device->immediate_context);
if (device->wined3d_device) if (device->wined3d_device)
{ {
wined3d_mutex_lock();
wined3d_device_decref(device->wined3d_device); wined3d_device_decref(device->wined3d_device);
wined3d_mutex_unlock();
} }
wine_rb_destroy(&device->sampler_states, NULL, NULL); wine_rb_destroy(&device->sampler_states, NULL, NULL);
wine_rb_destroy(&device->rasterizer_states, NULL, NULL); wine_rb_destroy(&device->rasterizer_states, NULL, NULL);
......
...@@ -154,11 +154,7 @@ static ULONG STDMETHODCALLTYPE d3d11_input_layout_Release(ID3D11InputLayout *ifa ...@@ -154,11 +154,7 @@ static ULONG STDMETHODCALLTYPE d3d11_input_layout_Release(ID3D11InputLayout *ifa
if (!refcount) if (!refcount)
{ {
ID3D11Device2 *device = layout->device; ID3D11Device2 *device = layout->device;
wined3d_mutex_lock();
wined3d_vertex_declaration_decref(layout->wined3d_decl); wined3d_vertex_declaration_decref(layout->wined3d_decl);
wined3d_mutex_unlock();
ID3D11Device2_Release(device); ID3D11Device2_Release(device);
} }
......
...@@ -86,9 +86,7 @@ static ULONG STDMETHODCALLTYPE d3d11_vertex_shader_Release(ID3D11VertexShader *i ...@@ -86,9 +86,7 @@ static ULONG STDMETHODCALLTYPE d3d11_vertex_shader_Release(ID3D11VertexShader *i
{ {
ID3D11Device2 *device = shader->device; ID3D11Device2 *device = shader->device;
wined3d_mutex_lock();
wined3d_shader_decref(shader->wined3d_shader); wined3d_shader_decref(shader->wined3d_shader);
wined3d_mutex_unlock();
/* Release the device last, it may cause the wined3d device to be /* Release the device last, it may cause the wined3d device to be
* destroyed. */ * destroyed. */
ID3D11Device2_Release(device); ID3D11Device2_Release(device);
...@@ -379,11 +377,7 @@ static ULONG STDMETHODCALLTYPE d3d11_hull_shader_Release(ID3D11HullShader *iface ...@@ -379,11 +377,7 @@ static ULONG STDMETHODCALLTYPE d3d11_hull_shader_Release(ID3D11HullShader *iface
if (!refcount) if (!refcount)
{ {
ID3D11Device2 *device = shader->device; ID3D11Device2 *device = shader->device;
wined3d_mutex_lock();
wined3d_shader_decref(shader->wined3d_shader); wined3d_shader_decref(shader->wined3d_shader);
wined3d_mutex_unlock();
/* Release the device last, it may cause the wined3d device to be /* Release the device last, it may cause the wined3d device to be
* destroyed. */ * destroyed. */
ID3D11Device2_Release(device); ID3D11Device2_Release(device);
...@@ -570,11 +564,7 @@ static ULONG STDMETHODCALLTYPE d3d11_domain_shader_Release(ID3D11DomainShader *i ...@@ -570,11 +564,7 @@ static ULONG STDMETHODCALLTYPE d3d11_domain_shader_Release(ID3D11DomainShader *i
if (!refcount) if (!refcount)
{ {
ID3D11Device2 *device = shader->device; ID3D11Device2 *device = shader->device;
wined3d_mutex_lock();
wined3d_shader_decref(shader->wined3d_shader); wined3d_shader_decref(shader->wined3d_shader);
wined3d_mutex_unlock();
/* Release the device last, it may cause the wined3d device to be /* Release the device last, it may cause the wined3d device to be
* destroyed. */ * destroyed. */
ID3D11Device2_Release(device); ID3D11Device2_Release(device);
...@@ -771,11 +761,7 @@ static ULONG STDMETHODCALLTYPE d3d11_geometry_shader_Release(ID3D11GeometryShade ...@@ -771,11 +761,7 @@ static ULONG STDMETHODCALLTYPE d3d11_geometry_shader_Release(ID3D11GeometryShade
if (!refcount) if (!refcount)
{ {
ID3D11Device2 *device = shader->device; ID3D11Device2 *device = shader->device;
wined3d_mutex_lock();
wined3d_shader_decref(shader->wined3d_shader); wined3d_shader_decref(shader->wined3d_shader);
wined3d_mutex_unlock();
/* Release the device last, it may cause the wined3d device to be /* Release the device last, it may cause the wined3d device to be
* destroyed. */ * destroyed. */
ID3D11Device2_Release(device); ID3D11Device2_Release(device);
...@@ -1273,10 +1259,7 @@ static ULONG STDMETHODCALLTYPE d3d11_pixel_shader_Release(ID3D11PixelShader *ifa ...@@ -1273,10 +1259,7 @@ static ULONG STDMETHODCALLTYPE d3d11_pixel_shader_Release(ID3D11PixelShader *ifa
if (!refcount) if (!refcount)
{ {
ID3D11Device2 *device = shader->device; ID3D11Device2 *device = shader->device;
wined3d_mutex_lock();
wined3d_shader_decref(shader->wined3d_shader); wined3d_shader_decref(shader->wined3d_shader);
wined3d_mutex_unlock();
/* Release the device last, it may cause the wined3d device to be /* Release the device last, it may cause the wined3d device to be
* destroyed. */ * destroyed. */
ID3D11Device2_Release(device); ID3D11Device2_Release(device);
...@@ -1566,11 +1549,7 @@ static ULONG STDMETHODCALLTYPE d3d11_compute_shader_Release(ID3D11ComputeShader ...@@ -1566,11 +1549,7 @@ static ULONG STDMETHODCALLTYPE d3d11_compute_shader_Release(ID3D11ComputeShader
if (!refcount) if (!refcount)
{ {
ID3D11Device2 *device = shader->device; ID3D11Device2 *device = shader->device;
wined3d_mutex_lock();
wined3d_shader_decref(shader->wined3d_shader); wined3d_shader_decref(shader->wined3d_shader);
wined3d_mutex_unlock();
/* Release the device last, it may cause the wined3d device to be /* Release the device last, it may cause the wined3d device to be
* destroyed. */ * destroyed. */
ID3D11Device2_Release(device); ID3D11Device2_Release(device);
......
...@@ -80,11 +80,7 @@ static ULONG STDMETHODCALLTYPE d3d11_blend_state_Release(ID3D11BlendState *iface ...@@ -80,11 +80,7 @@ static ULONG STDMETHODCALLTYPE d3d11_blend_state_Release(ID3D11BlendState *iface
if (!refcount) if (!refcount)
{ {
ID3D11Device2 *device = state->device; ID3D11Device2 *device = state->device;
wined3d_mutex_lock();
wined3d_blend_state_decref(state->wined3d_state); wined3d_blend_state_decref(state->wined3d_state);
wined3d_mutex_unlock();
ID3D11Device2_Release(device); ID3D11Device2_Release(device);
} }
...@@ -511,9 +507,7 @@ static ULONG STDMETHODCALLTYPE d3d11_depthstencil_state_Release(ID3D11DepthStenc ...@@ -511,9 +507,7 @@ static ULONG STDMETHODCALLTYPE d3d11_depthstencil_state_Release(ID3D11DepthStenc
{ {
ID3D11Device2 *device = state->device; ID3D11Device2 *device = state->device;
wined3d_mutex_lock();
wined3d_depth_stencil_state_decref(state->wined3d_state); wined3d_depth_stencil_state_decref(state->wined3d_state);
wined3d_mutex_unlock();
ID3D11Device2_Release(device); ID3D11Device2_Release(device);
} }
...@@ -908,11 +902,7 @@ static ULONG STDMETHODCALLTYPE d3d11_rasterizer_state_Release(ID3D11RasterizerSt ...@@ -908,11 +902,7 @@ static ULONG STDMETHODCALLTYPE d3d11_rasterizer_state_Release(ID3D11RasterizerSt
if (!refcount) if (!refcount)
{ {
ID3D11Device2 *device = state->device; ID3D11Device2 *device = state->device;
wined3d_mutex_lock();
wined3d_rasterizer_state_decref(state->wined3d_state); wined3d_rasterizer_state_decref(state->wined3d_state);
wined3d_mutex_unlock();
ID3D11Device2_Release(device); ID3D11Device2_Release(device);
} }
...@@ -1294,11 +1284,7 @@ static ULONG STDMETHODCALLTYPE d3d11_sampler_state_Release(ID3D11SamplerState *i ...@@ -1294,11 +1284,7 @@ static ULONG STDMETHODCALLTYPE d3d11_sampler_state_Release(ID3D11SamplerState *i
if (!refcount) if (!refcount)
{ {
ID3D11Device2 *device = state->device; ID3D11Device2 *device = state->device;
wined3d_mutex_lock();
wined3d_sampler_decref(state->wined3d_sampler); wined3d_sampler_decref(state->wined3d_sampler);
wined3d_mutex_unlock();
ID3D11Device2_Release(device); ID3D11Device2_Release(device);
} }
......
...@@ -979,11 +979,7 @@ static ULONG STDMETHODCALLTYPE d3d11_depthstencil_view_Release(ID3D11DepthStenci ...@@ -979,11 +979,7 @@ static ULONG STDMETHODCALLTYPE d3d11_depthstencil_view_Release(ID3D11DepthStenci
if (!refcount) if (!refcount)
{ {
ID3D11Device2 *device = view->device; ID3D11Device2 *device = view->device;
wined3d_mutex_lock();
wined3d_rendertarget_view_decref(view->wined3d_view); wined3d_rendertarget_view_decref(view->wined3d_view);
wined3d_mutex_unlock();
ID3D11Device2_Release(device); ID3D11Device2_Release(device);
} }
...@@ -1421,11 +1417,7 @@ static ULONG STDMETHODCALLTYPE d3d11_rendertarget_view_Release(ID3D11RenderTarge ...@@ -1421,11 +1417,7 @@ static ULONG STDMETHODCALLTYPE d3d11_rendertarget_view_Release(ID3D11RenderTarge
if (!refcount) if (!refcount)
{ {
ID3D11Device2 *device = view->device; ID3D11Device2 *device = view->device;
wined3d_mutex_lock();
wined3d_rendertarget_view_decref(view->wined3d_view); wined3d_rendertarget_view_decref(view->wined3d_view);
wined3d_mutex_unlock();
ID3D11Device2_Release(device); ID3D11Device2_Release(device);
} }
...@@ -1867,11 +1859,7 @@ static ULONG STDMETHODCALLTYPE d3d11_shader_resource_view_Release(ID3D11ShaderRe ...@@ -1867,11 +1859,7 @@ static ULONG STDMETHODCALLTYPE d3d11_shader_resource_view_Release(ID3D11ShaderRe
if (!refcount) if (!refcount)
{ {
ID3D11Device2 *device = view->device; ID3D11Device2 *device = view->device;
wined3d_mutex_lock();
wined3d_shader_resource_view_decref(view->wined3d_view); wined3d_shader_resource_view_decref(view->wined3d_view);
wined3d_mutex_unlock();
ID3D11Device2_Release(device); ID3D11Device2_Release(device);
} }
...@@ -2350,11 +2338,7 @@ static ULONG STDMETHODCALLTYPE d3d11_unordered_access_view_Release(ID3D11Unorder ...@@ -2350,11 +2338,7 @@ static ULONG STDMETHODCALLTYPE d3d11_unordered_access_view_Release(ID3D11Unorder
if (!refcount) if (!refcount)
{ {
ID3D11Device2 *device = view->device; ID3D11Device2 *device = view->device;
wined3d_mutex_lock();
wined3d_unordered_access_view_decref(view->wined3d_view); wined3d_unordered_access_view_decref(view->wined3d_view);
wined3d_mutex_unlock();
ID3D11Device2_Release(device); ID3D11Device2_Release(device);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment