d3d: Callback infrastructure for implicit depth stencil surface destruction in IWineD3DDevice.
This commit is contained in:
parent
50a0c21265
commit
3fd04308ab
|
@ -591,4 +591,6 @@ extern HRESULT WINAPI D3D8CB_CreateRenderTarget(IUnknown *device, IUnknown *pSup
|
|||
DWORD MultisampleQuality, BOOL Lockable,
|
||||
IWineD3DSurface** ppSurface, HANDLE* pSharedHandle);
|
||||
|
||||
extern ULONG WINAPI D3D8CB_DestroyDepthStencilSurface (IWineD3DSurface *pSurface);
|
||||
|
||||
#endif /* __WINE_D3DX8_PRIVATE_H */
|
||||
|
|
|
@ -95,7 +95,7 @@ static ULONG WINAPI IDirect3DDevice8Impl_Release(LPDIRECT3DDEVICE8 iface) {
|
|||
|
||||
if (ref == 0) {
|
||||
TRACE("Releasing wined3d device %p\n", This->WineD3DDevice);
|
||||
IWineD3DDevice_Uninit3D(This->WineD3DDevice);
|
||||
IWineD3DDevice_Uninit3D(This->WineD3DDevice, D3D8CB_DestroyDepthStencilSurface);
|
||||
IWineD3DDevice_Release(This->WineD3DDevice);
|
||||
HeapFree(GetProcessHeap(), 0, This->shader_handles);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
|
|
|
@ -285,6 +285,15 @@ HRESULT WINAPI D3D8CB_CreateDepthStencilSurface(IUnknown *device, IUnknown *pSup
|
|||
return res;
|
||||
}
|
||||
|
||||
ULONG WINAPI D3D8CB_DestroyDepthStencilSurface(IWineD3DSurface *pSurface) {
|
||||
IDirect3DSurface8Impl* surfaceParent;
|
||||
TRACE("(%p) call back\n", pSurface);
|
||||
|
||||
IWineD3DSurface_GetParent(pSurface, (IUnknown **) &surfaceParent);
|
||||
IDirect3DSurface8_Release((IDirect3DSurface8*) surfaceParent);
|
||||
return IDirect3DSurface8_Release((IDirect3DSurface8*) surfaceParent);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDirect3D8Impl_CreateDevice(LPDIRECT3D8 iface, UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow,
|
||||
DWORD BehaviourFlags, D3DPRESENT_PARAMETERS* pPresentationParameters,
|
||||
IDirect3DDevice8** ppReturnedDeviceInterface) {
|
||||
|
|
|
@ -541,4 +541,6 @@ extern HRESULT WINAPI D3D9CB_CreateRenderTarget(IUnknown *device, IUnknown *pSup
|
|||
DWORD MultisampleQuality, BOOL Lockable,
|
||||
IWineD3DSurface** ppSurface, HANDLE* pSharedHandle);
|
||||
|
||||
extern ULONG WINAPI D3D9CB_DestroyDepthStencilSurface (IWineD3DSurface *pSurface);
|
||||
|
||||
#endif /* __WINE_D3D9_PRIVATE_H */
|
||||
|
|
|
@ -58,7 +58,7 @@ static ULONG WINAPI IDirect3DDevice9Impl_Release(LPDIRECT3DDEVICE9 iface) {
|
|||
TRACE("(%p) : ReleaseRef to %d\n", This, ref);
|
||||
|
||||
if (ref == 0) {
|
||||
IWineD3DDevice_Uninit3D(This->WineD3DDevice);
|
||||
IWineD3DDevice_Uninit3D(This->WineD3DDevice, D3D9CB_DestroyDepthStencilSurface);
|
||||
IWineD3DDevice_Release(This->WineD3DDevice);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
}
|
||||
|
|
|
@ -269,6 +269,14 @@ HRESULT WINAPI D3D9CB_CreateDepthStencilSurface(IUnknown *device, IUnknown *pSup
|
|||
return res;
|
||||
}
|
||||
|
||||
ULONG WINAPI D3D9CB_DestroyDepthStencilSurface(IWineD3DSurface *pSurface) {
|
||||
IDirect3DSurface9Impl* surfaceParent;
|
||||
TRACE("(%p) call back\n", pSurface);
|
||||
|
||||
IWineD3DSurface_GetParent(pSurface, (IUnknown **) &surfaceParent);
|
||||
IDirect3DSurface9_Release((IDirect3DSurface9*) surfaceParent);
|
||||
return IDirect3DSurface9_Release((IDirect3DSurface9*) surfaceParent);
|
||||
}
|
||||
|
||||
HRESULT WINAPI IDirect3D9Impl_CreateDevice(LPDIRECT3D9 iface, UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow,
|
||||
DWORD BehaviourFlags, D3DPRESENT_PARAMETERS* pPresentationParameters,
|
||||
|
|
|
@ -1621,7 +1621,7 @@ IDirectDrawImpl_RecreateAllSurfaces(IDirectDrawImpl *This)
|
|||
/* Should happen almost never */
|
||||
FIXME("(%p) Switching to non-opengl surfaces with d3d started. Is this a bug?\n", This);
|
||||
/* Shutdown d3d */
|
||||
IWineD3DDevice_Uninit3D(This->wineD3DDevice);
|
||||
IWineD3DDevice_Uninit3D(This->wineD3DDevice, D3D7CB_DestroyDepthStencilSurface);
|
||||
}
|
||||
/* Contrary: D3D starting is handled by the caller, because it knows the render target */
|
||||
|
||||
|
@ -1679,6 +1679,15 @@ D3D7CB_CreateSurface(IUnknown *device,
|
|||
return D3D_OK;
|
||||
}
|
||||
|
||||
ULONG WINAPI D3D7CB_DestroyDepthStencilSurface(IWineD3DSurface *pSurface) {
|
||||
IUnknown* surfaceParent;
|
||||
TRACE("(%p) call back\n", pSurface);
|
||||
|
||||
IWineD3DSurface_GetParent(pSurface, (IUnknown **) &surfaceParent);
|
||||
IUnknown_Release(surfaceParent);
|
||||
return IUnknown_Release(surfaceParent);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* IDirectDrawImpl_CreateNewSurface
|
||||
*
|
||||
|
|
|
@ -75,6 +75,9 @@ typedef struct IDirect3DExecuteBufferImpl IDirect3DExecuteBufferImpl;
|
|||
typedef struct IDirect3DVertexBufferImpl IDirect3DVertexBufferImpl;
|
||||
typedef struct IParentImpl IParentImpl;
|
||||
|
||||
/* Callbacks for implicit object destruction */
|
||||
extern ULONG WINAPI D3D7CB_DestroyDepthStencilSurface(IWineD3DSurface *pSurface);
|
||||
|
||||
/*****************************************************************************
|
||||
* IDirectDraw implementation structure
|
||||
*****************************************************************************/
|
||||
|
|
|
@ -311,7 +311,7 @@ IDirectDrawSurfaceImpl_Release(IDirectDrawSurface7 *iface)
|
|||
IWineD3DDevice_SetIndices(ddraw->wineD3DDevice, NULL, 0);
|
||||
IWineD3DDevice_SetDepthStencilSurface(ddraw->wineD3DDevice, NULL);
|
||||
|
||||
if(IWineD3DDevice_Uninit3D(ddraw->wineD3DDevice) != D3D_OK)
|
||||
if(IWineD3DDevice_Uninit3D(ddraw->wineD3DDevice, D3D7CB_DestroyDepthStencilSurface) != D3D_OK)
|
||||
{
|
||||
/* Not good */
|
||||
ERR("(%p) Failed to uninit 3D\n", This);
|
||||
|
|
|
@ -2148,10 +2148,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Init3D(IWineD3DDevice *iface, WINED3DPR
|
|||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IWineD3DDeviceImpl_Uninit3D(IWineD3DDevice *iface) {
|
||||
static HRESULT WINAPI IWineD3DDeviceImpl_Uninit3D(IWineD3DDevice *iface, D3DCB_DESTROYSURFACEFN D3DCB_DestroyDepthStencilSurface) {
|
||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
|
||||
int sampler;
|
||||
IUnknown* stencilBufferParent;
|
||||
IUnknown* swapChainParent;
|
||||
uint i;
|
||||
TRACE("(%p)\n", This);
|
||||
|
@ -2186,10 +2185,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Uninit3D(IWineD3DDevice *iface) {
|
|||
This->renderTarget = NULL;
|
||||
|
||||
if (This->depthStencilBuffer) {
|
||||
IWineD3DSurface_GetParent(This->depthStencilBuffer, &stencilBufferParent);
|
||||
IUnknown_Release(stencilBufferParent); /* once for the get parent */
|
||||
if(IUnknown_Release(stencilBufferParent) >0){ /* the second time for when it was created */
|
||||
FIXME("(%p) Something's still holding the depthStencilBuffer\n",This);
|
||||
if(D3DCB_DestroyDepthStencilSurface > 0) {
|
||||
FIXME("(%p) Something's still holding the depthStencilBuffer\n", This);
|
||||
}
|
||||
This->depthStencilBuffer = NULL;
|
||||
}
|
||||
|
|
|
@ -359,7 +359,7 @@ DECLARE_INTERFACE_(IWineD3DDevice,IWineD3DBase)
|
|||
STDMETHOD(CreatePixelShader)(THIS_ CONST DWORD* pFunction, struct IWineD3DPixelShader** ppShader, IUnknown *pParent) PURE;
|
||||
STDMETHOD_(HRESULT,CreatePalette)(THIS_ DWORD Flags, PALETTEENTRY *PalEnt, struct IWineD3DPalette **Palette, IUnknown *Parent);
|
||||
STDMETHOD(Init3D)(THIS_ WINED3DPRESENT_PARAMETERS* pPresentationParameters, D3DCB_CREATEADDITIONALSWAPCHAIN D3DCB_CreateAdditionalSwapChain);
|
||||
STDMETHOD(Uninit3D)(THIS);
|
||||
STDMETHOD(Uninit3D)(THIS, D3DCB_DESTROYSURFACEFN pFn);
|
||||
STDMETHOD_(void, SetFullscreen)(THIS_ BOOL fullscreen);
|
||||
STDMETHOD(EnumDisplayModes)(THIS_ DWORD Flags, UINT Width, UINT Height, WINED3DFORMAT Format, void *context, D3DCB_ENUMDISPLAYMODESCALLBACK cb) PURE;
|
||||
STDMETHOD(EvictManagedResources)(THIS) PURE;
|
||||
|
@ -499,7 +499,7 @@ DECLARE_INTERFACE_(IWineD3DDevice,IWineD3DBase)
|
|||
#define IWineD3DDevice_CreatePixelShader(p,a,b,c) (p)->lpVtbl->CreatePixelShader(p,a,b,c)
|
||||
#define IWineD3DDevice_CreatePalette(p, a, b, c, d) (p)->lpVtbl->CreatePalette(p, a, b, c, d)
|
||||
#define IWineD3DDevice_Init3D(p, a, b) (p)->lpVtbl->Init3D(p, a, b)
|
||||
#define IWineD3DDevice_Uninit3D(p) (p)->lpVtbl->Uninit3D(p)
|
||||
#define IWineD3DDevice_Uninit3D(p, a) (p)->lpVtbl->Uninit3D(p, a)
|
||||
#define IWineD3DDevice_SetFullscreen(p, a) (p)->lpVtbl->SetFullscreen(p, a)
|
||||
#define IWineD3DDevice_EnumDisplayModes(p,a,b,c,d,e,f) (p)->lpVtbl->EnumDisplayModes(p,a,b,c,d,e,f)
|
||||
#define IWineD3DDevice_EvictManagedResources(p) (p)->lpVtbl->EvictManagedResources(p)
|
||||
|
|
Loading…
Reference in New Issue