Module: wine Branch: master Commit: 568f9ecb22414c236670953b66ab666961b281d8 URL: http://source.winehq.org/git/wine.git/?a=commit;h=568f9ecb22414c236670953b66...
Author: Henri Verbeet hverbeet@codeweavers.com Date: Sun Jan 2 12:26:37 2011 +0100
wined3d: Pass an IWineD3DBaseTextureImpl pointer to basetexture_set_autogen_filter_type().
---
dlls/wined3d/basetexture.c | 88 ++++++++++++++++++++------------------- dlls/wined3d/cubetexture.c | 6 ++- dlls/wined3d/texture.c | 6 ++- dlls/wined3d/volumetexture.c | 6 ++- dlls/wined3d/wined3d_private.h | 2 +- 5 files changed, 58 insertions(+), 50 deletions(-)
diff --git a/dlls/wined3d/basetexture.c b/dlls/wined3d/basetexture.c index 15a58fd..d1c27e8 100644 --- a/dlls/wined3d/basetexture.c +++ b/dlls/wined3d/basetexture.c @@ -170,50 +170,52 @@ DWORD basetexture_get_level_count(IWineD3DBaseTextureImpl *texture) return texture->baseTexture.level_count; }
-HRESULT basetexture_set_autogen_filter_type(IWineD3DBaseTexture *iface, WINED3DTEXTUREFILTERTYPE FilterType) +HRESULT basetexture_set_autogen_filter_type(IWineD3DBaseTextureImpl *texture, WINED3DTEXTUREFILTERTYPE filter_type) { - IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface; - IWineD3DDeviceImpl *device = This->resource.device; - GLenum textureDimensions = This->baseTexture.target; - - if (!(This->resource.usage & WINED3DUSAGE_AUTOGENMIPMAP)) { - TRACE("(%p) : returning invalid call\n", This); - return WINED3DERR_INVALIDCALL; - } - if(This->baseTexture.filterType != FilterType) { - /* What about multithreading? Do we want all the context overhead just to set this value? - * Or should we delay the applying until the texture is used for drawing? For now, apply - * immediately. - */ - struct wined3d_context *context = context_acquire(device, NULL); - - ENTER_GL(); - glBindTexture(textureDimensions, This->baseTexture.texture_rgb.name); - checkGLcall("glBindTexture"); - switch(FilterType) { - case WINED3DTEXF_NONE: - case WINED3DTEXF_POINT: - glTexParameteri(textureDimensions, GL_GENERATE_MIPMAP_HINT_SGIS, GL_FASTEST); - checkGLcall("glTexParameteri(textureDimensions, GL_GENERATE_MIPMAP_HINT_SGIS, GL_FASTEST)"); - - break; - case WINED3DTEXF_LINEAR: - glTexParameteri(textureDimensions, GL_GENERATE_MIPMAP_HINT_SGIS, GL_NICEST); - checkGLcall("glTexParameteri(textureDimensions, GL_GENERATE_MIPMAP_HINT_SGIS, GL_NICEST)"); - - break; - default: - WARN("Unexpected filter type %d, setting to GL_NICEST\n", FilterType); - glTexParameteri(textureDimensions, GL_GENERATE_MIPMAP_HINT_SGIS, GL_NICEST); - checkGLcall("glTexParameteri(textureDimensions, GL_GENERATE_MIPMAP_HINT_SGIS, GL_NICEST)"); - } - LEAVE_GL(); - - context_release(context); - } - This->baseTexture.filterType = FilterType; - TRACE("(%p) :\n", This); - return WINED3D_OK; + TRACE("texture %p, filter_type %s.\n", texture, debug_d3dtexturefiltertype(filter_type)); + + if (!(texture->resource.usage & WINED3DUSAGE_AUTOGENMIPMAP)) + { + WARN("Texture doesn't have AUTOGENMIPMAP usage.\n"); + return WINED3DERR_INVALIDCALL; + } + + if (texture->baseTexture.filterType != filter_type) + { + GLenum target = texture->baseTexture.target; + struct wined3d_context *context; + + context = context_acquire(texture->resource.device, NULL); + + ENTER_GL(); + glBindTexture(target, texture->baseTexture.texture_rgb.name); + checkGLcall("glBindTexture"); + switch (filter_type) + { + case WINED3DTEXF_NONE: + case WINED3DTEXF_POINT: + glTexParameteri(target, GL_GENERATE_MIPMAP_HINT_SGIS, GL_FASTEST); + checkGLcall("glTexParameteri(target, GL_GENERATE_MIPMAP_HINT_SGIS, GL_FASTEST)"); + break; + + case WINED3DTEXF_LINEAR: + glTexParameteri(target, GL_GENERATE_MIPMAP_HINT_SGIS, GL_NICEST); + checkGLcall("glTexParameteri(target, GL_GENERATE_MIPMAP_HINT_SGIS, GL_NICEST)"); + break; + + default: + WARN("Unexpected filter type %#x, setting to GL_NICEST.\n", filter_type); + glTexParameteri(target, GL_GENERATE_MIPMAP_HINT_SGIS, GL_NICEST); + checkGLcall("glTexParameteri(target, GL_GENERATE_MIPMAP_HINT_SGIS, GL_NICEST)"); + break; + } + LEAVE_GL(); + + context_release(context); + } + texture->baseTexture.filterType = filter_type; + + return WINED3D_OK; }
WINED3DTEXTUREFILTERTYPE basetexture_get_autogen_filter_type(IWineD3DBaseTexture *iface) diff --git a/dlls/wined3d/cubetexture.c b/dlls/wined3d/cubetexture.c index ffd0da6..8dc2579 100644 --- a/dlls/wined3d/cubetexture.c +++ b/dlls/wined3d/cubetexture.c @@ -259,8 +259,10 @@ static DWORD WINAPI IWineD3DCubeTextureImpl_GetLevelCount(IWineD3DCubeTexture *i return basetexture_get_level_count((IWineD3DBaseTextureImpl *)iface); }
-static HRESULT WINAPI IWineD3DCubeTextureImpl_SetAutoGenFilterType(IWineD3DCubeTexture *iface, WINED3DTEXTUREFILTERTYPE FilterType) { - return basetexture_set_autogen_filter_type((IWineD3DBaseTexture *)iface, FilterType); +static HRESULT WINAPI IWineD3DCubeTextureImpl_SetAutoGenFilterType(IWineD3DCubeTexture *iface, + WINED3DTEXTUREFILTERTYPE FilterType) +{ + return basetexture_set_autogen_filter_type((IWineD3DBaseTextureImpl *)iface, FilterType); }
static WINED3DTEXTUREFILTERTYPE WINAPI IWineD3DCubeTextureImpl_GetAutoGenFilterType(IWineD3DCubeTexture *iface) { diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c index 6acd737..63cf182 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -250,8 +250,10 @@ static DWORD WINAPI IWineD3DTextureImpl_GetLevelCount(IWineD3DTexture *iface) return basetexture_get_level_count((IWineD3DBaseTextureImpl *)iface); }
-static HRESULT WINAPI IWineD3DTextureImpl_SetAutoGenFilterType(IWineD3DTexture *iface, WINED3DTEXTUREFILTERTYPE FilterType) { - return basetexture_set_autogen_filter_type((IWineD3DBaseTexture *)iface, FilterType); +static HRESULT WINAPI IWineD3DTextureImpl_SetAutoGenFilterType(IWineD3DTexture *iface, + WINED3DTEXTUREFILTERTYPE FilterType) +{ + return basetexture_set_autogen_filter_type((IWineD3DBaseTextureImpl *)iface, FilterType); }
static WINED3DTEXTUREFILTERTYPE WINAPI IWineD3DTextureImpl_GetAutoGenFilterType(IWineD3DTexture *iface) { diff --git a/dlls/wined3d/volumetexture.c b/dlls/wined3d/volumetexture.c index 7606e99..a69049d 100644 --- a/dlls/wined3d/volumetexture.c +++ b/dlls/wined3d/volumetexture.c @@ -214,8 +214,10 @@ static DWORD WINAPI IWineD3DVolumeTextureImpl_GetLevelCount(IWineD3DVolumeTextur return basetexture_get_level_count((IWineD3DBaseTextureImpl *)iface); }
-static HRESULT WINAPI IWineD3DVolumeTextureImpl_SetAutoGenFilterType(IWineD3DVolumeTexture *iface, WINED3DTEXTUREFILTERTYPE FilterType) { - return basetexture_set_autogen_filter_type((IWineD3DBaseTexture *)iface, FilterType); +static HRESULT WINAPI IWineD3DVolumeTextureImpl_SetAutoGenFilterType(IWineD3DVolumeTexture *iface, + WINED3DTEXTUREFILTERTYPE FilterType) +{ + return basetexture_set_autogen_filter_type((IWineD3DBaseTextureImpl *)iface, FilterType); }
static WINED3DTEXTUREFILTERTYPE WINAPI IWineD3DVolumeTextureImpl_GetAutoGenFilterType(IWineD3DVolumeTexture *iface) { diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index af542d4..d8647e8 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -1924,7 +1924,7 @@ HRESULT basetexture_init(IWineD3DBaseTextureImpl *texture, UINT layer_count, UIN WINED3DRESOURCETYPE resource_type, IWineD3DDeviceImpl *device, DWORD usage, const struct wined3d_format *format, WINED3DPOOL pool, void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN; -HRESULT basetexture_set_autogen_filter_type(IWineD3DBaseTexture *iface, +HRESULT basetexture_set_autogen_filter_type(IWineD3DBaseTextureImpl *texture, WINED3DTEXTUREFILTERTYPE filter_type) DECLSPEC_HIDDEN; BOOL basetexture_set_dirty(IWineD3DBaseTextureImpl *texture, BOOL dirty) DECLSPEC_HIDDEN; DWORD basetexture_set_lod(IWineD3DBaseTextureImpl *texture, DWORD lod) DECLSPEC_HIDDEN;