d3d8: Fix GetDesc and GetLevelDesc for surfaces and textures.

Peter Beutner p.beutner at gmx.net
Fri May 19 07:17:56 CDT 2006


In DX8 the D3DSURFACE_DESC structure has a size field which needs to be set.
Thats actually the difference the comment there is speaking about. This was done
correctly in the old dx8 code but somehow got lost during the transition to wined3d.
Fix the comment as well.

Small bug, but enough to keep MaxPayne 2 crashing since ~0.9.8.

---

 dlls/d3d8/cubetexture.c |    5 ++---
 dlls/d3d8/surface.c     |    5 ++---
 dlls/d3d8/texture.c     |    5 ++---
 dlls/d3d8/volume.c      |    5 ++---
 4 files changed, 8 insertions(+), 12 deletions(-)

305a2f154940d676f0509ed368eb0e5c52f58c91
diff --git a/dlls/d3d8/cubetexture.c b/dlls/d3d8/cubetexture.c
index 2498855..3f742fe 100644
--- a/dlls/d3d8/cubetexture.c
+++ b/dlls/d3d8/cubetexture.c
@@ -134,16 +134,15 @@ DWORD WINAPI IDirect3DCubeTexture8Impl_G
 HRESULT WINAPI IDirect3DCubeTexture8Impl_GetLevelDesc(LPDIRECT3DCUBETEXTURE8 iface, UINT Level, D3DSURFACE_DESC *pDesc) {
     IDirect3DCubeTexture8Impl *This = (IDirect3DCubeTexture8Impl *)iface;
     WINED3DSURFACE_DESC    wined3ddesc;
-    UINT                   tmpInt = -1;
 
     TRACE("(%p) Relay\n", This);
 
-    /* As d3d8 and d3d8 structures differ, pass in ptrs to where data needs to go */
+    /* 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                = &tmpInt;
+    wined3ddesc.Size                = &pDesc->Size;
     wined3ddesc.MultiSampleType     = (WINED3DMULTISAMPLE_TYPE *) &pDesc->MultiSampleType;
     wined3ddesc.MultiSampleQuality  = NULL; /* DirectX9 only */
     wined3ddesc.Width               = &pDesc->Width;
diff --git a/dlls/d3d8/surface.c b/dlls/d3d8/surface.c
index 4153ea1..d264ac2 100644
--- a/dlls/d3d8/surface.c
+++ b/dlls/d3d8/surface.c
@@ -156,16 +156,15 @@ HRESULT WINAPI IDirect3DSurface8Impl_Get
 HRESULT WINAPI IDirect3DSurface8Impl_GetDesc(LPDIRECT3DSURFACE8 iface, D3DSURFACE_DESC *pDesc) {
     IDirect3DSurface8Impl *This = (IDirect3DSurface8Impl *)iface;
     WINED3DSURFACE_DESC    wined3ddesc;
-    UINT                   tmpInt = -1;
     TRACE("(%p) Relay\n", This);
 
-    /* As d3d8 and d3d8 structures differ, pass in ptrs to where data needs to go */
+    /* As d3d8 and d3d9 structures differ, pass in ptrs to where data needs to go */
     memset(&wined3ddesc, 0, sizeof(wined3ddesc));
     wined3ddesc.Format              = (WINED3DFORMAT *)&pDesc->Format;
     wined3ddesc.Type                = (WINED3DRESOURCETYPE *)&pDesc->Type;
     wined3ddesc.Usage               = &pDesc->Usage;
     wined3ddesc.Pool                = (WINED3DPOOL *) &pDesc->Pool;
-    wined3ddesc.Size                = &tmpInt;
+    wined3ddesc.Size                = &pDesc->Size;
     wined3ddesc.MultiSampleType     = (WINED3DMULTISAMPLE_TYPE *) &pDesc->MultiSampleType;
     wined3ddesc.Width               = &pDesc->Width;
     wined3ddesc.Height              = &pDesc->Height;
diff --git a/dlls/d3d8/texture.c b/dlls/d3d8/texture.c
index 736673a..c379489 100644
--- a/dlls/d3d8/texture.c
+++ b/dlls/d3d8/texture.c
@@ -135,16 +135,15 @@ HRESULT WINAPI IDirect3DTexture8Impl_Get
     IDirect3DTexture8Impl *This = (IDirect3DTexture8Impl *)iface;
 
     WINED3DSURFACE_DESC    wined3ddesc;
-    UINT                   tmpInt = -1;
     TRACE("(%p) Relay\n", This);
 
-    /* As d3d8 and d3d8 structures differ, pass in ptrs to where data needs to go */
+    /* As d3d8 and d3d9 structures differ, pass in ptrs to where data needs to go */
     memset(&wined3ddesc, 0, sizeof(wined3ddesc));
     wined3ddesc.Format              = (WINED3DFORMAT *)&pDesc->Format;
     wined3ddesc.Type                = (WINED3DRESOURCETYPE *)&pDesc->Type;
     wined3ddesc.Usage               = &pDesc->Usage;
     wined3ddesc.Pool                = (WINED3DPOOL *) &pDesc->Pool;
-    wined3ddesc.Size                = &tmpInt; /* required for d3d8 */
+    wined3ddesc.Size                = &pDesc->Size;
     wined3ddesc.MultiSampleType     = (WINED3DMULTISAMPLE_TYPE *) &pDesc->MultiSampleType;
     wined3ddesc.Width               = &pDesc->Width;
     wined3ddesc.Height              = &pDesc->Height;
diff --git a/dlls/d3d8/volume.c b/dlls/d3d8/volume.c
index cbde666..bb7f5b1 100644
--- a/dlls/d3d8/volume.c
+++ b/dlls/d3d8/volume.c
@@ -132,16 +132,15 @@ HRESULT WINAPI IDirect3DVolume8Impl_GetC
 HRESULT WINAPI IDirect3DVolume8Impl_GetDesc(LPDIRECT3DVOLUME8 iface, D3DVOLUME_DESC *pDesc) {
     IDirect3DVolume8Impl *This = (IDirect3DVolume8Impl *)iface;
     WINED3DVOLUME_DESC     wined3ddesc;
-    UINT                   tmpInt = -1;
 
     TRACE("(%p) Relay\n", This);
 
-    /* As d3d8 and d3d8 structures differ, pass in ptrs to where data needs to go */
+    /* 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                = &tmpInt;
+    wined3ddesc.Size                = &pDesc->Size;
     wined3ddesc.Width               = &pDesc->Width;
     wined3ddesc.Height              = &pDesc->Height;
     wined3ddesc.Depth               = &pDesc->Depth;
-- 
1.3.2




More information about the wine-patches mailing list