wined3d: Get rid of the pointers in WINED3DSURFACE_DESC.
Henri Verbeet
hverbeet at codeweavers.com
Mon Jun 15 02:06:50 CDT 2009
---
dlls/d3d8/cubetexture.c | 23 +++++++++++------------
dlls/d3d8/device.c | 16 +++++++---------
dlls/d3d8/surface.c | 23 +++++++++++------------
dlls/d3d8/texture.c | 23 +++++++++++------------
dlls/d3d9/cubetexture.c | 27 ++++++++++++---------------
dlls/d3d9/device.c | 25 ++++++-------------------
dlls/d3d9/surface.c | 27 ++++++++++++---------------
dlls/d3d9/texture.c | 30 +++++++++++++-----------------
dlls/ddraw/ddraw.c | 43 +++++++++++++------------------------------
dlls/ddraw/device.c | 13 +++----------
dlls/wined3d/device.c | 20 +++++++++-----------
dlls/wined3d/stateblock.c | 22 +++++++++-------------
dlls/wined3d/surface_base.c | 20 +++++++++++---------
include/wine/wined3d.idl | 18 +++++++++---------
14 files changed, 137 insertions(+), 193 deletions(-)
diff --git a/dlls/d3d8/cubetexture.c b/dlls/d3d8/cubetexture.c
index 32511d6..84a1e41 100644
--- a/dlls/d3d8/cubetexture.c
+++ b/dlls/d3d8/cubetexture.c
@@ -201,22 +201,21 @@ static HRESULT WINAPI IDirect3DCubeTexture8Impl_GetLevelDesc(LPDIRECT3DCUBETEXTU
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.MultiSampleType = (WINED3DMULTISAMPLE_TYPE *) &pDesc->MultiSampleType;
- wined3ddesc.MultiSampleQuality = NULL; /* DirectX9 only */
- wined3ddesc.Width = &pDesc->Width;
- wined3ddesc.Height = &pDesc->Height;
-
EnterCriticalSection(&d3d8_cs);
hr = IWineD3DCubeTexture_GetLevelDesc(This->wineD3DCubeTexture, 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.resource_type;
+ pDesc->Usage = wined3ddesc.usage;
+ pDesc->Pool = wined3ddesc.pool;
+ pDesc->Size = wined3ddesc.size;
+ pDesc->MultiSampleType = wined3ddesc.multisample_type;
+ pDesc->Width = wined3ddesc.width;
+ pDesc->Height = wined3ddesc.height;
+ }
return hr;
}
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index eb7cc16..d97803f 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -893,20 +893,18 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CopyRects(LPDIRECT3DDEVICE8 iface, ID
/* Check that the source texture is in WINED3DPOOL_SYSTEMMEM and the destination texture is in WINED3DPOOL_DEFAULT */
- memset(&winedesc, 0, sizeof(winedesc));
- winedesc.Format = &srcFormat;
- winedesc.Width = &srcWidth;
- winedesc.Height = &srcHeight;
- winedesc.Size = &srcSize;
EnterCriticalSection(&d3d8_cs);
IWineD3DSurface_GetDesc(Source->wineD3DSurface, &winedesc);
+ srcFormat = winedesc.format;
+ srcWidth = winedesc.width;
+ srcHeight = winedesc.height;
+ srcSize = winedesc.size;
- winedesc.Format = &destFormat;
- winedesc.Width = &destWidth;
- winedesc.Height = &destHeight;
- winedesc.Size = NULL;
IWineD3DSurface_GetDesc(Dest->wineD3DSurface, &winedesc);
+ destFormat = winedesc.format;
+ destWidth = winedesc.width;
+ destHeight = winedesc.height;
/* Check that the source and destination formats match */
if (srcFormat != destFormat && WINED3DFMT_UNKNOWN != destFormat) {
diff --git a/dlls/d3d8/surface.c b/dlls/d3d8/surface.c
index 4b382ec..c3aa11a 100644
--- a/dlls/d3d8/surface.c
+++ b/dlls/d3d8/surface.c
@@ -159,22 +159,21 @@ static HRESULT WINAPI IDirect3DSurface8Impl_GetDesc(LPDIRECT3DSURFACE8 iface, D3
HRESULT hr;
TRACE("(%p) Relay\n", This);
- /* 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 = &pDesc->Size;
- wined3ddesc.MultiSampleType = (WINED3DMULTISAMPLE_TYPE *) &pDesc->MultiSampleType;
- wined3ddesc.Width = &pDesc->Width;
- wined3ddesc.Height = &pDesc->Height;
-
EnterCriticalSection(&d3d8_cs);
hr = IWineD3DSurface_GetDesc(This->wineD3DSurface, &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.resource_type;
+ pDesc->Usage = wined3ddesc.usage;
+ pDesc->Pool = wined3ddesc.pool;
+ pDesc->Size = wined3ddesc.size;
+ pDesc->MultiSampleType = wined3ddesc.multisample_type;
+ pDesc->Width = wined3ddesc.width;
+ pDesc->Height = wined3ddesc.height;
+ }
return hr;
}
diff --git a/dlls/d3d8/texture.c b/dlls/d3d8/texture.c
index c1bb91e..cbfc95a 100644
--- a/dlls/d3d8/texture.c
+++ b/dlls/d3d8/texture.c
@@ -200,22 +200,21 @@ static HRESULT WINAPI IDirect3DTexture8Impl_GetLevelDesc(LPDIRECT3DTEXTURE8 ifac
WINED3DSURFACE_DESC wined3ddesc;
TRACE("(%p) Relay\n", This);
- /* 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 = &pDesc->Size;
- wined3ddesc.MultiSampleType = (WINED3DMULTISAMPLE_TYPE *) &pDesc->MultiSampleType;
- wined3ddesc.Width = &pDesc->Width;
- wined3ddesc.Height = &pDesc->Height;
-
EnterCriticalSection(&d3d8_cs);
hr = IWineD3DTexture_GetLevelDesc(This->wineD3DTexture, 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.resource_type;
+ pDesc->Usage = wined3ddesc.usage;
+ pDesc->Pool = wined3ddesc.pool;
+ pDesc->Size = wined3ddesc.size;
+ pDesc->MultiSampleType = wined3ddesc.multisample_type;
+ pDesc->Width = wined3ddesc.width;
+ pDesc->Height = wined3ddesc.height;
+ }
return hr;
}
diff --git a/dlls/d3d9/cubetexture.c b/dlls/d3d9/cubetexture.c
index bbd171e..90c174c 100644
--- a/dlls/d3d9/cubetexture.c
+++ b/dlls/d3d9/cubetexture.c
@@ -232,29 +232,26 @@ static void WINAPI IDirect3DCubeTexture9Impl_GenerateMipSubLevels(LPDIRECT3DCUBE
/* IDirect3DCubeTexture9 Interface follow: */
static HRESULT WINAPI IDirect3DCubeTexture9Impl_GetLevelDesc(LPDIRECT3DCUBETEXTURE9 iface, UINT Level, D3DSURFACE_DESC* pDesc) {
IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
- WINED3DSURFACE_DESC wined3ddesc;
- UINT tmpInt = -1;
- WINED3DFORMAT format;
+ WINED3DSURFACE_DESC wined3ddesc;
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.MultiSampleType = (WINED3DMULTISAMPLE_TYPE *) &pDesc->MultiSampleType;
- wined3ddesc.MultiSampleQuality = &pDesc->MultiSampleQuality;
- wined3ddesc.Width = &pDesc->Width;
- wined3ddesc.Height = &pDesc->Height;
-
EnterCriticalSection(&d3d9_cs);
hr = IWineD3DCubeTexture_GetLevelDesc(This->wineD3DCubeTexture, 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.resource_type;
+ pDesc->Usage = wined3ddesc.usage;
+ pDesc->Pool = wined3ddesc.pool;
+ pDesc->MultiSampleType = wined3ddesc.multisample_type;
+ pDesc->MultiSampleQuality = wined3ddesc.multisample_quality;
+ pDesc->Width = wined3ddesc.width;
+ pDesc->Height = wined3ddesc.height;
+ }
return hr;
}
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index 9d02539..9d1c72e 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -430,27 +430,15 @@ static HRESULT WINAPI reset_enum_callback(IWineD3DResource *resource, void *data
WINED3DVOLUME_DESC volume_desc;
D3DINDEXBUFFER_DESC index_desc;
D3DVERTEXBUFFER_DESC vertex_desc;
- WINED3DFORMAT dummy_format;
- WINED3DMULTISAMPLE_TYPE dummy_multisampletype;
- DWORD dummy_dword;
- WINED3DPOOL pool = WINED3DPOOL_SCRATCH; /* a harmless pool */
+ WINED3DPOOL pool;
IDirect3DResource9 *parent;
IWineD3DResource_GetParent(resource, (IUnknown **) &parent);
type = IDirect3DResource9_GetType(parent);
switch(type) {
case D3DRTYPE_SURFACE:
- surface_desc.Format = &dummy_format;
- surface_desc.Type = &type;
- surface_desc.Usage = &dummy_dword;
- surface_desc.Pool = &pool;
- surface_desc.Size = &dummy_dword;
- surface_desc.MultiSampleType = &dummy_multisampletype;
- surface_desc.MultiSampleQuality = &dummy_dword;
- surface_desc.Width = &dummy_dword;
- surface_desc.Height = &dummy_dword;
-
IWineD3DSurface_GetDesc((IWineD3DSurface *) resource, &surface_desc);
+ pool = surface_desc.pool;
break;
case D3DRTYPE_VOLUME:
@@ -472,6 +460,7 @@ static HRESULT WINAPI reset_enum_callback(IWineD3DResource *resource, void *data
* is a D3DPOOL_DEFAULT surface or volume as well
*/
default:
+ pool = WINED3DPOOL_SCRATCH; /* a harmless pool */
break;
}
@@ -791,13 +780,11 @@ static HRESULT WINAPI IDirect3DDevice9Impl_ColorFill(LPDIRECT3DDEVICE9EX iface
HRESULT hr;
TRACE("(%p) Relay\n" , This);
- memset(&desc, 0, sizeof(desc));
- desc.Usage = &usage;
- desc.Pool = &pool;
- desc.Type = &restype;
-
EnterCriticalSection(&d3d9_cs);
IWineD3DSurface_GetDesc(surface->wineD3DSurface, &desc);
+ usage = desc.usage;
+ pool = desc.pool;
+ restype = desc.resource_type;
/* This method is only allowed with surfaces that are render targets, or offscreen plain surfaces
* in D3DPOOL_DEFAULT
diff --git a/dlls/d3d9/surface.c b/dlls/d3d9/surface.c
index f95c387..70444b2 100644
--- a/dlls/d3d9/surface.c
+++ b/dlls/d3d9/surface.c
@@ -205,28 +205,25 @@ static HRESULT WINAPI IDirect3DSurface9Impl_GetContainer(LPDIRECT3DSURFACE9 ifac
static HRESULT WINAPI IDirect3DSurface9Impl_GetDesc(LPDIRECT3DSURFACE9 iface, D3DSURFACE_DESC* pDesc) {
IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
- WINED3DSURFACE_DESC wined3ddesc;
- UINT tmpInt = -1;
- WINED3DFORMAT format;
+ WINED3DSURFACE_DESC wined3ddesc;
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.MultiSampleType = (WINED3DMULTISAMPLE_TYPE *) &pDesc->MultiSampleType;
- wined3ddesc.MultiSampleQuality = &pDesc->MultiSampleQuality;
- wined3ddesc.Width = &pDesc->Width;
- wined3ddesc.Height = &pDesc->Height;
-
EnterCriticalSection(&d3d9_cs);
hr = IWineD3DSurface_GetDesc(This->wineD3DSurface, &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.resource_type;
+ pDesc->Usage = wined3ddesc.usage;
+ pDesc->Pool = wined3ddesc.pool;
+ pDesc->MultiSampleType = wined3ddesc.multisample_type;
+ pDesc->MultiSampleQuality = wined3ddesc.multisample_quality;
+ pDesc->Width = wined3ddesc.width;
+ pDesc->Height = wined3ddesc.height;
+ }
return hr;
}
diff --git a/dlls/d3d9/texture.c b/dlls/d3d9/texture.c
index f0a9c38..10dd498 100644
--- a/dlls/d3d9/texture.c
+++ b/dlls/d3d9/texture.c
@@ -229,30 +229,26 @@ static void WINAPI IDirect3DTexture9Impl_GenerateMipSubLevels(LPDIRECT3DTEXTURE9
/* IDirect3DTexture9 Interface follow: */
static HRESULT WINAPI IDirect3DTexture9Impl_GetLevelDesc(LPDIRECT3DTEXTURE9 iface, UINT Level, D3DSURFACE_DESC* pDesc) {
IDirect3DTexture9Impl *This = (IDirect3DTexture9Impl *)iface;
-
- WINED3DSURFACE_DESC wined3ddesc;
- UINT tmpInt = -1;
- HRESULT hr;
- WINED3DFORMAT format;
+ WINED3DSURFACE_DESC wined3ddesc;
+ 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; /* required for d3d8 */
- wined3ddesc.MultiSampleType = (WINED3DMULTISAMPLE_TYPE *) &pDesc->MultiSampleType;
- wined3ddesc.MultiSampleQuality = &pDesc->MultiSampleQuality;
- wined3ddesc.Width = &pDesc->Width;
- wined3ddesc.Height = &pDesc->Height;
-
EnterCriticalSection(&d3d9_cs);
hr = IWineD3DTexture_GetLevelDesc(This->wineD3DTexture, 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.resource_type;
+ pDesc->Usage = wined3ddesc.usage;
+ pDesc->Pool = wined3ddesc.pool;
+ pDesc->MultiSampleType = wined3ddesc.multisample_type;
+ pDesc->MultiSampleQuality = wined3ddesc.multisample_quality;
+ pDesc->Width = wined3ddesc.width;
+ pDesc->Height = wined3ddesc.height;
+ }
return hr;
}
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index bfd716d..bd96418 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -1664,10 +1664,8 @@ IDirectDrawImpl_RecreateSurfacesCallback(IDirectDrawSurface7 *surf,
WINED3DSURFACE_DESC Desc;
WINED3DFORMAT Format;
- WINED3DRESOURCETYPE Type;
DWORD Usage;
WINED3DPOOL Pool;
- UINT Size;
WINED3DMULTISAMPLE_TYPE MultiSampleType;
DWORD MultiSampleQuality;
@@ -1702,19 +1700,17 @@ IDirectDrawImpl_RecreateSurfacesCallback(IDirectDrawSurface7 *surf,
IWineD3DSurface_GetClipper(wineD3DSurface, &clipper);
/* Get the surface properties */
- Desc.Format = &Format;
- Desc.Type = &Type;
- Desc.Usage = &Usage;
- Desc.Pool = &Pool;
- Desc.Size = &Size;
- Desc.MultiSampleType = &MultiSampleType;
- Desc.MultiSampleQuality = &MultiSampleQuality;
- Desc.Width = &Width;
- Desc.Height = &Height;
-
hr = IWineD3DSurface_GetDesc(wineD3DSurface, &Desc);
if(hr != D3D_OK) return hr;
+ Format = Desc.format;
+ Usage = Desc.usage;
+ Pool = Desc.pool;
+ MultiSampleType = Desc.multisample_type;
+ MultiSampleQuality = Desc.multisample_quality;
+ Width = Desc.width;
+ Height = Desc.height;
+
if(swapchain) {
/* If there's a swapchain, it owns the IParent interface. Create a new one for the
* new surface
@@ -1840,9 +1836,8 @@ IDirectDrawImpl_CreateNewSurface(IDirectDrawImpl *This,
UINT level)
{
HRESULT hr;
- UINT Width = 0, Height = 0;
+ UINT Width, Height;
WINED3DFORMAT Format = WINED3DFMT_UNKNOWN;
- WINED3DRESOURCETYPE ResType;
DWORD Usage = 0;
WINED3DSURFTYPE ImplType = This->ImplType;
WINED3DSURFACE_DESC Desc;
@@ -1850,12 +1845,6 @@ IDirectDrawImpl_CreateNewSurface(IDirectDrawImpl *This,
IParentImpl *parImpl = NULL;
WINED3DPOOL Pool = WINED3DPOOL_DEFAULT;
- /* Dummies for GetDesc */
- WINED3DPOOL dummy_d3dpool;
- WINED3DMULTISAMPLE_TYPE dummy_mst;
- UINT dummy_uint;
- DWORD dummy_dword;
-
if (TRACE_ON(ddraw))
{
TRACE(" (%p) Requesting surface desc :\n", This);
@@ -2058,16 +2047,6 @@ IDirectDrawImpl_CreateNewSurface(IDirectDrawImpl *This,
* Don't use the Format choosen above, WineD3D might have
* changed it
*/
- Desc.Format = &Format;
- Desc.Type = &ResType;
- Desc.Usage = &Usage;
- Desc.Pool = &dummy_d3dpool;
- Desc.Size = &dummy_uint;
- Desc.MultiSampleType = &dummy_mst;
- Desc.MultiSampleQuality = &dummy_dword;
- Desc.Width = &Width;
- Desc.Height = &Height;
-
(*ppSurf)->surface_desc.dwFlags |= DDSD_PIXELFORMAT;
hr = IWineD3DSurface_GetDesc((*ppSurf)->WineD3DSurface, &Desc);
if(hr != D3D_OK)
@@ -2077,6 +2056,10 @@ IDirectDrawImpl_CreateNewSurface(IDirectDrawImpl *This,
return hr;
}
+ Format = Desc.format;
+ Width = Desc.width;
+ Height = Desc.height;
+
if(Format == WINED3DFMT_UNKNOWN)
{
FIXME("IWineD3DSurface::GetDesc returned WINED3DFMT_UNKNOWN\n");
diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c
index bb3f479..261d6e3 100644
--- a/dlls/ddraw/device.c
+++ b/dlls/ddraw/device.c
@@ -2558,7 +2558,6 @@ IDirect3DDeviceImpl_3_GetRenderState(IDirect3DDevice3 *iface,
BOOL tex_alpha = FALSE;
IWineD3DBaseTexture *tex = NULL;
WINED3DSURFACE_DESC desc;
- WINED3DFORMAT fmt;
DDPIXELFORMAT ddfmt;
hr = IWineD3DDevice_GetTexture(This->wineD3DDevice,
@@ -2567,13 +2566,11 @@ IDirect3DDeviceImpl_3_GetRenderState(IDirect3DDevice3 *iface,
if(hr == WINED3D_OK && tex)
{
- memset(&desc, 0, sizeof(desc));
- desc.Format = &fmt;
hr = IWineD3DTexture_GetLevelDesc((IWineD3DTexture*) tex, 0, &desc);
if (SUCCEEDED(hr))
{
ddfmt.dwSize = sizeof(ddfmt);
- PixelFormat_WineD3DtoDD(&ddfmt, fmt);
+ PixelFormat_WineD3DtoDD(&ddfmt, desc.format);
if (ddfmt.u5.dwRGBAlphaBitMask) tex_alpha = TRUE;
}
@@ -2833,7 +2830,6 @@ IDirect3DDeviceImpl_3_SetRenderState(IDirect3DDevice3 *iface,
BOOL tex_alpha = FALSE;
IWineD3DBaseTexture *tex = NULL;
WINED3DSURFACE_DESC desc;
- WINED3DFORMAT fmt;
DDPIXELFORMAT ddfmt;
hr = IWineD3DDevice_GetTexture(This->wineD3DDevice,
@@ -2843,12 +2839,11 @@ IDirect3DDeviceImpl_3_SetRenderState(IDirect3DDevice3 *iface,
if(hr == WINED3D_OK && tex)
{
memset(&desc, 0, sizeof(desc));
- desc.Format = &fmt;
hr = IWineD3DTexture_GetLevelDesc((IWineD3DTexture*) tex, 0, &desc);
if (SUCCEEDED(hr))
{
ddfmt.dwSize = sizeof(ddfmt);
- PixelFormat_WineD3DtoDD(&ddfmt, fmt);
+ PixelFormat_WineD3DtoDD(&ddfmt, desc.format);
if (ddfmt.u5.dwRGBAlphaBitMask) tex_alpha = TRUE;
}
@@ -4648,7 +4643,6 @@ IDirect3DDeviceImpl_3_SetTexture(IDirect3DDevice3 *iface,
BOOL tex_alpha = FALSE;
IWineD3DBaseTexture *tex = NULL;
WINED3DSURFACE_DESC desc;
- WINED3DFORMAT fmt;
DDPIXELFORMAT ddfmt;
HRESULT result;
@@ -4659,12 +4653,11 @@ IDirect3DDeviceImpl_3_SetTexture(IDirect3DDevice3 *iface,
if(result == WINED3D_OK && tex)
{
memset(&desc, 0, sizeof(desc));
- desc.Format = &fmt;
result = IWineD3DTexture_GetLevelDesc((IWineD3DTexture*) tex, 0, &desc);
if (SUCCEEDED(result))
{
ddfmt.dwSize = sizeof(ddfmt);
- PixelFormat_WineD3DtoDD(&ddfmt, fmt);
+ PixelFormat_WineD3DtoDD(&ddfmt, desc.format);
if (ddfmt.u5.dwRGBAlphaBitMask) tex_alpha = TRUE;
}
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 93075ae..7b55d6e 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -5748,21 +5748,19 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface,
WINED3DSURFACE_DESC winedesc;
TRACE("(%p) : Source (%p) Rect (%p) Destination (%p) Point(%p)\n", This, pSourceSurface, pSourceRect, pDestinationSurface, pDestPoint);
- memset(&winedesc, 0, sizeof(winedesc));
- winedesc.Width = &srcSurfaceWidth;
- winedesc.Height = &srcSurfaceHeight;
- winedesc.Pool = &srcPool;
- winedesc.Format = &srcFormat;
IWineD3DSurface_GetDesc(pSourceSurface, &winedesc);
-
- winedesc.Width = &destSurfaceWidth;
- winedesc.Height = &destSurfaceHeight;
- winedesc.Pool = &destPool;
- winedesc.Format = &destFormat;
- winedesc.Size = &destSize;
+ srcSurfaceWidth = winedesc.width;
+ srcSurfaceHeight = winedesc.height;
+ srcPool = winedesc.pool;
+ srcFormat = winedesc.format;
IWineD3DSurface_GetDesc(pDestinationSurface, &winedesc);
+ destSurfaceWidth = winedesc.width;
+ destSurfaceHeight = winedesc.height;
+ destPool = winedesc.pool;
+ destFormat = winedesc.format;
+ destSize = winedesc.size;
if(srcPool != WINED3DPOOL_SYSTEMMEM || destPool != WINED3DPOOL_DEFAULT){
WARN("source %p must be SYSTEMMEM and dest %p must be DEFAULT, returning WINED3DERR_INVALIDCALL\n", pSourceSurface, pDestinationSurface);
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c
index 1c9b5a8..a8e53f0 100644
--- a/dlls/wined3d/stateblock.c
+++ b/dlls/wined3d/stateblock.c
@@ -1087,9 +1087,6 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_InitStartupStateBlock(IWineD3DStat
unsigned int i;
IWineD3DSwapChain *swapchain;
IWineD3DSurface *backbuffer;
- WINED3DSURFACE_DESC desc = {0};
- UINT width, height;
- RECT scissorrect;
HRESULT hr;
/* Note this may have a large overhead but it should only be executed
@@ -1292,28 +1289,27 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_InitStartupStateBlock(IWineD3DStat
This->textures[i] = NULL;
}
- /* Set the default scissor rect values */
- desc.Width = &width;
- desc.Height = &height;
-
/* check the return values, because the GetBackBuffer call isn't valid for ddraw */
hr = IWineD3DDevice_GetSwapChain(device, 0, &swapchain);
if( hr == WINED3D_OK && swapchain != NULL) {
WINED3DVIEWPORT vp;
hr = IWineD3DSwapChain_GetBackBuffer(swapchain, 0, WINED3DBACKBUFFER_TYPE_MONO, &backbuffer);
- if( hr == WINED3D_OK && backbuffer != NULL) {
+ if (SUCCEEDED(hr) && backbuffer)
+ {
+ WINED3DSURFACE_DESC desc;
+ RECT scissorrect;
+
IWineD3DSurface_GetDesc(backbuffer, &desc);
IWineD3DSurface_Release(backbuffer);
+ /* Set the default scissor rect values */
scissorrect.left = 0;
- scissorrect.right = width;
+ scissorrect.right = desc.width;
scissorrect.top = 0;
- scissorrect.bottom = height;
+ scissorrect.bottom = desc.height;
hr = IWineD3DDevice_SetScissorRect(device, &scissorrect);
- if( hr != WINED3D_OK ) {
- ERR("This should never happen, expect rendering issues!\n");
- }
+ if (FAILED(hr)) ERR("This should never happen, expect rendering issues!\n");
}
/* Set the default viewport */
diff --git a/dlls/wined3d/surface_base.c b/dlls/wined3d/surface_base.c
index 1d1341b..d776785 100644
--- a/dlls/wined3d/surface_base.c
+++ b/dlls/wined3d/surface_base.c
@@ -181,15 +181,17 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetDesc(IWineD3DSurface *iface, WINED3DSU
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
TRACE("(%p) : copying into %p\n", This, pDesc);
- if(pDesc->Format != NULL) *(pDesc->Format) = This->resource.format_desc->format;
- if(pDesc->Type != NULL) *(pDesc->Type) = This->resource.resourceType;
- if(pDesc->Usage != NULL) *(pDesc->Usage) = This->resource.usage;
- if(pDesc->Pool != NULL) *(pDesc->Pool) = This->resource.pool;
- if(pDesc->Size != NULL) *(pDesc->Size) = This->resource.size; /* dx8 only */
- if(pDesc->MultiSampleType != NULL) *(pDesc->MultiSampleType) = This->currentDesc.MultiSampleType;
- if(pDesc->MultiSampleQuality != NULL) *(pDesc->MultiSampleQuality) = This->currentDesc.MultiSampleQuality;
- if(pDesc->Width != NULL) *(pDesc->Width) = This->currentDesc.Width;
- if(pDesc->Height != NULL) *(pDesc->Height) = This->currentDesc.Height;
+
+ pDesc->format = This->resource.format_desc->format;
+ pDesc->resource_type = This->resource.resourceType;
+ pDesc->usage = This->resource.usage;
+ pDesc->pool = This->resource.pool;
+ pDesc->size = This->resource.size; /* dx8 only */
+ pDesc->multisample_type = This->currentDesc.MultiSampleType;
+ pDesc->multisample_quality = This->currentDesc.MultiSampleQuality;
+ pDesc->width = This->currentDesc.Width;
+ pDesc->height = This->currentDesc.Height;
+
return WINED3D_OK;
}
diff --git a/include/wine/wined3d.idl b/include/wine/wined3d.idl
index 5855082..31222f3 100644
--- a/include/wine/wined3d.idl
+++ b/include/wine/wined3d.idl
@@ -1724,15 +1724,15 @@ typedef struct _WINED3DPRESENT_PARAMETERS
typedef struct _WINED3DSURFACE_DESC
{
- WINED3DFORMAT *Format;
- WINED3DRESOURCETYPE *Type;
- DWORD *Usage;
- WINED3DPOOL *Pool;
- UINT *Size;
- WINED3DMULTISAMPLE_TYPE *MultiSampleType;
- DWORD *MultiSampleQuality;
- UINT *Width;
- UINT *Height;
+ WINED3DFORMAT format;
+ WINED3DRESOURCETYPE resource_type;
+ DWORD usage;
+ WINED3DPOOL pool;
+ UINT size;
+ WINED3DMULTISAMPLE_TYPE multisample_type;
+ DWORD multisample_quality;
+ UINT width;
+ UINT height;
} WINED3DSURFACE_DESC;
typedef struct _WINED3DVOLUME_DESC
--
1.6.0.6
--------------010302070202060300000704--
More information about the wine-patches
mailing list