[PATCH 32/35] d3d9: Don't grab wined3d lock for wined3d incref/decref functions.

Jan Sikorski jsikorski at codeweavers.com
Fri Oct 15 07:26:28 CDT 2021


Signed-off-by: Jan Sikorski <jsikorski at codeweavers.com>
---
 dlls/d3d9/device.c            |  4 ----
 dlls/d3d9/directx.c           |  2 --
 dlls/d3d9/query.c             |  3 ---
 dlls/d3d9/shader.c            | 12 ------------
 dlls/d3d9/stateblock.c        |  2 --
 dlls/d3d9/vertexdeclaration.c |  4 ----
 6 files changed, 27 deletions(-)

diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index 1a1bc5ddb6c..ac6a7054838 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -2553,9 +2553,7 @@ static HRESULT WINAPI d3d9_device_EndStateBlock(IDirect3DDevice9Ex *iface, IDire
 
     if (!(object = heap_alloc_zero(sizeof(*object))))
     {
-        wined3d_mutex_lock();
         wined3d_stateblock_decref(wined3d_stateblock);
-        wined3d_mutex_unlock();
         return E_OUTOFMEMORY;
     }
 
@@ -2563,9 +2561,7 @@ static HRESULT WINAPI d3d9_device_EndStateBlock(IDirect3DDevice9Ex *iface, IDire
     if (FAILED(hr))
     {
         WARN("Failed to initialize stateblock, hr %#x.\n", hr);
-        wined3d_mutex_lock();
         wined3d_stateblock_decref(wined3d_stateblock);
-        wined3d_mutex_unlock();
         heap_free(object);
         return hr;
     }
diff --git a/dlls/d3d9/directx.c b/dlls/d3d9/directx.c
index e176483f43e..a1ebc986226 100644
--- a/dlls/d3d9/directx.c
+++ b/dlls/d3d9/directx.c
@@ -81,9 +81,7 @@ static ULONG WINAPI d3d9_Release(IDirect3D9Ex *iface)
 
     if (!refcount)
     {
-        wined3d_mutex_lock();
         wined3d_decref(d3d9->wined3d);
-        wined3d_mutex_unlock();
 
         heap_free(d3d9->wined3d_outputs);
         heap_free(d3d9);
diff --git a/dlls/d3d9/query.c b/dlls/d3d9/query.c
index 207ad55e5a1..450a58091fa 100644
--- a/dlls/d3d9/query.c
+++ b/dlls/d3d9/query.c
@@ -76,10 +76,7 @@ static ULONG WINAPI d3d9_query_Release(IDirect3DQuery9 *iface)
 
     if (!refcount)
     {
-        wined3d_mutex_lock();
         wined3d_query_decref(query->wined3d_query);
-        wined3d_mutex_unlock();
-
         IDirect3DDevice9Ex_Release(query->parent_device);
         heap_free(query);
     }
diff --git a/dlls/d3d9/shader.c b/dlls/d3d9/shader.c
index 838c7de2cf0..042f8498321 100644
--- a/dlls/d3d9/shader.c
+++ b/dlls/d3d9/shader.c
@@ -54,9 +54,7 @@ static ULONG WINAPI d3d9_vertexshader_AddRef(IDirect3DVertexShader9 *iface)
     if (refcount == 1)
     {
         IDirect3DDevice9Ex_AddRef(shader->parent_device);
-        wined3d_mutex_lock();
         wined3d_shader_incref(shader->wined3d_shader);
-        wined3d_mutex_unlock();
     }
 
     return refcount;
@@ -72,11 +70,7 @@ static ULONG WINAPI d3d9_vertexshader_Release(IDirect3DVertexShader9 *iface)
     if (!refcount)
     {
         IDirect3DDevice9Ex *device = shader->parent_device;
-
-        wined3d_mutex_lock();
         wined3d_shader_decref(shader->wined3d_shader);
-        wined3d_mutex_unlock();
-
         /* Release the device last, as it may cause the device to be destroyed. */
         IDirect3DDevice9Ex_Release(device);
     }
@@ -203,9 +197,7 @@ static ULONG WINAPI d3d9_pixelshader_AddRef(IDirect3DPixelShader9 *iface)
     if (refcount == 1)
     {
         IDirect3DDevice9Ex_AddRef(shader->parent_device);
-        wined3d_mutex_lock();
         wined3d_shader_incref(shader->wined3d_shader);
-        wined3d_mutex_unlock();
     }
 
     return refcount;
@@ -221,11 +213,7 @@ static ULONG WINAPI d3d9_pixelshader_Release(IDirect3DPixelShader9 *iface)
     if (!refcount)
     {
         IDirect3DDevice9Ex *device = shader->parent_device;
-
-        wined3d_mutex_lock();
         wined3d_shader_decref(shader->wined3d_shader);
-        wined3d_mutex_unlock();
-
         /* Release the device last, as it may cause the device to be destroyed. */
         IDirect3DDevice9Ex_Release(device);
     }
diff --git a/dlls/d3d9/stateblock.c b/dlls/d3d9/stateblock.c
index 3c1e3230095..c797ce54b49 100644
--- a/dlls/d3d9/stateblock.c
+++ b/dlls/d3d9/stateblock.c
@@ -66,9 +66,7 @@ static ULONG WINAPI d3d9_stateblock_Release(IDirect3DStateBlock9 *iface)
 
     if (!refcount)
     {
-        wined3d_mutex_lock();
         wined3d_stateblock_decref(stateblock->wined3d_stateblock);
-        wined3d_mutex_unlock();
 
         IDirect3DDevice9Ex_Release(stateblock->parent_device);
         heap_free(stateblock);
diff --git a/dlls/d3d9/vertexdeclaration.c b/dlls/d3d9/vertexdeclaration.c
index 60701a9a910..1ddc0cbc1ca 100644
--- a/dlls/d3d9/vertexdeclaration.c
+++ b/dlls/d3d9/vertexdeclaration.c
@@ -225,9 +225,7 @@ static ULONG WINAPI d3d9_vertex_declaration_AddRef(IDirect3DVertexDeclaration9 *
     if (refcount == 1)
     {
         IDirect3DDevice9Ex_AddRef(declaration->parent_device);
-        wined3d_mutex_lock();
         wined3d_vertex_declaration_incref(declaration->wined3d_declaration);
-        wined3d_mutex_unlock();
     }
 
     return refcount;
@@ -243,9 +241,7 @@ static ULONG WINAPI d3d9_vertex_declaration_Release(IDirect3DVertexDeclaration9
     if (!refcount)
     {
         IDirect3DDevice9Ex *parent_device = declaration->parent_device;
-        wined3d_mutex_lock();
         wined3d_vertex_declaration_decref(declaration->wined3d_declaration);
-        wined3d_mutex_unlock();
 
         /* Release the device last, as it may cause the device to be destroyed. */
         IDirect3DDevice9Ex_Release(parent_device);
-- 
2.30.2




More information about the wine-devel mailing list