[PATCH] WineD3D: use the nofilter mipmap lookup for np2 textures=0A=

Stefan Doesinger stefan at codeweavers.com
Tue Jul 8 16:55:33 CDT 2008


=0A=
This is cleaner than the if statements in the code. Also np2=0A=
textures should in theory support linear filtering, but fglrx=0A=
doesn't seem to like it. This needs further investigation. So far=0A=
we've never used linear filtering on np2 textures, so there=0A=
should not be a regression. Furthermore I think shader support is=0A=
more important than filtering, since NP2 textures are mostly used=0A=
for 1:1 copying to the screen=0A=
---=0A=
 dlls/wined3d/basetexture.c |   12 ++----------=0A=
 dlls/wined3d/device.c      |    2 ++=0A=
 2 files changed, 4 insertions(+), 10 deletions(-)=0A=
=0A=
diff --git a/dlls/wined3d/basetexture.c b/dlls/wined3d/basetexture.c=0A=
index 863ffbd..d402586 100644=0A=
--- a/dlls/wined3d/basetexture.c=0A=
+++ b/dlls/wined3d/basetexture.c=0A=
@@ -462,18 +462,10 @@ void WINAPI =
IWineD3DBaseTextureImpl_ApplyStateChanges(IWineD3DBaseTexture *iface=0A=
         samplerStates[WINED3DSAMP_MIPFILTER]     !=3D =
This->baseTexture.states[WINED3DTEXSTA_MIPFILTER] ||=0A=
         samplerStates[WINED3DSAMP_MAXMIPLEVEL]   !=3D =
This->baseTexture.states[WINED3DTEXSTA_MAXMIPLEVEL])) {=0A=
         GLint glValue;=0A=
-        DWORD mipfilter, minfilter;=0A=
 =0A=
         This->baseTexture.states[WINED3DTEXSTA_MIPFILTER] =3D =
samplerStates[WINED3DSAMP_MIPFILTER];=0A=
         This->baseTexture.states[WINED3DTEXSTA_MINFILTER] =3D =
samplerStates[WINED3DSAMP_MINFILTER];=0A=
         This->baseTexture.states[WINED3DTEXSTA_MAXMIPLEVEL] =3D =
samplerStates[WINED3DSAMP_MAXMIPLEVEL];=0A=
-        if(cond_np2) {=0A=
-            mipfilter =3D WINED3DTEXF_NONE;=0A=
-            minfilter =3D WINED3DTEXF_POINT;=0A=
-        } else {=0A=
-            mipfilter =3D samplerStates[WINED3DSAMP_MIPFILTER];=0A=
-            minfilter =3D samplerStates[WINED3DSAMP_MINFILTER];=0A=
-        }=0A=
 =0A=
         if (This->baseTexture.states[WINED3DTEXSTA_MINFILTER] > =
WINED3DTEXF_ANISOTROPIC ||=0A=
             This->baseTexture.states[WINED3DTEXSTA_MIPFILTER] > =
WINED3DTEXF_LINEAR)=0A=
@@ -484,8 +476,8 @@ void WINAPI =
IWineD3DBaseTextureImpl_ApplyStateChanges(IWineD3DBaseTexture *iface=0A=
                   This->baseTexture.states[WINED3DTEXSTA_MIPFILTER]);=0A=
         }=0A=
         glValue =3D (*This->baseTexture.minMipLookup)=0A=
-                [min(max(minfilter,WINED3DTEXF_NONE), =
WINED3DTEXF_ANISOTROPIC)]=0A=
-                [min(max(mipfilter,WINED3DTEXF_NONE), =
WINED3DTEXF_LINEAR)];=0A=
+                =
[min(max(samplerStates[WINED3DSAMP_MINFILTER],WINED3DTEXF_NONE), =
WINED3DTEXF_ANISOTROPIC)]=0A=
+                =
[min(max(samplerStates[WINED3DSAMP_MIPFILTER],WINED3DTEXF_NONE), =
WINED3DTEXF_LINEAR)];=0A=
 =0A=
         TRACE("ValueMIN=3D%d, ValueMIP=3D%d, setting MINFILTER to %x\n",=0A=
               samplerStates[WINED3DSAMP_MINFILTER],=0A=
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c=0A=
index e6a1112..131e1b7 100644=0A=
--- a/dlls/wined3d/device.c=0A=
+++ b/dlls/wined3d/device.c=0A=
@@ -827,6 +827,7 @@ static HRESULT  WINAPI =
IWineD3DDeviceImpl_CreateTexture(IWineD3DDevice *iface, U=0A=
         object->cond_np2 =3D TRUE;=0A=
         pow2Width =3D Width;=0A=
         pow2Height =3D Height;=0A=
+        object->baseTexture.minMipLookup =3D &minMipLookup_noFilter;=0A=
     } else if(GL_SUPPORT(ARB_TEXTURE_RECTANGLE) &&=0A=
        (Width !=3D pow2Width || Height !=3D pow2Height) &&=0A=
        !((Format =3D=3D WINED3DFMT_P8) && =
GL_SUPPORT(EXT_PALETTED_TEXTURE) && =
(wined3d_settings.rendertargetlock_mode =3D=3D RTL_READTEX || =
wined3d_settings.rendertargetlock_mode =3D=3D RTL_TEXTEX)))=0A=
@@ -837,6 +838,7 @@ static HRESULT  WINAPI =
IWineD3DDeviceImpl_CreateTexture(IWineD3DDevice *iface, U=0A=
         object->baseTexture.pow2Matrix[15] =3D 1.0;=0A=
         object->target =3D GL_TEXTURE_RECTANGLE_ARB;=0A=
         object->cond_np2 =3D TRUE;=0A=
+        object->baseTexture.minMipLookup =3D &minMipLookup_noFilter;=0A=
     } else {=0A=
         object->baseTexture.pow2Matrix[0] =3D  (((float)Width)  / =
((float)pow2Width));=0A=
         object->baseTexture.pow2Matrix[5] =3D  (((float)Height) / =
((float)pow2Height));=0A=
-- =0A=
1.5.4.5=0A=
=0A=

------=_NextPart_000_0007_01C8E844.D47C8690--




More information about the wine-patches mailing list