From 87627c811e6df1b16eed40ec5b9754a5988fbf29 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Mon, 12 Jan 2009 10:17:50 +0100 Subject: [PATCH] wined3d: Get rid of D3DINITIALIZEBASETEXTURE. --- dlls/wined3d/basetexture.c | 10 ++++++++++ dlls/wined3d/device.c | 15 +++------------ dlls/wined3d/wined3d_private.h | 1 + 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/dlls/wined3d/basetexture.c b/dlls/wined3d/basetexture.c index 8622e94bd14..f6189b6a1df 100644 --- a/dlls/wined3d/basetexture.c +++ b/dlls/wined3d/basetexture.c @@ -27,6 +27,16 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d_texture); #define GLINFO_LOCATION This->resource.wineD3DDevice->adapter->gl_info +void basetexture_init(struct IWineD3DBaseTextureClass *texture, UINT levels, DWORD usage) +{ + texture->levels = levels; + texture->filterType = (usage & WINED3DUSAGE_AUTOGENMIPMAP) ? WINED3DTEXF_LINEAR : WINED3DTEXF_NONE; + texture->LOD = 0; + texture->dirty = TRUE; + texture->is_srgb = FALSE; + texture->srgb_mode_change_count = 0; +} + void basetexture_cleanup(IWineD3DBaseTexture *iface) { IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface; diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index ba9ab1efcc3..9fb7485a6cf 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -115,15 +115,6 @@ static void IWineD3DDeviceImpl_AddResource(IWineD3DDevice *iface, IWineD3DResour TRACE("(%p) : Created resource %p\n", This, object); \ } -#define D3DINITIALIZEBASETEXTURE(_basetexture) { \ - _basetexture.levels = Levels; \ - _basetexture.filterType = (Usage & WINED3DUSAGE_AUTOGENMIPMAP) ? WINED3DTEXF_LINEAR : WINED3DTEXF_NONE; \ - _basetexture.LOD = 0; \ - _basetexture.dirty = TRUE; \ - _basetexture.is_srgb = FALSE; \ - _basetexture.srgb_mode_change_count = 0; \ -} - /********************************************************** * Global variable / Constants follow **********************************************************/ @@ -792,7 +783,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateTexture(IWineD3DDevice *iface, U } D3DCREATERESOURCEOBJECTINSTANCE(object, Texture, WINED3DRTYPE_TEXTURE, 0); - D3DINITIALIZEBASETEXTURE(object->baseTexture); + basetexture_init(&object->baseTexture, Levels, Usage); object->width = Width; object->height = Height; @@ -937,7 +928,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVolumeTexture(IWineD3DDevice *ifa } D3DCREATERESOURCEOBJECTINSTANCE(object, VolumeTexture, WINED3DRTYPE_VOLUMETEXTURE, 0); - D3DINITIALIZEBASETEXTURE(object->baseTexture); + basetexture_init(&object->baseTexture, Levels, Usage); TRACE("(%p) : W(%d) H(%d) D(%d), Lvl(%d) Usage(%d), Fmt(%u,%s), Pool(%s)\n", This, Width, Height, Depth, Levels, Usage, Format, debug_d3dformat(Format), debug_d3dpool(Pool)); @@ -1070,7 +1061,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateCubeTexture(IWineD3DDevice *iface } D3DCREATERESOURCEOBJECTINSTANCE(object, CubeTexture, WINED3DRTYPE_CUBETEXTURE, 0); - D3DINITIALIZEBASETEXTURE(object->baseTexture); + basetexture_init(&object->baseTexture, Levels, Usage); TRACE("(%p) Create Cube Texture\n", This); diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 3b8e1f62f51..03b5242f55e 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -1377,6 +1377,7 @@ WINED3DTEXTUREFILTERTYPE basetexture_get_autogen_filter_type(IWineD3DBaseTexture BOOL basetexture_get_dirty(IWineD3DBaseTexture *iface); DWORD basetexture_get_level_count(IWineD3DBaseTexture *iface); DWORD basetexture_get_lod(IWineD3DBaseTexture *iface); +void basetexture_init(struct IWineD3DBaseTextureClass *texture, UINT levels, DWORD usage); HRESULT basetexture_set_autogen_filter_type(IWineD3DBaseTexture *iface, WINED3DTEXTUREFILTERTYPE filter_type); BOOL basetexture_set_dirty(IWineD3DBaseTexture *iface, BOOL dirty); DWORD basetexture_set_lod(IWineD3DBaseTexture *iface, DWORD new_lod);