Ivan Gyurdiev : wined3d: Merge MATERIAL types into one type in WINED3D namespace.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Oct 11 05:52:42 CDT 2006


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

Author: Ivan Gyurdiev <ivg231 at gmail.com>
Date:   Tue Oct 10 21:56:41 2006 -0400

wined3d: Merge MATERIAL types into one type in WINED3D namespace.

---

 dlls/d3d8/device.c               |    6 ++++--
 dlls/d3d9/device.c               |    4 ++++
 dlls/ddraw/device.c              |    8 ++++++--
 dlls/wined3d/device.c            |    1 -
 dlls/wined3d/stateblock.c        |    4 ++--
 include/wine/wined3d_interface.h |    3 ---
 include/wine/wined3d_types.h     |    8 ++++++++
 7 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index 5d841fa..2a7d730 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -710,14 +710,16 @@ static HRESULT WINAPI IDirect3DDevice8Im
 static HRESULT WINAPI IDirect3DDevice8Impl_SetMaterial(LPDIRECT3DDEVICE8 iface, CONST D3DMATERIAL8* pMaterial) {
     IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
     TRACE("(%p) Relay\n" , This);
-/* FIXME: Verify that D3DMATERIAL8 ~= WINED3DMATERIAL */
+
+    /* Note: D3DMATERIAL8 is compatible with WINED3DMATERIAL */
     return IWineD3DDevice_SetMaterial(This->WineD3DDevice, (const WINED3DMATERIAL *)pMaterial);
 }
 
 static HRESULT WINAPI IDirect3DDevice8Impl_GetMaterial(LPDIRECT3DDEVICE8 iface, D3DMATERIAL8* pMaterial) {
     IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
     TRACE("(%p) Relay\n" , This);
-/* FIXME: Verify that D3DMATERIAL8 ~= WINED3DMATERIAL */
+
+    /* Note: D3DMATERIAL8 is compatible with WINED3DMATERIAL */
     return IWineD3DDevice_GetMaterial(This->WineD3DDevice, (WINED3DMATERIAL *)pMaterial);
 }
 
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index 316d762..815ea6d 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -492,12 +492,16 @@ static HRESULT  WINAPI  IDirect3DDevice9
 static HRESULT  WINAPI  IDirect3DDevice9Impl_SetMaterial(LPDIRECT3DDEVICE9 iface, CONST D3DMATERIAL9* pMaterial) {
     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
     TRACE("(%p) Relay\n" , This);
+
+    /* Note: D3DMATERIAL9 is compatible with WINED3DMATERIAL */
     return IWineD3DDevice_SetMaterial(This->WineD3DDevice, (const WINED3DMATERIAL *)pMaterial);
 }
 
 static HRESULT  WINAPI  IDirect3DDevice9Impl_GetMaterial(LPDIRECT3DDEVICE9 iface, D3DMATERIAL9* pMaterial) {
     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
     TRACE("(%p) Relay\n" , This);
+
+    /* Note: D3DMATERIAL9 is compatible with WINED3DMATERIAL */
     return IWineD3DDevice_GetMaterial(This->WineD3DDevice, (WINED3DMATERIAL *)pMaterial);
 }
 
diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c
index 836168c..42e4697 100644
--- a/dlls/ddraw/device.c
+++ b/dlls/ddraw/device.c
@@ -4095,8 +4095,10 @@ IDirect3DDeviceImpl_7_SetMaterial(IDirec
     HRESULT hr;
     TRACE("(%p)->(%p): Relay!\n", This, Mat);
 
+    /* Note: D3DMATERIAL7 is compatible with WINED3DMATERIAL */
     hr = IWineD3DDevice_SetMaterial(This->wineD3DDevice,
-                                    Mat);
+                                    (WINED3DMATERIAL*) Mat);
+
     return hr_ddraw_from_wined3d(hr);
 }
 
@@ -4124,8 +4126,10 @@ IDirect3DDeviceImpl_7_GetMaterial(IDirec
     HRESULT hr;
     TRACE("(%p)->(%p): Relay!\n", This, Mat);
 
+    /* Note: D3DMATERIAL7 is compatible with WINED3DMATERIAL */ 
     hr = IWineD3DDevice_GetMaterial(This->wineD3DDevice,
-                                    Mat);
+                                    (WINED3DMATERIAL*) Mat);
+
     return hr_ddraw_from_wined3d(hr);
 }
 
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 40c0d83..f0da0cc 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3139,7 +3139,6 @@ static HRESULT  WINAPI  IWineD3DDeviceIm
 
 /*****
  * Get / Set Material
- *   WARNING: This code relies on the fact that D3DMATERIAL8 == D3DMATERIAL9
  *****/
 static HRESULT WINAPI IWineD3DDeviceImpl_SetMaterial(IWineD3DDevice *iface, CONST WINED3DMATERIAL* pMaterial) {
     IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c
index 3356a71..841f03c 100644
--- a/dlls/wined3d/stateblock.c
+++ b/dlls/wined3d/stateblock.c
@@ -520,9 +520,9 @@ static HRESULT  WINAPI IWineD3DStateBloc
 
         if (This->set.material && memcmp(&targetStateBlock->material,
                                                     &This->material,
-                                                    sizeof(D3DMATERIAL9)) != 0) {
+                                                    sizeof(WINED3DMATERIAL)) != 0) {
             TRACE("Updating material\n");
-            memcpy(&This->material, &targetStateBlock->material, sizeof(D3DMATERIAL9));
+            memcpy(&This->material, &targetStateBlock->material, sizeof(WINED3DMATERIAL));
         }
 
         if (This->set.viewport && memcmp(&targetStateBlock->viewport,
diff --git a/include/wine/wined3d_interface.h b/include/wine/wined3d_interface.h
index a581115..7bd64c7 100644
--- a/include/wine/wined3d_interface.h
+++ b/include/wine/wined3d_interface.h
@@ -191,19 +191,16 @@ DEFINE_GUID(IID_IWineD3DQuery, 
 /* TODO: remove the d3d8/d3d9 dependencies by making a all inclusive WINED3D version */
 #if defined( __WINE_D3D9_H )
  /* Identical: */ 
-# define WINED3DMATERIAL        D3DMATERIAL9
 # define WINED3DVIEWPORT        D3DVIEWPORT9
 # define WINED3DGAMMARAMP       D3DGAMMARAMP
 
 #elif defined( __WINE_D3D8_H )
  /* Identical: */ 
-# define WINED3DMATERIAL        D3DMATERIAL8
 # define WINED3DVIEWPORT        D3DVIEWPORT8
 # define WINED3DGAMMARAMP       D3DGAMMARAMP
 
 #else /* defined (__WINE_D3D_H ) */
  /* Identical: */
-# define WINED3DMATERIAL        D3DMATERIAL7
 # define WINED3DVIEWPORT        D3DVIEWPORT7
 # define WINED3DGAMMARAMP       DDGAMMARAMP
 
diff --git a/include/wine/wined3d_types.h b/include/wine/wined3d_types.h
index 814075e..b1c3ae1 100644
--- a/include/wine/wined3d_types.h
+++ b/include/wine/wined3d_types.h
@@ -68,6 +68,14 @@ typedef struct _WINED3DLIGHT {
     float               Phi;
 } WINED3DLIGHT;
 
+typedef struct _WINED3DMATERIAL {
+    WINED3DCOLORVALUE   Diffuse;
+    WINED3DCOLORVALUE   Ambient;
+    WINED3DCOLORVALUE   Specular;
+    WINED3DCOLORVALUE   Emissive;
+    float           Power;
+} WINED3DMATERIAL;
+
 #define WINED3D_VSHADER_MAX_CONSTANTS 96
 #define WINED3D_PSHADER_MAX_CONSTANTS 32
 




More information about the wine-cvs mailing list