=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: d3d11: Fix refcounting for shaders.

Alexandre Julliard julliard at winehq.org
Wed Apr 26 16:03:14 CDT 2017


Module: wine
Branch: master
Commit: 51d58f9962c92bb2268143383499b1e9b68d12fc
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=51d58f9962c92bb2268143383499b1e9b68d12fc

Author: Józef Kucia <jkucia at codeweavers.com>
Date:   Wed Apr 26 13:19:57 2017 +0200

d3d11: Fix refcounting for shaders.

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/shader.c | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/dlls/d3d11/shader.c b/dlls/d3d11/shader.c
index 6266a34..b8c50d9 100644
--- a/dlls/d3d11/shader.c
+++ b/dlls/d3d11/shader.c
@@ -635,6 +635,14 @@ static ULONG STDMETHODCALLTYPE d3d11_hull_shader_AddRef(ID3D11HullShader *iface)
 
     TRACE("%p increasing refcount to %u.\n", shader, refcount);
 
+    if (refcount == 1)
+    {
+        ID3D11Device_AddRef(shader->device);
+        wined3d_mutex_lock();
+        wined3d_shader_incref(shader->wined3d_shader);
+        wined3d_mutex_unlock();
+    }
+
     return refcount;
 }
 
@@ -831,6 +839,14 @@ static ULONG STDMETHODCALLTYPE d3d11_domain_shader_AddRef(ID3D11DomainShader *if
 
     TRACE("%p increasing refcount to %u.\n", shader, refcount);
 
+    if (refcount == 1)
+    {
+        ID3D11Device_AddRef(shader->device);
+        wined3d_mutex_lock();
+        wined3d_shader_incref(shader->wined3d_shader);
+        wined3d_mutex_unlock();
+    }
+
     return refcount;
 }
 
@@ -1037,6 +1053,14 @@ static ULONG STDMETHODCALLTYPE d3d11_geometry_shader_AddRef(ID3D11GeometryShader
 
     TRACE("%p increasing refcount to %u.\n", shader, refcount);
 
+    if (refcount == 1)
+    {
+        ID3D11Device_AddRef(shader->device);
+        wined3d_mutex_lock();
+        wined3d_shader_incref(shader->wined3d_shader);
+        wined3d_mutex_unlock();
+    }
+
     return refcount;
 }
 
@@ -1890,6 +1914,14 @@ static ULONG STDMETHODCALLTYPE d3d11_compute_shader_AddRef(ID3D11ComputeShader *
 
     TRACE("%p increasing refcount to %u.\n", shader, refcount);
 
+    if (refcount == 1)
+    {
+        ID3D11Device_AddRef(shader->device);
+        wined3d_mutex_lock();
+        wined3d_shader_incref(shader->wined3d_shader);
+        wined3d_mutex_unlock();
+    }
+
     return refcount;
 }
 




More information about the wine-cvs mailing list