Module: wine Branch: master Commit: 2f3e993e7e473afbf71ec6de3b74a47fb90e7b46 URL: http://source.winehq.org/git/wine.git/?a=commit;h=2f3e993e7e473afbf71ec6de3b...
Author: Henri Verbeet hverbeet@codeweavers.com Date: Tue Aug 4 08:30:20 2009 +0200
wined3d: Properly calculate GL_TEXTURE_MAX_ANISOTROPY_EXT.
---
dlls/wined3d/basetexture.c | 36 ++++++++++++++++++++++++------------ 1 files changed, 24 insertions(+), 12 deletions(-)
diff --git a/dlls/wined3d/basetexture.c b/dlls/wined3d/basetexture.c index 0e74fd1..cfa8d05 100644 --- a/dlls/wined3d/basetexture.c +++ b/dlls/wined3d/basetexture.c @@ -331,6 +331,7 @@ void basetexture_apply_state_changes(IWineD3DBaseTexture *iface, DWORD state, *states; GLint textureDimensions = IWineD3DBaseTexture_GetTextureDimensions(iface); BOOL cond_np2 = IWineD3DBaseTexture_IsCondNP2(iface); + DWORD aniso;
TRACE("iface %p, textureStates %p, samplerStates %p\n", iface, textureStates, samplerStates);
@@ -380,11 +381,6 @@ void basetexture_apply_state_changes(IWineD3DBaseTexture *iface, glValue = This->baseTexture.magLookup[state - WINED3DTEXF_NONE]; TRACE("ValueMAG=%d setting MAGFILTER to %x\n", state, glValue); glTexParameteri(textureDimensions, GL_TEXTURE_MAG_FILTER, glValue); - /* We need to reset the Anisotropic filtering state when we change the mag filter to WINED3DTEXF_ANISOTROPIC (this seems a bit weird, check the documentation to see how it should be switched off. */ - if (GL_SUPPORT(EXT_TEXTURE_FILTER_ANISOTROPIC) && WINED3DTEXF_ANISOTROPIC == state && - !cond_np2) { - glTexParameteri(textureDimensions, GL_TEXTURE_MAX_ANISOTROPY_EXT, samplerStates[WINED3DSAMP_MAXANISOTROPY]); - } states[WINED3DTEXSTA_MAGFILTER] = state; } } @@ -428,13 +424,29 @@ void basetexture_apply_state_changes(IWineD3DBaseTexture *iface, } }
- if(samplerStates[WINED3DSAMP_MAXANISOTROPY] != states[WINED3DTEXSTA_MAXANISOTROPY]) { - if (GL_SUPPORT(EXT_TEXTURE_FILTER_ANISOTROPIC) && !cond_np2) { - glTexParameteri(textureDimensions, GL_TEXTURE_MAX_ANISOTROPY_EXT, samplerStates[WINED3DSAMP_MAXANISOTROPY]); - checkGLcall("glTexParameteri GL_TEXTURE_MAX_ANISOTROPY_EXT ..."); - } else { - WARN("Unsupported in local OpenGL implementation: glTexParameteri GL_TEXTURE_MAX_ANISOTROPY_EXT\n"); + if ((states[WINED3DSAMP_MAGFILTER] != WINED3DTEXF_ANISOTROPIC + && states[WINED3DSAMP_MINFILTER] != WINED3DTEXF_ANISOTROPIC + && states[WINED3DSAMP_MIPFILTER] != WINED3DTEXF_ANISOTROPIC) + || cond_np2) + { + aniso = 1; + } + else + { + aniso = samplerStates[WINED3DSAMP_MAXANISOTROPY]; + } + + if (states[WINED3DTEXSTA_MAXANISOTROPY] != aniso) + { + if (GL_SUPPORT(EXT_TEXTURE_FILTER_ANISOTROPIC)) + { + glTexParameteri(textureDimensions, GL_TEXTURE_MAX_ANISOTROPY_EXT, aniso); + checkGLcall("glTexParameteri(GL_TEXTURE_MAX_ANISOTROPY_EXT, aniso)"); + } + else + { + WARN("Anisotropic filtering not supported.\n"); } - states[WINED3DTEXSTA_MAXANISOTROPY] = samplerStates[WINED3DSAMP_MAXANISOTROPY]; + states[WINED3DTEXSTA_MAXANISOTROPY] = aniso; } }