Commit cafec085 authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

wined3d: Use the nofilter mipmap lookup for np2 textures.

This is cleaner than the if statements in the code. Also np2 textures should in theory support linear filtering, but fglrx doesn't seem to like it. This needs further investigation. So far we've never used linear filtering on np2 textures, so there should not be a regression. Furthermore I think shader support is more important than filtering, since NP2 textures are mostly used for 1:1 copying to the screen.
parent c088edea
......@@ -462,18 +462,10 @@ void WINAPI IWineD3DBaseTextureImpl_ApplyStateChanges(IWineD3DBaseTexture *iface
samplerStates[WINED3DSAMP_MIPFILTER] != This->baseTexture.states[WINED3DTEXSTA_MIPFILTER] ||
samplerStates[WINED3DSAMP_MAXMIPLEVEL] != This->baseTexture.states[WINED3DTEXSTA_MAXMIPLEVEL])) {
GLint glValue;
DWORD mipfilter, minfilter;
This->baseTexture.states[WINED3DTEXSTA_MIPFILTER] = samplerStates[WINED3DSAMP_MIPFILTER];
This->baseTexture.states[WINED3DTEXSTA_MINFILTER] = samplerStates[WINED3DSAMP_MINFILTER];
This->baseTexture.states[WINED3DTEXSTA_MAXMIPLEVEL] = samplerStates[WINED3DSAMP_MAXMIPLEVEL];
if(cond_np2) {
mipfilter = WINED3DTEXF_NONE;
minfilter = WINED3DTEXF_POINT;
} else {
mipfilter = samplerStates[WINED3DSAMP_MIPFILTER];
minfilter = samplerStates[WINED3DSAMP_MINFILTER];
}
if (This->baseTexture.states[WINED3DTEXSTA_MINFILTER] > WINED3DTEXF_ANISOTROPIC ||
This->baseTexture.states[WINED3DTEXSTA_MIPFILTER] > WINED3DTEXF_LINEAR)
......@@ -484,8 +476,8 @@ void WINAPI IWineD3DBaseTextureImpl_ApplyStateChanges(IWineD3DBaseTexture *iface
This->baseTexture.states[WINED3DTEXSTA_MIPFILTER]);
}
glValue = (*This->baseTexture.minMipLookup)
[min(max(minfilter,WINED3DTEXF_NONE), WINED3DTEXF_ANISOTROPIC)]
[min(max(mipfilter,WINED3DTEXF_NONE), WINED3DTEXF_LINEAR)];
[min(max(samplerStates[WINED3DSAMP_MINFILTER],WINED3DTEXF_NONE), WINED3DTEXF_ANISOTROPIC)]
[min(max(samplerStates[WINED3DSAMP_MIPFILTER],WINED3DTEXF_NONE), WINED3DTEXF_LINEAR)];
TRACE("ValueMIN=%d, ValueMIP=%d, setting MINFILTER to %x\n",
samplerStates[WINED3DSAMP_MINFILTER],
......
......@@ -827,6 +827,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateTexture(IWineD3DDevice *iface, U
object->cond_np2 = TRUE;
pow2Width = Width;
pow2Height = Height;
object->baseTexture.minMipLookup = &minMipLookup_noFilter;
} else if(GL_SUPPORT(ARB_TEXTURE_RECTANGLE) &&
(Width != pow2Width || Height != pow2Height) &&
!((Format == WINED3DFMT_P8) && GL_SUPPORT(EXT_PALETTED_TEXTURE) && (wined3d_settings.rendertargetlock_mode == RTL_READTEX || wined3d_settings.rendertargetlock_mode == RTL_TEXTEX)))
......@@ -837,6 +838,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateTexture(IWineD3DDevice *iface, U
object->baseTexture.pow2Matrix[15] = 1.0;
object->target = GL_TEXTURE_RECTANGLE_ARB;
object->cond_np2 = TRUE;
object->baseTexture.minMipLookup = &minMipLookup_noFilter;
} else {
object->baseTexture.pow2Matrix[0] = (((float)Width) / ((float)pow2Width));
object->baseTexture.pow2Matrix[5] = (((float)Height) / ((float)pow2Height));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment