Stefan Dösinger : wined3d: Use the nofilter mipmap lookup for np2 textures.

Alexandre Julliard julliard at winehq.org
Fri Jul 18 06:46:51 CDT 2008


Module: wine
Branch: master
Commit: cafec08516097f6058d0ce33079abb96d92628e6
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=cafec08516097f6058d0ce33079abb96d92628e6

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Tue Jul  8 16:55:33 2008 -0500

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.

---

 dlls/wined3d/basetexture.c |   12 ++----------
 dlls/wined3d/device.c      |    2 ++
 2 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/dlls/wined3d/basetexture.c b/dlls/wined3d/basetexture.c
index 863ffbd..d402586 100644
--- a/dlls/wined3d/basetexture.c
+++ b/dlls/wined3d/basetexture.c
@@ -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],
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index e6a1112..131e1b7 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -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));




More information about the wine-cvs mailing list