Stefan Dösinger : wined3d: Disable texture filtering on textures that do not support it.

Alexandre Julliard julliard at winehq.org
Wed Apr 9 05:31:38 CDT 2008


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

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Sun Apr  6 00:22:08 2008 +0200

wined3d: Disable texture filtering on textures that do not support it.

OpenGL always offers filtering on all formats, and if the hardware
doesn't support it the driver falls back to software. Direct3D on the
other hand silently disables filtering, so that's what we should do too.

---

 dlls/wined3d/device.c          |   19 ++++++++++++++++---
 dlls/wined3d/directx.c         |    6 ++++++
 dlls/wined3d/wined3d_private.h |    1 +
 3 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 82bdf2f..489b36e 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -789,7 +789,12 @@ static HRESULT  WINAPI IWineD3DDeviceImpl_CreateTexture(IWineD3DDevice *iface, U
     D3DINITIALIZEBASETEXTURE(object->baseTexture);    
     object->width  = Width;
     object->height = Height;
-    object->baseTexture.minMipLookup = &minMipLookup;
+
+    if(glDesc->Flags & WINED3DFMT_FLAG_FILTERING) {
+        object->baseTexture.minMipLookup = &minMipLookup;
+    } else {
+        object->baseTexture.minMipLookup = &minMipLookup_noFilter;
+    }
 
     /** Non-power2 support **/
     if (GL_SUPPORT(ARB_TEXTURE_NON_POWER_OF_TWO)) {
@@ -935,7 +940,11 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVolumeTexture(IWineD3DDevice *ifa
     object->baseTexture.pow2Matrix[10] = 1.0;
     object->baseTexture.pow2Matrix[15] = 1.0;
 
-    object->baseTexture.minMipLookup = &minMipLookup;
+    if(glDesc->Flags & WINED3DFMT_FLAG_FILTERING) {
+        object->baseTexture.minMipLookup = &minMipLookup;
+    } else {
+        object->baseTexture.minMipLookup = &minMipLookup_noFilter;
+    }
 
     /* Calculate levels for mip mapping */
     if (Usage & WINED3DUSAGE_AUTOGENMIPMAP) {
@@ -1084,7 +1093,11 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateCubeTexture(IWineD3DDevice *iface
     object->baseTexture.pow2Matrix[10] = ((float)EdgeLength) / ((float)pow2EdgeLength);
     object->baseTexture.pow2Matrix[15] = 1.0;
 
-    object->baseTexture.minMipLookup = &minMipLookup;
+    if(glDesc->Flags & WINED3DFMT_FLAG_FILTERING) {
+        object->baseTexture.minMipLookup = &minMipLookup;
+    } else {
+        object->baseTexture.minMipLookup = &minMipLookup_noFilter;
+    }
 
     /* Calculate levels for mip mapping */
     if (Usage & WINED3DUSAGE_AUTOGENMIPMAP) {
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index d0fbf3a..c29fbf1 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -155,6 +155,12 @@ int maxLookup[MAX_LOOKUPS];
 DWORD *stateLookup[MAX_LOOKUPS];
 
 DWORD minMipLookup[WINED3DTEXF_ANISOTROPIC + 1][WINED3DTEXF_LINEAR + 1];
+DWORD minMipLookup_noFilter[WINED3DTEXF_ANISOTROPIC + 1][WINED3DTEXF_LINEAR + 1] = {
+    {GL_NEAREST, GL_NEAREST, GL_NEAREST},
+    {GL_NEAREST, GL_NEAREST, GL_NEAREST},
+    {GL_NEAREST, GL_NEAREST, 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 46075fa..077e456 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -114,6 +114,7 @@ extern DWORD *stateLookup[MAX_LOOKUPS];
 
 typedef DWORD minMipLookup_t[WINED3DTEXF_ANISOTROPIC + 1][WINED3DTEXF_LINEAR + 1];
 extern minMipLookup_t minMipLookup;
+extern minMipLookup_t minMipLookup_noFilter;
 
 void init_type_lookup(WineD3D_GL_Info *gl_info);
 #define WINED3D_ATR_TYPE(type)          GLINFO_LOCATION.glTypeLookup[type].d3dType




More information about the wine-cvs mailing list