Commit 7d5285ac authored by Stefan Doesinger's avatar Stefan Doesinger Committed by Alexandre Julliard

wined3d: Properly free srgb textures.

parent 2e119a27
......@@ -53,19 +53,7 @@ HRESULT basetexture_init(IWineD3DBaseTextureImpl *texture, UINT levels, WINED3DR
void basetexture_cleanup(IWineD3DBaseTexture *iface)
{
IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface;
IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
TRACE("(%p) : textureName(%d)\n", This, This->baseTexture.textureName);
if (This->baseTexture.textureName != 0) {
ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD);
ENTER_GL();
TRACE("(%p) : Deleting texture %d\n", This, This->baseTexture.textureName);
glDeleteTextures(1, &This->baseTexture.textureName);
glDeleteTextures(1, &This->baseTexture.srgbTextureName);
LEAVE_GL();
}
basetexture_unload(iface);
resource_cleanup((IWineD3DResource *)iface);
}
......@@ -78,8 +66,14 @@ void basetexture_unload(IWineD3DBaseTexture *iface)
ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD);
ENTER_GL();
glDeleteTextures(1, &This->baseTexture.textureName);
glDeleteTextures(1, &This->baseTexture.srgbTextureName);
This->baseTexture.textureName = 0;
LEAVE_GL();
}
if(This->baseTexture.srgbTextureName) {
ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD);
ENTER_GL();
glDeleteTextures(1, &This->baseTexture.srgbTextureName);
This->baseTexture.srgbTextureName = 0;
LEAVE_GL();
}
......
......@@ -892,6 +892,8 @@ static void WINAPI IWineD3DSurfaceImpl_UnLoad(IWineD3DSurface *iface) {
ENTER_GL();
glDeleteTextures(1, &This->glDescription.textureName);
This->glDescription.textureName = 0;
glDeleteTextures(1, &This->glDescription.srgbTextureName);
This->glDescription.srgbTextureName = 0;
LEAVE_GL();
} else {
IWineD3DBaseTexture_Release(texture);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment