From 09bf3d5aeaa27f0e1c6c0244e4237c3ab7d20757 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Tue, 8 Jan 2008 20:45:59 +0100 Subject: [PATCH] wined3d: Keep track of shaders. --- dlls/wined3d/baseshader.c | 1 + dlls/wined3d/device.c | 2 ++ dlls/wined3d/directx.c | 1 + dlls/wined3d/wined3d_private.h | 2 ++ 4 files changed, 6 insertions(+) diff --git a/dlls/wined3d/baseshader.c b/dlls/wined3d/baseshader.c index 0a0c10e333c..858bf7f31c1 100644 --- a/dlls/wined3d/baseshader.c +++ b/dlls/wined3d/baseshader.c @@ -1142,6 +1142,7 @@ ULONG WINAPI IWineD3DBaseShaderImpl_Release(IWineD3DBaseShader *iface) { shader_delete_constant_list(&This->baseShader.constantsF); shader_delete_constant_list(&This->baseShader.constantsB); shader_delete_constant_list(&This->baseShader.constantsI); + list_remove(&This->baseShader.shader_list_entry); HeapFree(GetProcessHeap(), 0, This); } return ref; diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index e5721d1d1b3..e0e3bf22265 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -1883,6 +1883,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexShader(IWineD3DDevice *ifac IWineD3DVertexShader_Release(*ppVertexShader); return WINED3DERR_INVALIDCALL; } + list_add_head(&This->shaders, &object->baseShader.shader_list_entry); return WINED3D_OK; } @@ -1897,6 +1898,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreatePixelShader(IWineD3DDevice *iface hr = IWineD3DPixelShader_SetFunction(*ppPixelShader, pFunction); if (WINED3D_OK == hr) { TRACE("(%p) : Created Pixel shader %p\n", This, *ppPixelShader); + list_add_head(&This->shaders, &object->baseShader.shader_list_entry); } else { WARN("(%p) : Failed to create pixel shader\n", This); } diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index aac3c7b7a9b..f1c71005725 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -2742,6 +2742,7 @@ static HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT Adapter, IWineD3D_AddRef(object->wineD3D); object->parent = parent; list_init(&object->resources); + list_init(&object->shaders); if(This->dxVersion == 7) { object->surface_alignment = 8; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 41c036d8462..7c95275fc4d 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -675,6 +675,7 @@ struct IWineD3DDeviceImpl UINT NumberOfSwapChains; struct list resources; /* a linked list to track resources created by the device */ + struct list shaders; /* a linked list to track shaders (pixel and vertex) */ /* Render Target Support */ IWineD3DSurface **render_targets; @@ -1970,6 +1971,7 @@ typedef struct IWineD3DBaseShaderClass /* Pointer to the parent device */ IWineD3DDevice *device; + struct list shader_list_entry; } IWineD3DBaseShaderClass;