wined3d: Unload resources on Uninit3D().

This should prevent destroying GL objects without a GL context. Eg. when a ddraw
surface has a GL texture and is released after a call to Uninit3D().
This commit is contained in:
Henri Verbeet 2009-03-23 13:54:34 +01:00 committed by Alexandre Julliard
parent caca486029
commit 24a4503d61
1 changed files with 10 additions and 0 deletions

View File

@ -2568,6 +2568,13 @@ err_out:
return hr;
}
static HRESULT WINAPI device_unload_resource(IWineD3DResource *resource, void *ctx)
{
IWineD3DResource_UnLoad(resource);
IWineD3DResource_Release(resource);
return WINED3D_OK;
}
static HRESULT WINAPI IWineD3DDeviceImpl_Uninit3D(IWineD3DDevice *iface, D3DCB_DESTROYSURFACEFN D3DCB_DestroyDepthStencilSurface, D3DCB_DESTROYSWAPCHAINFN D3DCB_DestroySwapChain) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
int sampler;
@ -2583,6 +2590,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Uninit3D(IWineD3DDevice *iface, D3DCB_D
if(This->logo_surface) IWineD3DSurface_Release(This->logo_surface);
/* Unload resources */
IWineD3DDevice_EnumResources(iface, device_unload_resource, NULL);
TRACE("Deleting high order patches\n");
for(i = 0; i < PATCHMAP_SIZE; i++) {
struct list *e1, *e2;