wined3d: Pass an IWineD3DBaseTextureImpl pointer to basetexture_set_autogen_filter_type().

This commit is contained in:
Henri Verbeet 2011-01-02 12:26:37 +01:00 committed by Alexandre Julliard
parent 54e1aeeb62
commit 568f9ecb22
5 changed files with 53 additions and 45 deletions

View File

@ -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;
TRACE("texture %p, filter_type %s.\n", texture, debug_d3dtexturefiltertype(filter_type));
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);
if (!(texture->resource.usage & WINED3DUSAGE_AUTOGENMIPMAP))
{
WARN("Texture doesn't have AUTOGENMIPMAP usage.\n");
return WINED3DERR_INVALIDCALL;
}
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)");
if (texture->baseTexture.filterType != filter_type)
{
GLenum target = texture->baseTexture.target;
struct wined3d_context *context;
break;
case WINED3DTEXF_LINEAR:
glTexParameteri(textureDimensions, GL_GENERATE_MIPMAP_HINT_SGIS, GL_NICEST);
checkGLcall("glTexParameteri(textureDimensions, GL_GENERATE_MIPMAP_HINT_SGIS, GL_NICEST)");
context = context_acquire(texture->resource.device, NULL);
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();
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;
context_release(context);
}
This->baseTexture.filterType = FilterType;
TRACE("(%p) :\n", This);
return WINED3D_OK;
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)

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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;