[6/15] DDraw: Get some texture stage states from their equivalent sampler states

Stefan Dösinger stefan at codeweavers.com
Wed Jan 10 04:29:55 CST 2007


The same thing as the tss->sampler state mapping in SetTextureStageState
-------------- next part --------------
From d241f59fddaad628e7e8b9dcec9dd474b4a89a92 Mon Sep 17 00:00:00 2001
From: Stefan Doesinger <stefan at codeweavers.com>
Date: Sun, 7 Jan 2007 13:08:32 +0100
Subject: [PATCH] DDraw: Get some texture stage states from their equivalent sampler

states
---
 dlls/ddraw/device.c |   46 ++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 42 insertions(+), 4 deletions(-)

diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c
index 4ba3154..62cfa50 100644
--- a/dlls/ddraw/device.c
+++ b/dlls/ddraw/device.c
@@ -3975,10 +3975,48 @@ IDirect3DDeviceImpl_7_GetTextureStageState(IDirect3DDevice7 *iface,
     if(!State)
         return DDERR_INVALIDPARAMS;
 
-    return IWineD3DDevice_GetTextureStageState(This->wineD3DDevice,
-                                               Stage,
-                                               TexStageStateType,
-                                               State);
+    switch(TexStageStateType)
+    {
+        /* Mipfilter is a sampler state with different values */
+        case D3DTSS_MIPFILTER:
+        {
+            HRESULT hr;
+            WINED3DTEXTUREFILTERTYPE value;
+
+            hr = IWineD3DDevice_GetSamplerState(This->wineD3DDevice,
+                                                Stage,
+                                                WINED3DSAMP_MIPFILTER,
+                                                &value);
+            switch(value)
+            {
+                case WINED3DTEXF_NONE: *State = D3DTFP_NONE; break;
+                case WINED3DTEXF_POINT: *State = D3DTFP_POINT; break;
+                case WINED3DTEXF_LINEAR: *State = D3DTFP_LINEAR; break;
+                default:
+                    ERR("Unexpected mipfilter value %d\n", value);
+                    *State = D3DTFP_NONE;
+            }
+            return hr;
+        }
+
+        /* Minfilter is a sampler state too, equal values */
+        case D3DTSS_MINFILTER:
+            return IWineD3DDevice_GetSamplerState(This->wineD3DDevice,
+                                                  Stage,
+                                                  WINED3DSAMP_MINFILTER,
+                                                  State);
+        /* Same for MAGFILTER */
+        case D3DTSS_MAGFILTER:
+            return IWineD3DDevice_GetSamplerState(This->wineD3DDevice,
+                                                  Stage,
+                                                  WINED3DSAMP_MAGFILTER,
+                                                  State);
+        default:
+            return IWineD3DDevice_GetTextureStageState(This->wineD3DDevice,
+                                                    Stage,
+                                                    TexStageStateType,
+                                                    State);
+    }
 }
 
 static HRESULT WINAPI
-- 
1.4.4.3



More information about the wine-patches mailing list