From 481bcdfe2a939cfc02f305fa7357c1c61f1bf0b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Sun, 6 Apr 2008 00:37:51 +0200 Subject: [PATCH] wined3d: Disable MAG filters on formats that do not support them. --- dlls/wined3d/basetexture.c | 2 +- dlls/wined3d/device.c | 6 ++++++ dlls/wined3d/directx.c | 3 +++ dlls/wined3d/wined3d_private.h | 2 ++ 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/dlls/wined3d/basetexture.c b/dlls/wined3d/basetexture.c index ab7fd55da92..bc004c061d3 100644 --- a/dlls/wined3d/basetexture.c +++ b/dlls/wined3d/basetexture.c @@ -434,7 +434,7 @@ void WINAPI IWineD3DBaseTextureImpl_ApplyStateChanges(IWineD3DBaseTexture *iface if (state < WINED3DTEXF_NONE || state > WINED3DTEXF_ANISOTROPIC) { FIXME("Unrecognized or unsupported MAGFILTER* value %d\n", state); } - glValue = magLookup[state - WINED3DTEXF_NONE]; + 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. */ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 489b36e2062..034b04d14ef 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -792,8 +792,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateTexture(IWineD3DDevice *iface, U if(glDesc->Flags & WINED3DFMT_FLAG_FILTERING) { object->baseTexture.minMipLookup = &minMipLookup; + object->baseTexture.magLookup = &magLookup; } else { object->baseTexture.minMipLookup = &minMipLookup_noFilter; + object->baseTexture.magLookup = &magLookup_noFilter; } /** Non-power2 support **/ @@ -942,8 +944,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVolumeTexture(IWineD3DDevice *ifa if(glDesc->Flags & WINED3DFMT_FLAG_FILTERING) { object->baseTexture.minMipLookup = &minMipLookup; + object->baseTexture.magLookup = &magLookup; } else { object->baseTexture.minMipLookup = &minMipLookup_noFilter; + object->baseTexture.magLookup = &magLookup_noFilter; } /* Calculate levels for mip mapping */ @@ -1095,8 +1099,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateCubeTexture(IWineD3DDevice *iface if(glDesc->Flags & WINED3DFMT_FLAG_FILTERING) { object->baseTexture.minMipLookup = &minMipLookup; + object->baseTexture.magLookup = &magLookup; } else { object->baseTexture.minMipLookup = &minMipLookup_noFilter; + object->baseTexture.magLookup = &magLookup_noFilter; } /* Calculate levels for mip mapping */ diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index d39118ce95e..4071b1fa7d7 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -163,6 +163,9 @@ DWORD minMipLookup_noFilter[WINED3DTEXF_ANISOTROPIC + 1][WINED3DTEXF_LINEAR + 1] }; DWORD magLookup[WINED3DTEXF_ANISOTROPIC + 1]; +DWORD magLookup_noFilter[WINED3DTEXF_ANISOTROPIC + 1] = { + GL_NEAREST, GL_NEAREST, GL_NEAREST, GL_NEAREST +}; /* drawStridedSlow attributes */ glAttribFunc position_funcs[WINED3DDECLTYPE_UNUSED]; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 4aeda0c9746..18c7a090152 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -113,6 +113,7 @@ extern DWORD *stateLookup[MAX_LOOKUPS]; typedef DWORD magLookup_t[WINED3DTEXF_ANISOTROPIC + 1]; extern magLookup_t magLookup; +extern magLookup_t magLookup_noFilter; typedef DWORD minMipLookup_t[WINED3DTEXF_ANISOTROPIC + 1][WINED3DTEXF_LINEAR + 1]; extern minMipLookup_t minMipLookup; @@ -1095,6 +1096,7 @@ typedef struct IWineD3DBaseTextureClass WINED3DFORMAT shader_conversion_group; float pow2Matrix[16]; minMipLookup_t *minMipLookup; + magLookup_t *magLookup; } IWineD3DBaseTextureClass; typedef struct IWineD3DBaseTextureImpl