Stefan Dösinger : wined3d: Move some UnLoad code to the base texture class.
Alexandre Julliard
julliard at winehq.org
Tue Feb 5 06:34:53 CST 2008
Module: wine
Branch: master
Commit: a0f2e6e55e467aa48c2833e12981323da10c16c9
URL: http://source.winehq.org/git/wine.git/?a=commit;h=a0f2e6e55e467aa48c2833e12981323da10c16c9
Author: Stefan Dösinger <stefan at codeweavers.com>
Date: Fri Jan 25 18:18:06 2008 +0100
wined3d: Move some UnLoad code to the base texture class.
---
dlls/wined3d/basetexture.c | 11 ++++++++++-
dlls/wined3d/cubetexture.c | 9 +--------
dlls/wined3d/texture.c | 9 +--------
dlls/wined3d/volumetexture.c | 9 +--------
dlls/wined3d/wined3d_private.h | 1 +
5 files changed, 14 insertions(+), 25 deletions(-)
diff --git a/dlls/wined3d/basetexture.c b/dlls/wined3d/basetexture.c
index a4ad820..da574a1 100644
--- a/dlls/wined3d/basetexture.c
+++ b/dlls/wined3d/basetexture.c
@@ -112,7 +112,16 @@ void WINAPI IWineD3DBaseTextureImpl_PreLoad(IWineD3DBaseTexture *ifac
}
void WINAPI IWineD3DBaseTextureImpl_UnLoad(IWineD3DBaseTexture *iface) {
- IWineD3DResourceImpl_UnLoad((IWineD3DResource *)iface);
+ IWineD3DTextureImpl *This = (IWineD3DTextureImpl *)iface;
+ IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
+
+ if(This->baseTexture.textureName) {
+ ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD);
+ ENTER_GL();
+ glDeleteTextures(1, &This->baseTexture.textureName);
+ This->baseTexture.textureName = 0;
+ LEAVE_GL();
+ }
}
WINED3DRESOURCETYPE WINAPI IWineD3DBaseTextureImpl_GetType(IWineD3DBaseTexture *iface) {
diff --git a/dlls/wined3d/cubetexture.c b/dlls/wined3d/cubetexture.c
index 6704b17..9e0769d 100644
--- a/dlls/wined3d/cubetexture.c
+++ b/dlls/wined3d/cubetexture.c
@@ -161,7 +161,6 @@ static void WINAPI IWineD3DCubeTextureImpl_PreLoad(IWineD3DCubeTexture *iface) {
static void WINAPI IWineD3DCubeTextureImpl_UnLoad(IWineD3DCubeTexture *iface) {
unsigned int i, j;
IWineD3DCubeTextureImpl *This = (IWineD3DCubeTextureImpl *)iface;
- IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
TRACE("(%p)\n", This);
/* Unload all the surfaces and reset the texture name. If UnLoad was called on the
@@ -175,13 +174,7 @@ static void WINAPI IWineD3DCubeTextureImpl_UnLoad(IWineD3DCubeTexture *iface) {
}
}
- if(This->baseTexture.textureName) {
- ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD);
- ENTER_GL();
- glDeleteTextures(1, &This->baseTexture.textureName);
- This->baseTexture.textureName = 0;
- LEAVE_GL();
- }
+ IWineD3DBaseTextureImpl_UnLoad((IWineD3DBaseTexture *) iface);
}
static WINED3DRESOURCETYPE WINAPI IWineD3DCubeTextureImpl_GetType(IWineD3DCubeTexture *iface) {
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index fe37e55..727636d 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -145,7 +145,6 @@ static void WINAPI IWineD3DTextureImpl_PreLoad(IWineD3DTexture *iface) {
static void WINAPI IWineD3DTextureImpl_UnLoad(IWineD3DTexture *iface) {
unsigned int i;
IWineD3DTextureImpl *This = (IWineD3DTextureImpl *)iface;
- IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
TRACE("(%p)\n", This);
/* Unload all the surfaces and reset the texture name. If UnLoad was called on the
@@ -157,13 +156,7 @@ static void WINAPI IWineD3DTextureImpl_UnLoad(IWineD3DTexture *iface) {
IWineD3DSurface_SetGlTextureDesc(This->surfaces[i], 0, IWineD3DTexture_GetTextureDimensions(iface));
}
- if(This->baseTexture.textureName) {
- ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD);
- ENTER_GL();
- glDeleteTextures(1, &This->baseTexture.textureName);
- This->baseTexture.textureName = 0;
- LEAVE_GL();
- }
+ IWineD3DBaseTextureImpl_UnLoad((IWineD3DBaseTexture *) iface);
}
static WINED3DRESOURCETYPE WINAPI IWineD3DTextureImpl_GetType(IWineD3DTexture *iface) {
diff --git a/dlls/wined3d/volumetexture.c b/dlls/wined3d/volumetexture.c
index 9cddb4f..6639f9c 100644
--- a/dlls/wined3d/volumetexture.c
+++ b/dlls/wined3d/volumetexture.c
@@ -138,7 +138,6 @@ static void WINAPI IWineD3DVolumeTextureImpl_PreLoad(IWineD3DVolumeTexture *ifac
static void WINAPI IWineD3DVolumeTextureImpl_UnLoad(IWineD3DVolumeTexture *iface) {
unsigned int i;
IWineD3DVolumeTextureImpl *This = (IWineD3DVolumeTextureImpl *)iface;
- IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
TRACE("(%p)\n", This);
/* Unload all the surfaces and reset the texture name. If UnLoad was called on the
@@ -149,13 +148,7 @@ static void WINAPI IWineD3DVolumeTextureImpl_UnLoad(IWineD3DVolumeTexture *iface
IWineD3DVolume_UnLoad(This->volumes[i]);
}
- if(This->baseTexture.textureName) {
- ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD);
- ENTER_GL();
- glDeleteTextures(1, &This->baseTexture.textureName);
- This->baseTexture.textureName = 0;
- LEAVE_GL();
- }
+ IWineD3DBaseTextureImpl_UnLoad((IWineD3DBaseTexture *) iface);
}
static WINED3DRESOURCETYPE WINAPI IWineD3DVolumeTextureImpl_GetType(IWineD3DVolumeTexture *iface) {
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 86f7869..bb99148 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1622,6 +1622,7 @@ unsigned int count_bits(unsigned int mask);
extern DWORD WINAPI IWineD3DBaseTextureImpl_SetPriority(IWineD3DBaseTexture *iface, DWORD PriorityNew);
extern DWORD WINAPI IWineD3DBaseTextureImpl_GetPriority(IWineD3DBaseTexture *iface);
extern void WINAPI IWineD3DBaseTextureImpl_PreLoad(IWineD3DBaseTexture *iface);
+ extern void WINAPI IWineD3DBaseTextureImpl_UnLoad(IWineD3DBaseTexture *iface);
extern WINED3DRESOURCETYPE WINAPI IWineD3DBaseTextureImpl_GetType(IWineD3DBaseTexture *iface);
/*** IWineD3DBaseTexture methods ***/
extern DWORD WINAPI IWineD3DBaseTextureImpl_SetLOD(IWineD3DBaseTexture *iface, DWORD LODNew);
More information about the wine-cvs
mailing list