Stefan Dösinger : ddraw: Forward the mag filter correctly to wined3d.

Alexandre Julliard julliard at wine.codeweavers.com
Tue May 8 13:17:01 CDT 2007


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

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Sun Apr 29 14:23:06 2007 +0200

ddraw: Forward the mag filter correctly to wined3d.

Fixes the erros when using anisotropic mag filtering in the d3d7
filter demo.

---

 dlls/ddraw/device.c |   44 +++++++++++++++++++++++++++++++++++++-------
 1 files changed, 37 insertions(+), 7 deletions(-)

diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c
index 42e44d8..63b06e8 100644
--- a/dlls/ddraw/device.c
+++ b/dlls/ddraw/device.c
@@ -4032,12 +4032,28 @@ IDirect3DDeviceImpl_7_GetTextureStageState(IDirect3DDevice7 *iface,
                                                   Stage,
                                                   WINED3DSAMP_MINFILTER,
                                                   State);
-        /* Same for MAGFILTER */
+        /* Magfilter has slightly different values */
         case D3DTSS_MAGFILTER:
-            return IWineD3DDevice_GetSamplerState(This->wineD3DDevice,
-                                                  Stage,
-                                                  WINED3DSAMP_MAGFILTER,
-                                                  State);
+        {
+            HRESULT hr;
+            WINED3DTEXTUREFILTERTYPE wined3dfilter;
+            hr = IWineD3DDevice_GetSamplerState(This->wineD3DDevice,
+                                                Stage,
+                                                WINED3DSAMP_MAGFILTER,
+                                                &wined3dfilter);
+            switch(wined3dfilter)
+            {
+                case WINED3DTEXF_POINT:             *State = D3DTFG_POINT;          break;
+                case WINED3DTEXF_LINEAR:            *State = D3DTFG_LINEAR;         break;
+                case WINED3DTEXF_ANISOTROPIC:       *State = D3DTFG_ANISOTROPIC;    break;
+                case WINED3DTEXF_FLATCUBIC:         *State = D3DTFG_FLATCUBIC;      break;
+                case WINED3DTEXF_GAUSSIANCUBIC:     *State = D3DTFG_GAUSSIANCUBIC;  break;
+                default:
+                    ERR("Unexpected wined3d mag filter value %d\n", wined3dfilter);
+                    *State = D3DTFG_POINT;
+            }
+            return hr;
+        }
 
         case D3DTSS_ADDRESS:
         case D3DTSS_ADDRESSU:
@@ -4126,12 +4142,26 @@ IDirect3DDeviceImpl_7_SetTextureStageState(IDirect3DDevice7 *iface,
                                                   Stage,
                                                   WINED3DSAMP_MINFILTER,
                                                   State);
-        /* Same for MAGFILTER */
+        /* Magfilter has slightly different values */
         case D3DTSS_MAGFILTER:
+        {
+            WINED3DTEXTUREFILTERTYPE wined3dfilter;
+            switch((D3DTEXTUREMAGFILTER) State)
+            {
+                case D3DTFG_POINT:          wined3dfilter = WINED3DTEXF_POINT;          break;
+                case D3DTFG_LINEAR:         wined3dfilter = WINED3DTEXF_LINEAR;         break;
+                case D3DTFG_FLATCUBIC:      wined3dfilter = WINED3DTEXF_FLATCUBIC;      break;
+                case D3DTFG_GAUSSIANCUBIC:  wined3dfilter = WINED3DTEXF_GAUSSIANCUBIC;  break;
+                case D3DTFG_ANISOTROPIC:    wined3dfilter = WINED3DTEXF_ANISOTROPIC;    break;
+                default:
+                    ERR("Unexpected d3d7 mag filter type %d\n", State);
+                    wined3dfilter = WINED3DTEXF_POINT;
+            }
             return IWineD3DDevice_SetSamplerState(This->wineD3DDevice,
                                                   Stage,
                                                   WINED3DSAMP_MAGFILTER,
-                                                  State);
+                                                  wined3dfilter);
+        }
 
         case D3DTSS_ADDRESS:
                    IWineD3DDevice_SetSamplerState(This->wineD3DDevice,




More information about the wine-cvs mailing list