From 482a5fd030846c5d90b97db75f167d1a4277f448 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Sun, 2 Jan 2011 12:26:35 +0100 Subject: [PATCH] wined3d: Pass an IWineD3DBaseTextureImpl pointer to basetexture_set_lod(). --- dlls/wined3d/basetexture.c | 35 +++++++++++++++++----------------- dlls/wined3d/cubetexture.c | 2 +- dlls/wined3d/texture.c | 2 +- dlls/wined3d/volumetexture.c | 2 +- dlls/wined3d/wined3d_private.h | 2 +- 5 files changed, 21 insertions(+), 22 deletions(-) diff --git a/dlls/wined3d/basetexture.c b/dlls/wined3d/basetexture.c index cd1b6874bc7..d1d7f10399d 100644 --- a/dlls/wined3d/basetexture.c +++ b/dlls/wined3d/basetexture.c @@ -127,34 +127,33 @@ void basetexture_unload(IWineD3DBaseTextureImpl *texture) resource_unload((IWineD3DResourceImpl *)texture); } -DWORD basetexture_set_lod(IWineD3DBaseTexture *iface, DWORD LODNew) +DWORD basetexture_set_lod(IWineD3DBaseTextureImpl *texture, DWORD lod) { - IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface; - DWORD old = This->baseTexture.LOD; + DWORD old = texture->baseTexture.LOD; + + TRACE("texture %p, lod %u.\n", texture, lod); /* The d3d9:texture test shows that SetLOD is ignored on non-managed - * textures. The call always returns 0, and GetLOD always returns 0 - */ - if (This->resource.pool != WINED3DPOOL_MANAGED) { - TRACE("Ignoring SetLOD on %s texture, returning 0\n", debug_d3dpool(This->resource.pool)); + * textures. The call always returns 0, and GetLOD always returns 0. */ + if (texture->resource.pool != WINED3DPOOL_MANAGED) + { + TRACE("Ignoring SetLOD on %s texture, returning 0.\n", debug_d3dpool(texture->resource.pool)); return 0; } - if (LODNew >= This->baseTexture.level_count) - LODNew = This->baseTexture.level_count - 1; + if (lod >= texture->baseTexture.level_count) + lod = texture->baseTexture.level_count - 1; - if(This->baseTexture.LOD != LODNew) { - This->baseTexture.LOD = LODNew; + if (texture->baseTexture.LOD != lod) + { + texture->baseTexture.LOD = lod; - This->baseTexture.texture_rgb.states[WINED3DTEXSTA_MAXMIPLEVEL] = ~0U; - This->baseTexture.texture_srgb.states[WINED3DTEXSTA_MAXMIPLEVEL] = ~0U; - if(This->baseTexture.bindCount) { - IWineD3DDeviceImpl_MarkStateDirty(This->resource.device, STATE_SAMPLER(This->baseTexture.sampler)); - } + texture->baseTexture.texture_rgb.states[WINED3DTEXSTA_MAXMIPLEVEL] = ~0U; + texture->baseTexture.texture_srgb.states[WINED3DTEXSTA_MAXMIPLEVEL] = ~0U; + if (texture->baseTexture.bindCount) + IWineD3DDeviceImpl_MarkStateDirty(texture->resource.device, STATE_SAMPLER(texture->baseTexture.sampler)); } - TRACE("(%p) : set LOD to %d\n", This, This->baseTexture.LOD); - return old; } diff --git a/dlls/wined3d/cubetexture.c b/dlls/wined3d/cubetexture.c index da397017636..f82b02e43fa 100644 --- a/dlls/wined3d/cubetexture.c +++ b/dlls/wined3d/cubetexture.c @@ -247,7 +247,7 @@ static void * WINAPI IWineD3DCubeTextureImpl_GetParent(IWineD3DCubeTexture *ifac IWineD3DCubeTexture IWineD3DBaseTexture parts follow ****************************************************** */ static DWORD WINAPI IWineD3DCubeTextureImpl_SetLOD(IWineD3DCubeTexture *iface, DWORD LODNew) { - return basetexture_set_lod((IWineD3DBaseTexture *)iface, LODNew); + return basetexture_set_lod((IWineD3DBaseTextureImpl *)iface, LODNew); } static DWORD WINAPI IWineD3DCubeTextureImpl_GetLOD(IWineD3DCubeTexture *iface) { diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c index d3a757fa20a..2bda3d6dde6 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -238,7 +238,7 @@ static void * WINAPI IWineD3DTextureImpl_GetParent(IWineD3DTexture *iface) IWineD3DTexture IWineD3DBaseTexture parts follow ****************************************************** */ static DWORD WINAPI IWineD3DTextureImpl_SetLOD(IWineD3DTexture *iface, DWORD LODNew) { - return basetexture_set_lod((IWineD3DBaseTexture *)iface, LODNew); + return basetexture_set_lod((IWineD3DBaseTextureImpl *)iface, LODNew); } static DWORD WINAPI IWineD3DTextureImpl_GetLOD(IWineD3DTexture *iface) { diff --git a/dlls/wined3d/volumetexture.c b/dlls/wined3d/volumetexture.c index b2a61028c85..7ec81f1d4da 100644 --- a/dlls/wined3d/volumetexture.c +++ b/dlls/wined3d/volumetexture.c @@ -202,7 +202,7 @@ static void * WINAPI IWineD3DVolumeTextureImpl_GetParent(IWineD3DVolumeTexture * IWineD3DVolumeTexture IWineD3DBaseTexture parts follow ****************************************************** */ static DWORD WINAPI IWineD3DVolumeTextureImpl_SetLOD(IWineD3DVolumeTexture *iface, DWORD LODNew) { - return basetexture_set_lod((IWineD3DBaseTexture *)iface, LODNew); + return basetexture_set_lod((IWineD3DBaseTextureImpl *)iface, LODNew); } static DWORD WINAPI IWineD3DVolumeTextureImpl_GetLOD(IWineD3DVolumeTexture *iface) { diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index e73776e61f2..49c1f6fa467 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -1927,7 +1927,7 @@ HRESULT basetexture_init(IWineD3DBaseTextureImpl *texture, UINT layer_count, UIN HRESULT basetexture_set_autogen_filter_type(IWineD3DBaseTexture *iface, WINED3DTEXTUREFILTERTYPE filter_type) DECLSPEC_HIDDEN; BOOL basetexture_set_dirty(IWineD3DBaseTextureImpl *texture, BOOL dirty) DECLSPEC_HIDDEN; -DWORD basetexture_set_lod(IWineD3DBaseTexture *iface, DWORD new_lod) DECLSPEC_HIDDEN; +DWORD basetexture_set_lod(IWineD3DBaseTextureImpl *texture, DWORD lod) DECLSPEC_HIDDEN; void basetexture_unload(IWineD3DBaseTextureImpl *texture) DECLSPEC_HIDDEN; /*****************************************************************************