[9/20] WineD3D: Do not keep internal references to the vertex declaration

Stefan Dösinger stefan at codeweavers.com
Sat Jan 6 11:24:47 CST 2007


Native Direct3D9 and our d3d9.dll do not addref objects when they are set in 
the stateblock, there are test cases for that in d3d9 and d3d8. WineD3D 
AddRefs them, but the addrefing is poorly defined, inconsistent and violates 
the native d3d9 refcounting, so I think it is better to remove it entirely.

Those patches should not be confused with the attempt to remove refcounting 
from wined3d from some months ago. Patch 10, 11, 12, 13 are simmilar for 
different objects.
-------------- next part --------------
From ac9c171c0e98e625007f3575446244d898ee0de4 Mon Sep 17 00:00:00 2001
From: Stefan Doesinger <stefan at codeweavers.com>
Date: Sat, 6 Jan 2007 16:45:38 +0100
Subject: [PATCH] WineD3D: Do not keep internal references to the vertex declaration

---
 dlls/wined3d/device.c     |    6 ------
 dlls/wined3d/stateblock.c |   11 -----------
 2 files changed, 0 insertions(+), 17 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index b13854b..8354114 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3239,12 +3239,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl
         return WINED3D_OK;
     }
 
-    if (NULL != pDecl) {
-        IWineD3DVertexDeclaration_AddRef(pDecl);
-    }
-    if (NULL != oldDecl) {
-        IWineD3DVertexDeclaration_Release(oldDecl);
-    }
     IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VDECL);
     return WINED3D_OK;
 }
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c
index 33d42ad..ca28027 100644
--- a/dlls/wined3d/stateblock.c
+++ b/dlls/wined3d/stateblock.c
@@ -254,10 +254,6 @@ static ULONG  WINAPI IWineD3DStateBlockI
                 IWineD3DVertexShader_Release(This->vertexShader);
             }
 
-            if (NULL != This->vertexDecl) {
-                IWineD3DVertexDeclaration_Release(This->vertexDecl);
-            }
-
             /* NOTE: according to MSDN: The application is responsible for making sure the texture references are cleared down */
             for (counter = 0; counter < GL_LIMITS(sampler_stages); counter++) {
                 if (This->textures[counter]) {
@@ -502,13 +498,6 @@ static HRESULT  WINAPI IWineD3DStateBloc
         if(This->set.vertexDecl && This->vertexDecl != targetStateBlock->vertexDecl){
             TRACE("Updating vertex declaration from %p to %p\n", This->vertexDecl, targetStateBlock->vertexDecl);
 
-            if (targetStateBlock->vertexDecl) {
-                IWineD3DVertexDeclaration_AddRef(targetStateBlock->vertexDecl);
-            }
-            if (This->vertexDecl) {
-                IWineD3DVertexDeclaration_Release(This->vertexDecl);
-            }
-
             This->vertexDecl = targetStateBlock->vertexDecl;
         }
 
-- 
1.4.2.4



More information about the wine-patches mailing list