[7/8] d3d8: Use D3DRENDERSTATETYPE -> WINED3DRENDERSTATETYPE enum conversion function instead of implicit conversion (clang)

Frédéric Delanoy frederic.delanoy at gmail.com
Sun May 29 02:46:10 CDT 2011


Conversion done using casts in order to prevent performance degradation in critical paths
---
 dlls/d3d8/d3d8_private.h |    5 +++++
 dlls/d3d8/device.c       |    6 ++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/dlls/d3d8/d3d8_private.h b/dlls/d3d8/d3d8_private.h
index 097fd97..c42fffc 100644
--- a/dlls/d3d8/d3d8_private.h
+++ b/dlls/d3d8/d3d8_private.h
@@ -633,6 +633,11 @@ static inline WINED3DTRANSFORMSTATETYPE wined3dtransformstatetype_from_d3dtransf
     return (WINED3DTRANSFORMSTATETYPE) type;
 }
 
+static inline WINED3DRENDERSTATETYPE wined3drenderstatetype_from_d3drenderstatetype(D3DRENDERSTATETYPE type)
+{
+    return (WINED3DRENDERSTATETYPE) type;
+}
+
 void load_local_constants(const DWORD *d3d8_elements, struct wined3d_shader *wined3d_vertex_shader) DECLSPEC_HIDDEN;
 size_t parse_token(const DWORD *pToken) DECLSPEC_HIDDEN;
 
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index e0fd55b..485cdd6 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -1492,7 +1492,8 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetRenderState(IDirect3DDevice8 *ifac
             break;
 
         default:
-            hr = wined3d_device_set_render_state(This->wined3d_device, State, Value);
+            hr = wined3d_device_set_render_state(This->wined3d_device,
+                    wined3drenderstatetype_from_d3drenderstatetype(State), Value);
     }
     wined3d_mutex_unlock();
 
@@ -1521,7 +1522,8 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetRenderState(IDirect3DDevice8 *ifac
             break;
 
         default:
-            hr = wined3d_device_get_render_state(This->wined3d_device, State, pValue);
+            hr = wined3d_device_get_render_state(This->wined3d_device,
+                    wined3drenderstatetype_from_d3drenderstatetype(State), pValue);
     }
     wined3d_mutex_unlock();
 
-- 
1.7.5.3




More information about the wine-patches mailing list