H. Verbeet : wined3d: Don't change the shader's refcount in SetVertexShader and

Alexandre Julliard julliard at wine.codeweavers.com
Tue Dec 13 04:58:24 CST 2005


Module: wine
Branch: refs/heads/master
Commit: 6077c63feb2e0d70a077fbda3c1978c95f4c113f
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=6077c63feb2e0d70a077fbda3c1978c95f4c113f

Author: H. Verbeet <hverbeet at gmail.com>
Date:   Tue Dec 13 11:11:01 2005 +0100

wined3d: Don't change the shader's refcount in SetVertexShader and
SetPixelShader.

---

 dlls/wined3d/device.c |   37 +++----------------------------------
 1 files changed, 3 insertions(+), 34 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index c3a7f9c..a9c253f 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3761,7 +3761,6 @@ HRESULT WINAPI IWineD3DDeviceImpl_GetVer
 
 HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShader(IWineD3DDevice *iface, IWineD3DVertexShader* pShader) {
     IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
-    IWineD3DVertexShader *oldShader = This->updateStateBlock->vertexShader;
 
     This->updateStateBlock->vertexShader = pShader;
     This->updateStateBlock->changed.vertexShader = TRUE;
@@ -3772,20 +3771,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetVer
         return D3D_OK;
     }
 
-    if (pShader != NULL) {
-        IUnknown *newVertexShaderParent;
-        /* GetParent will add a ref, so leave it hanging until the vertex buffer is cleared */
-        TRACE("(%p) : setting pShader(%p)\n", This, pShader);
-        IWineD3DVertexShader_GetParent(pShader, &newVertexShaderParent);
-    } else {
-        TRACE("Clear down the shader\n");
-    }
-    if (oldShader != NULL) {
-        IUnknown *oldVertexShaderParent;
-        IWineD3DVertexShader_GetParent(oldShader, &oldVertexShaderParent);
-        IUnknown_Release(oldVertexShaderParent);
-        IUnknown_Release(oldVertexShaderParent);
-    }
+    TRACE("(%p) : setting pShader(%p)\n", This, pShader);
     /**
      * TODO: merge HAL shaders context switching from prototype
      */
@@ -3947,39 +3933,22 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetVer
 #undef GET_SHADER_CONSTANT
 
 HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShader(IWineD3DDevice *iface, IWineD3DPixelShader *pShader) {
-    IUnknown *parent;
     IWineD3DDeviceImpl *This        = (IWineD3DDeviceImpl *)iface;
-    IWineD3DPixelShader *oldpShader = This->updateStateBlock->pixelShader;
 
     This->updateStateBlock->pixelShader         = pShader;
     This->updateStateBlock->changed.pixelShader = TRUE;
     This->updateStateBlock->set.pixelShader     = TRUE;
 
-    if (pShader == NULL) {
-        /* clear down the shader */
-        TRACE("Clear down the shader\n");
-    }
-
     /* Handle recording of state blocks */
     if (This->isRecordingState) {
         TRACE("Recording... not performing anything\n");
         return D3D_OK;
     }
+
+    TRACE("(%p) : setting pShader(%p)\n", This, pShader);
     /**
      * TODO: merge HAL shaders context switching from prototype
      */
-
-    /* manage reference counting. */
-    if (pShader != NULL) {
-        IWineD3DPixelShader_GetParent(pShader, &parent); /* get parent adds a ref for us*/
-    }
-
-    if (oldpShader != NULL) {
-        IWineD3DPixelShader_GetParent(oldpShader, &parent);
-        IUnknown_Release(parent); /* once for the getparent */
-        IUnknown_Release(parent); /* and once for the ref */
-    }
-
     return D3D_OK;
 }
 




More information about the wine-cvs mailing list