Henri Verbeet : wined3d: Get rid of the silly pointers in WINED3DVOLUME_DESC.

Alexandre Julliard julliard at winehq.org
Tue Jun 9 10:45:28 CDT 2009


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

Author: Henri Verbeet <hverbeet at gmail.com>
Date:   Tue Jun  9 10:47:20 2009 +0200

wined3d: Get rid of the silly pointers in WINED3DVOLUME_DESC.

---

 dlls/d3d8/volume.c        |   22 +++++++++++-----------
 dlls/d3d8/volumetexture.c |   23 +++++++++++------------
 dlls/d3d9/device.c        |    9 +--------
 dlls/d3d9/volume.c        |   23 ++++++++++-------------
 dlls/d3d9/volumetexture.c |   23 ++++++++++-------------
 dlls/wined3d/volume.c     |   17 +++++++++--------
 include/wine/wined3d.idl  |   16 ++++++++--------
 7 files changed, 60 insertions(+), 73 deletions(-)

diff --git a/dlls/d3d8/volume.c b/dlls/d3d8/volume.c
index 474aad8..4a7066c 100644
--- a/dlls/d3d8/volume.c
+++ b/dlls/d3d8/volume.c
@@ -154,21 +154,21 @@ static HRESULT WINAPI IDirect3DVolume8Impl_GetDesc(LPDIRECT3DVOLUME8 iface, D3DV
 
     TRACE("(%p) Relay\n", This);
 
-    /* As d3d8 and d3d9 structures differ, pass in ptrs to where data needs to go */
-    wined3ddesc.Format              = (WINED3DFORMAT *)&pDesc->Format;
-    wined3ddesc.Type                = (WINED3DRESOURCETYPE *)&pDesc->Type;
-    wined3ddesc.Usage               = &pDesc->Usage;
-    wined3ddesc.Pool                = (WINED3DPOOL *) &pDesc->Pool;
-    wined3ddesc.Size                = &pDesc->Size;
-    wined3ddesc.Width               = &pDesc->Width;
-    wined3ddesc.Height              = &pDesc->Height;
-    wined3ddesc.Depth               = &pDesc->Depth;
-
     EnterCriticalSection(&d3d8_cs);
     hr = IWineD3DVolume_GetDesc(This->wineD3DVolume, &wined3ddesc);
     LeaveCriticalSection(&d3d8_cs);
 
-    if (SUCCEEDED(hr)) pDesc->Format = d3dformat_from_wined3dformat(pDesc->Format);
+    if (SUCCEEDED(hr))
+    {
+        pDesc->Format = d3dformat_from_wined3dformat(wined3ddesc.Format);
+        pDesc->Type = wined3ddesc.Type;
+        pDesc->Usage = wined3ddesc.Usage;
+        pDesc->Pool = wined3ddesc.Pool;
+        pDesc->Size = wined3ddesc.Size;
+        pDesc->Width = wined3ddesc.Width;
+        pDesc->Height = wined3ddesc.Height;
+        pDesc->Depth = wined3ddesc.Depth;
+    }
 
     return hr;
 }
diff --git a/dlls/d3d8/volumetexture.c b/dlls/d3d8/volumetexture.c
index 098827a..25aa93d 100644
--- a/dlls/d3d8/volumetexture.c
+++ b/dlls/d3d8/volumetexture.c
@@ -197,26 +197,25 @@ static DWORD WINAPI IDirect3DVolumeTexture8Impl_GetLevelCount(LPDIRECT3DVOLUMETE
 static HRESULT WINAPI IDirect3DVolumeTexture8Impl_GetLevelDesc(LPDIRECT3DVOLUMETEXTURE8 iface, UINT Level, D3DVOLUME_DESC* pDesc) {
     IDirect3DVolumeTexture8Impl *This = (IDirect3DVolumeTexture8Impl *)iface;
     WINED3DVOLUME_DESC     wined3ddesc;
-    UINT                   tmpInt = -1;
     HRESULT hr;
 
     TRACE("(%p) Relay\n", This);
 
-    /* As d3d8 and d3d8 structures differ, pass in ptrs to where data needs to go */
-    wined3ddesc.Format              = (WINED3DFORMAT *)&pDesc->Format;
-    wined3ddesc.Type                = (WINED3DRESOURCETYPE *)&pDesc->Type;
-    wined3ddesc.Usage               = &pDesc->Usage;
-    wined3ddesc.Pool                = (WINED3DPOOL *) &pDesc->Pool;
-    wined3ddesc.Size                = &tmpInt;
-    wined3ddesc.Width               = &pDesc->Width;
-    wined3ddesc.Height              = &pDesc->Height;
-    wined3ddesc.Depth               = &pDesc->Depth;
-
     EnterCriticalSection(&d3d8_cs);
     hr = IWineD3DVolumeTexture_GetLevelDesc(This->wineD3DVolumeTexture, Level, &wined3ddesc);
     LeaveCriticalSection(&d3d8_cs);
 
-    if (SUCCEEDED(hr)) pDesc->Format = d3dformat_from_wined3dformat(pDesc->Format);
+    if (SUCCEEDED(hr))
+    {
+        pDesc->Format = d3dformat_from_wined3dformat(wined3ddesc.Format);
+        pDesc->Type = wined3ddesc.Type;
+        pDesc->Usage = wined3ddesc.Usage;
+        pDesc->Pool = wined3ddesc.Pool;
+        pDesc->Size = wined3ddesc.Size;
+        pDesc->Width = wined3ddesc.Width;
+        pDesc->Height = wined3ddesc.Height;
+        pDesc->Depth = wined3ddesc.Depth;
+    }
 
     return hr;
 }
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index 8f95ad1..c711087 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -454,15 +454,8 @@ static HRESULT WINAPI reset_enum_callback(IWineD3DResource *resource, void *data
             break;
 
         case D3DRTYPE_VOLUME:
-            volume_desc.Format = &dummy_format;
-            volume_desc.Type = &type;
-            volume_desc.Usage = &dummy_dword;
-            volume_desc.Pool = &pool;
-            volume_desc.Size = &dummy_dword;
-            volume_desc.Width = &dummy_dword;
-            volume_desc.Height = &dummy_dword;
-            volume_desc.Depth = &dummy_dword;
             IWineD3DVolume_GetDesc((IWineD3DVolume *) resource, &volume_desc);
+            pool = volume_desc.Pool;
             break;
 
         case D3DRTYPE_INDEXBUFFER:
diff --git a/dlls/d3d9/volume.c b/dlls/d3d9/volume.c
index 93b06b5..7c49a9a 100644
--- a/dlls/d3d9/volume.c
+++ b/dlls/d3d9/volume.c
@@ -167,29 +167,26 @@ static HRESULT WINAPI IDirect3DVolume9Impl_GetContainer(LPDIRECT3DVOLUME9 iface,
 static HRESULT WINAPI IDirect3DVolume9Impl_GetDesc(LPDIRECT3DVOLUME9 iface, D3DVOLUME_DESC* pDesc) {
     IDirect3DVolume9Impl *This = (IDirect3DVolume9Impl *)iface;
     WINED3DVOLUME_DESC     wined3ddesc;
-    UINT                   tmpInt = -1;
-    WINED3DFORMAT format;
     HRESULT hr;
 
     TRACE("(%p) Relay\n", This);
 
-    /* As d3d8 and d3d9 structures differ, pass in ptrs to where data needs to go */
-    wined3ddesc.Format              = &format;
-    wined3ddesc.Type                = (WINED3DRESOURCETYPE *)&pDesc->Type;
-    wined3ddesc.Usage               = &pDesc->Usage;
-    wined3ddesc.Pool                = (WINED3DPOOL *) &pDesc->Pool;
-    wined3ddesc.Size                = &tmpInt;
-    wined3ddesc.Width               = &pDesc->Width;
-    wined3ddesc.Height              = &pDesc->Height;
-    wined3ddesc.Depth               = &pDesc->Depth;
-
     EnterCriticalSection(&d3d9_cs);
 
     hr = IWineD3DVolume_GetDesc(This->wineD3DVolume, &wined3ddesc);
 
     LeaveCriticalSection(&d3d9_cs);
 
-    if (SUCCEEDED(hr)) pDesc->Format = d3dformat_from_wined3dformat(format);
+    if (SUCCEEDED(hr))
+    {
+        pDesc->Format = d3dformat_from_wined3dformat(wined3ddesc.Format);
+        pDesc->Type = wined3ddesc.Type;
+        pDesc->Usage = wined3ddesc.Usage;
+        pDesc->Pool = wined3ddesc.Pool;
+        pDesc->Width = wined3ddesc.Width;
+        pDesc->Height = wined3ddesc.Height;
+        pDesc->Depth = wined3ddesc.Depth;
+    }
 
     return hr;
 }
diff --git a/dlls/d3d9/volumetexture.c b/dlls/d3d9/volumetexture.c
index 07b686f..efeb919 100644
--- a/dlls/d3d9/volumetexture.c
+++ b/dlls/d3d9/volumetexture.c
@@ -281,29 +281,26 @@ static void WINAPI IDirect3DVolumeTexture9Impl_GenerateMipSubLevels(LPDIRECT3DVO
 static HRESULT WINAPI IDirect3DVolumeTexture9Impl_GetLevelDesc(LPDIRECT3DVOLUMETEXTURE9 iface, UINT Level, D3DVOLUME_DESC* pDesc) {
     IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface;
     WINED3DVOLUME_DESC     wined3ddesc;
-    UINT                   tmpInt = -1;
-    WINED3DFORMAT format;
     HRESULT hr;
 
     TRACE("(%p) Relay\n", This);
 
-    /* As d3d8 and d3d9 structures differ, pass in ptrs to where data needs to go */
-    wined3ddesc.Format              = &format;
-    wined3ddesc.Type                = (WINED3DRESOURCETYPE *)&pDesc->Type;
-    wined3ddesc.Usage               = &pDesc->Usage;
-    wined3ddesc.Pool                = (WINED3DPOOL *) &pDesc->Pool;
-    wined3ddesc.Size                = &tmpInt;
-    wined3ddesc.Width               = &pDesc->Width;
-    wined3ddesc.Height              = &pDesc->Height;
-    wined3ddesc.Depth               = &pDesc->Depth;
-
     EnterCriticalSection(&d3d9_cs);
 
     hr = IWineD3DVolumeTexture_GetLevelDesc(This->wineD3DVolumeTexture, Level, &wined3ddesc);
 
     LeaveCriticalSection(&d3d9_cs);
 
-    if (SUCCEEDED(hr)) pDesc->Format = d3dformat_from_wined3dformat(format);
+    if (SUCCEEDED(hr))
+    {
+        pDesc->Format = d3dformat_from_wined3dformat(wined3ddesc.Format);
+        pDesc->Type = wined3ddesc.Type;
+        pDesc->Usage = wined3ddesc.Usage;
+        pDesc->Pool = wined3ddesc.Pool;
+        pDesc->Width = wined3ddesc.Width;
+        pDesc->Height = wined3ddesc.Height;
+        pDesc->Depth = wined3ddesc.Depth;
+    }
 
     return hr;
 }
diff --git a/dlls/wined3d/volume.c b/dlls/wined3d/volume.c
index 64d871b..829607d 100644
--- a/dlls/wined3d/volume.c
+++ b/dlls/wined3d/volume.c
@@ -196,14 +196,15 @@ static HRESULT WINAPI IWineD3DVolumeImpl_GetDesc(IWineD3DVolume *iface, WINED3DV
     IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface;
     TRACE("(%p) : copying into %p\n", This, pDesc);
 
-    *(pDesc->Format)  = This->resource.format_desc->format;
-    *(pDesc->Type)    = This->resource.resourceType;
-    *(pDesc->Usage)   = This->resource.usage;
-    *(pDesc->Pool)    = This->resource.pool;
-    *(pDesc->Size)    = This->resource.size; /* dx8 only */
-    *(pDesc->Width)   = This->currentDesc.Width;
-    *(pDesc->Height)  = This->currentDesc.Height;
-    *(pDesc->Depth)   = This->currentDesc.Depth;
+    pDesc->Format = This->resource.format_desc->format;
+    pDesc->Type = This->resource.resourceType;
+    pDesc->Usage = This->resource.usage;
+    pDesc->Pool = This->resource.pool;
+    pDesc->Size = This->resource.size; /* dx8 only */
+    pDesc->Width = This->currentDesc.Width;
+    pDesc->Height = This->currentDesc.Height;
+    pDesc->Depth = This->currentDesc.Depth;
+
     return WINED3D_OK;
 }
 
diff --git a/include/wine/wined3d.idl b/include/wine/wined3d.idl
index 51d886c..4a7dcb0 100644
--- a/include/wine/wined3d.idl
+++ b/include/wine/wined3d.idl
@@ -1737,14 +1737,14 @@ typedef struct _WINED3DSURFACE_DESC
 
 typedef struct _WINED3DVOLUME_DESC
 {
-    WINED3DFORMAT *Format;
-    WINED3DRESOURCETYPE *Type;
-    DWORD *Usage;
-    WINED3DPOOL *Pool;
-    UINT *Size;
-    UINT *Width;
-    UINT *Height;
-    UINT *Depth;
+    WINED3DFORMAT Format;
+    WINED3DRESOURCETYPE Type;
+    DWORD Usage;
+    WINED3DPOOL Pool;
+    UINT Size;
+    UINT Width;
+    UINT Height;
+    UINT Depth;
 } WINED3DVOLUME_DESC;
 
 typedef struct _WINED3DCLIPSTATUS




More information about the wine-cvs mailing list