wined3d: Get rid of the pointers in WINED3DSURFACE_DESC.

This commit is contained in:
Henri Verbeet 2009-06-15 09:06:50 +02:00 committed by Alexandre Julliard
parent fede35d1c5
commit 88162fabb8
14 changed files with 137 additions and 193 deletions

View File

@ -201,22 +201,21 @@ static HRESULT WINAPI IDirect3DCubeTexture8Impl_GetLevelDesc(LPDIRECT3DCUBETEXTU
TRACE("(%p) Relay\n", This); 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); EnterCriticalSection(&d3d8_cs);
hr = IWineD3DCubeTexture_GetLevelDesc(This->wineD3DCubeTexture, Level, &wined3ddesc); hr = IWineD3DCubeTexture_GetLevelDesc(This->wineD3DCubeTexture, Level, &wined3ddesc);
LeaveCriticalSection(&d3d8_cs); 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; return hr;
} }

View File

@ -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 */ /* 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); EnterCriticalSection(&d3d8_cs);
IWineD3DSurface_GetDesc(Source->wineD3DSurface, &winedesc); 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); IWineD3DSurface_GetDesc(Dest->wineD3DSurface, &winedesc);
destFormat = winedesc.format;
destWidth = winedesc.width;
destHeight = winedesc.height;
/* Check that the source and destination formats match */ /* Check that the source and destination formats match */
if (srcFormat != destFormat && WINED3DFMT_UNKNOWN != destFormat) { if (srcFormat != destFormat && WINED3DFMT_UNKNOWN != destFormat) {

View File

@ -159,22 +159,21 @@ static HRESULT WINAPI IDirect3DSurface8Impl_GetDesc(LPDIRECT3DSURFACE8 iface, D3
HRESULT hr; HRESULT hr;
TRACE("(%p) Relay\n", This); 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); EnterCriticalSection(&d3d8_cs);
hr = IWineD3DSurface_GetDesc(This->wineD3DSurface, &wined3ddesc); hr = IWineD3DSurface_GetDesc(This->wineD3DSurface, &wined3ddesc);
LeaveCriticalSection(&d3d8_cs); 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; return hr;
} }

View File

@ -200,22 +200,21 @@ static HRESULT WINAPI IDirect3DTexture8Impl_GetLevelDesc(LPDIRECT3DTEXTURE8 ifac
WINED3DSURFACE_DESC wined3ddesc; WINED3DSURFACE_DESC wined3ddesc;
TRACE("(%p) Relay\n", This); 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); EnterCriticalSection(&d3d8_cs);
hr = IWineD3DTexture_GetLevelDesc(This->wineD3DTexture, Level, &wined3ddesc); hr = IWineD3DTexture_GetLevelDesc(This->wineD3DTexture, Level, &wined3ddesc);
LeaveCriticalSection(&d3d8_cs); 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; return hr;
} }

View File

@ -233,28 +233,25 @@ static void WINAPI IDirect3DCubeTexture9Impl_GenerateMipSubLevels(LPDIRECT3DCUBE
static HRESULT WINAPI IDirect3DCubeTexture9Impl_GetLevelDesc(LPDIRECT3DCUBETEXTURE9 iface, UINT Level, D3DSURFACE_DESC* pDesc) { static HRESULT WINAPI IDirect3DCubeTexture9Impl_GetLevelDesc(LPDIRECT3DCUBETEXTURE9 iface, UINT Level, D3DSURFACE_DESC* pDesc) {
IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
WINED3DSURFACE_DESC wined3ddesc; WINED3DSURFACE_DESC wined3ddesc;
UINT tmpInt = -1;
WINED3DFORMAT format;
HRESULT hr; HRESULT hr;
TRACE("(%p) Relay\n", This); 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); EnterCriticalSection(&d3d9_cs);
hr = IWineD3DCubeTexture_GetLevelDesc(This->wineD3DCubeTexture, Level, &wined3ddesc); hr = IWineD3DCubeTexture_GetLevelDesc(This->wineD3DCubeTexture, Level, &wined3ddesc);
LeaveCriticalSection(&d3d9_cs); 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; return hr;
} }

View File

@ -430,27 +430,15 @@ static HRESULT WINAPI reset_enum_callback(IWineD3DResource *resource, void *data
WINED3DVOLUME_DESC volume_desc; WINED3DVOLUME_DESC volume_desc;
D3DINDEXBUFFER_DESC index_desc; D3DINDEXBUFFER_DESC index_desc;
D3DVERTEXBUFFER_DESC vertex_desc; D3DVERTEXBUFFER_DESC vertex_desc;
WINED3DFORMAT dummy_format; WINED3DPOOL pool;
WINED3DMULTISAMPLE_TYPE dummy_multisampletype;
DWORD dummy_dword;
WINED3DPOOL pool = WINED3DPOOL_SCRATCH; /* a harmless pool */
IDirect3DResource9 *parent; IDirect3DResource9 *parent;
IWineD3DResource_GetParent(resource, (IUnknown **) &parent); IWineD3DResource_GetParent(resource, (IUnknown **) &parent);
type = IDirect3DResource9_GetType(parent); type = IDirect3DResource9_GetType(parent);
switch(type) { switch(type) {
case D3DRTYPE_SURFACE: 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); IWineD3DSurface_GetDesc((IWineD3DSurface *) resource, &surface_desc);
pool = surface_desc.pool;
break; break;
case D3DRTYPE_VOLUME: 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 * is a D3DPOOL_DEFAULT surface or volume as well
*/ */
default: default:
pool = WINED3DPOOL_SCRATCH; /* a harmless pool */
break; break;
} }
@ -791,13 +780,11 @@ static HRESULT WINAPI IDirect3DDevice9Impl_ColorFill(LPDIRECT3DDEVICE9EX iface
HRESULT hr; HRESULT hr;
TRACE("(%p) Relay\n" , This); TRACE("(%p) Relay\n" , This);
memset(&desc, 0, sizeof(desc));
desc.Usage = &usage;
desc.Pool = &pool;
desc.Type = &restype;
EnterCriticalSection(&d3d9_cs); EnterCriticalSection(&d3d9_cs);
IWineD3DSurface_GetDesc(surface->wineD3DSurface, &desc); 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 /* This method is only allowed with surfaces that are render targets, or offscreen plain surfaces
* in D3DPOOL_DEFAULT * in D3DPOOL_DEFAULT

View File

@ -206,27 +206,24 @@ static HRESULT WINAPI IDirect3DSurface9Impl_GetContainer(LPDIRECT3DSURFACE9 ifac
static HRESULT WINAPI IDirect3DSurface9Impl_GetDesc(LPDIRECT3DSURFACE9 iface, D3DSURFACE_DESC* pDesc) { static HRESULT WINAPI IDirect3DSurface9Impl_GetDesc(LPDIRECT3DSURFACE9 iface, D3DSURFACE_DESC* pDesc) {
IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface; IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
WINED3DSURFACE_DESC wined3ddesc; WINED3DSURFACE_DESC wined3ddesc;
UINT tmpInt = -1;
WINED3DFORMAT format;
HRESULT hr; HRESULT hr;
TRACE("(%p) Relay\n", This); 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); EnterCriticalSection(&d3d9_cs);
hr = IWineD3DSurface_GetDesc(This->wineD3DSurface, &wined3ddesc); hr = IWineD3DSurface_GetDesc(This->wineD3DSurface, &wined3ddesc);
LeaveCriticalSection(&d3d9_cs); 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; return hr;
} }

View File

@ -229,30 +229,26 @@ static void WINAPI IDirect3DTexture9Impl_GenerateMipSubLevels(LPDIRECT3DTEXTURE9
/* IDirect3DTexture9 Interface follow: */ /* IDirect3DTexture9 Interface follow: */
static HRESULT WINAPI IDirect3DTexture9Impl_GetLevelDesc(LPDIRECT3DTEXTURE9 iface, UINT Level, D3DSURFACE_DESC* pDesc) { static HRESULT WINAPI IDirect3DTexture9Impl_GetLevelDesc(LPDIRECT3DTEXTURE9 iface, UINT Level, D3DSURFACE_DESC* pDesc) {
IDirect3DTexture9Impl *This = (IDirect3DTexture9Impl *)iface; IDirect3DTexture9Impl *This = (IDirect3DTexture9Impl *)iface;
WINED3DSURFACE_DESC wined3ddesc; WINED3DSURFACE_DESC wined3ddesc;
UINT tmpInt = -1;
HRESULT hr; HRESULT hr;
WINED3DFORMAT format;
TRACE("(%p) Relay\n", This); 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); EnterCriticalSection(&d3d9_cs);
hr = IWineD3DTexture_GetLevelDesc(This->wineD3DTexture, Level, &wined3ddesc); hr = IWineD3DTexture_GetLevelDesc(This->wineD3DTexture, Level, &wined3ddesc);
LeaveCriticalSection(&d3d9_cs); 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; return hr;
} }

View File

@ -1664,10 +1664,8 @@ IDirectDrawImpl_RecreateSurfacesCallback(IDirectDrawSurface7 *surf,
WINED3DSURFACE_DESC Desc; WINED3DSURFACE_DESC Desc;
WINED3DFORMAT Format; WINED3DFORMAT Format;
WINED3DRESOURCETYPE Type;
DWORD Usage; DWORD Usage;
WINED3DPOOL Pool; WINED3DPOOL Pool;
UINT Size;
WINED3DMULTISAMPLE_TYPE MultiSampleType; WINED3DMULTISAMPLE_TYPE MultiSampleType;
DWORD MultiSampleQuality; DWORD MultiSampleQuality;
@ -1702,19 +1700,17 @@ IDirectDrawImpl_RecreateSurfacesCallback(IDirectDrawSurface7 *surf,
IWineD3DSurface_GetClipper(wineD3DSurface, &clipper); IWineD3DSurface_GetClipper(wineD3DSurface, &clipper);
/* Get the surface properties */ /* 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); hr = IWineD3DSurface_GetDesc(wineD3DSurface, &Desc);
if(hr != D3D_OK) return hr; 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(swapchain) {
/* If there's a swapchain, it owns the IParent interface. Create a new one for the /* If there's a swapchain, it owns the IParent interface. Create a new one for the
* new surface * new surface
@ -1840,9 +1836,8 @@ IDirectDrawImpl_CreateNewSurface(IDirectDrawImpl *This,
UINT level) UINT level)
{ {
HRESULT hr; HRESULT hr;
UINT Width = 0, Height = 0; UINT Width, Height;
WINED3DFORMAT Format = WINED3DFMT_UNKNOWN; WINED3DFORMAT Format = WINED3DFMT_UNKNOWN;
WINED3DRESOURCETYPE ResType;
DWORD Usage = 0; DWORD Usage = 0;
WINED3DSURFTYPE ImplType = This->ImplType; WINED3DSURFTYPE ImplType = This->ImplType;
WINED3DSURFACE_DESC Desc; WINED3DSURFACE_DESC Desc;
@ -1850,12 +1845,6 @@ IDirectDrawImpl_CreateNewSurface(IDirectDrawImpl *This,
IParentImpl *parImpl = NULL; IParentImpl *parImpl = NULL;
WINED3DPOOL Pool = WINED3DPOOL_DEFAULT; WINED3DPOOL Pool = WINED3DPOOL_DEFAULT;
/* Dummies for GetDesc */
WINED3DPOOL dummy_d3dpool;
WINED3DMULTISAMPLE_TYPE dummy_mst;
UINT dummy_uint;
DWORD dummy_dword;
if (TRACE_ON(ddraw)) if (TRACE_ON(ddraw))
{ {
TRACE(" (%p) Requesting surface desc :\n", This); 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 * Don't use the Format choosen above, WineD3D might have
* changed it * 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; (*ppSurf)->surface_desc.dwFlags |= DDSD_PIXELFORMAT;
hr = IWineD3DSurface_GetDesc((*ppSurf)->WineD3DSurface, &Desc); hr = IWineD3DSurface_GetDesc((*ppSurf)->WineD3DSurface, &Desc);
if(hr != D3D_OK) if(hr != D3D_OK)
@ -2077,6 +2056,10 @@ IDirectDrawImpl_CreateNewSurface(IDirectDrawImpl *This,
return hr; return hr;
} }
Format = Desc.format;
Width = Desc.width;
Height = Desc.height;
if(Format == WINED3DFMT_UNKNOWN) if(Format == WINED3DFMT_UNKNOWN)
{ {
FIXME("IWineD3DSurface::GetDesc returned WINED3DFMT_UNKNOWN\n"); FIXME("IWineD3DSurface::GetDesc returned WINED3DFMT_UNKNOWN\n");

View File

@ -2558,7 +2558,6 @@ IDirect3DDeviceImpl_3_GetRenderState(IDirect3DDevice3 *iface,
BOOL tex_alpha = FALSE; BOOL tex_alpha = FALSE;
IWineD3DBaseTexture *tex = NULL; IWineD3DBaseTexture *tex = NULL;
WINED3DSURFACE_DESC desc; WINED3DSURFACE_DESC desc;
WINED3DFORMAT fmt;
DDPIXELFORMAT ddfmt; DDPIXELFORMAT ddfmt;
hr = IWineD3DDevice_GetTexture(This->wineD3DDevice, hr = IWineD3DDevice_GetTexture(This->wineD3DDevice,
@ -2567,13 +2566,11 @@ IDirect3DDeviceImpl_3_GetRenderState(IDirect3DDevice3 *iface,
if(hr == WINED3D_OK && tex) if(hr == WINED3D_OK && tex)
{ {
memset(&desc, 0, sizeof(desc));
desc.Format = &fmt;
hr = IWineD3DTexture_GetLevelDesc((IWineD3DTexture*) tex, 0, &desc); hr = IWineD3DTexture_GetLevelDesc((IWineD3DTexture*) tex, 0, &desc);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
ddfmt.dwSize = sizeof(ddfmt); ddfmt.dwSize = sizeof(ddfmt);
PixelFormat_WineD3DtoDD(&ddfmt, fmt); PixelFormat_WineD3DtoDD(&ddfmt, desc.format);
if (ddfmt.u5.dwRGBAlphaBitMask) tex_alpha = TRUE; if (ddfmt.u5.dwRGBAlphaBitMask) tex_alpha = TRUE;
} }
@ -2833,7 +2830,6 @@ IDirect3DDeviceImpl_3_SetRenderState(IDirect3DDevice3 *iface,
BOOL tex_alpha = FALSE; BOOL tex_alpha = FALSE;
IWineD3DBaseTexture *tex = NULL; IWineD3DBaseTexture *tex = NULL;
WINED3DSURFACE_DESC desc; WINED3DSURFACE_DESC desc;
WINED3DFORMAT fmt;
DDPIXELFORMAT ddfmt; DDPIXELFORMAT ddfmt;
hr = IWineD3DDevice_GetTexture(This->wineD3DDevice, hr = IWineD3DDevice_GetTexture(This->wineD3DDevice,
@ -2843,12 +2839,11 @@ IDirect3DDeviceImpl_3_SetRenderState(IDirect3DDevice3 *iface,
if(hr == WINED3D_OK && tex) if(hr == WINED3D_OK && tex)
{ {
memset(&desc, 0, sizeof(desc)); memset(&desc, 0, sizeof(desc));
desc.Format = &fmt;
hr = IWineD3DTexture_GetLevelDesc((IWineD3DTexture*) tex, 0, &desc); hr = IWineD3DTexture_GetLevelDesc((IWineD3DTexture*) tex, 0, &desc);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
ddfmt.dwSize = sizeof(ddfmt); ddfmt.dwSize = sizeof(ddfmt);
PixelFormat_WineD3DtoDD(&ddfmt, fmt); PixelFormat_WineD3DtoDD(&ddfmt, desc.format);
if (ddfmt.u5.dwRGBAlphaBitMask) tex_alpha = TRUE; if (ddfmt.u5.dwRGBAlphaBitMask) tex_alpha = TRUE;
} }
@ -4648,7 +4643,6 @@ IDirect3DDeviceImpl_3_SetTexture(IDirect3DDevice3 *iface,
BOOL tex_alpha = FALSE; BOOL tex_alpha = FALSE;
IWineD3DBaseTexture *tex = NULL; IWineD3DBaseTexture *tex = NULL;
WINED3DSURFACE_DESC desc; WINED3DSURFACE_DESC desc;
WINED3DFORMAT fmt;
DDPIXELFORMAT ddfmt; DDPIXELFORMAT ddfmt;
HRESULT result; HRESULT result;
@ -4659,12 +4653,11 @@ IDirect3DDeviceImpl_3_SetTexture(IDirect3DDevice3 *iface,
if(result == WINED3D_OK && tex) if(result == WINED3D_OK && tex)
{ {
memset(&desc, 0, sizeof(desc)); memset(&desc, 0, sizeof(desc));
desc.Format = &fmt;
result = IWineD3DTexture_GetLevelDesc((IWineD3DTexture*) tex, 0, &desc); result = IWineD3DTexture_GetLevelDesc((IWineD3DTexture*) tex, 0, &desc);
if (SUCCEEDED(result)) if (SUCCEEDED(result))
{ {
ddfmt.dwSize = sizeof(ddfmt); ddfmt.dwSize = sizeof(ddfmt);
PixelFormat_WineD3DtoDD(&ddfmt, fmt); PixelFormat_WineD3DtoDD(&ddfmt, desc.format);
if (ddfmt.u5.dwRGBAlphaBitMask) tex_alpha = TRUE; if (ddfmt.u5.dwRGBAlphaBitMask) tex_alpha = TRUE;
} }

View File

@ -5748,21 +5748,19 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface,
WINED3DSURFACE_DESC winedesc; WINED3DSURFACE_DESC winedesc;
TRACE("(%p) : Source (%p) Rect (%p) Destination (%p) Point(%p)\n", This, pSourceSurface, pSourceRect, pDestinationSurface, pDestPoint); 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); IWineD3DSurface_GetDesc(pSourceSurface, &winedesc);
srcSurfaceWidth = winedesc.width;
winedesc.Width = &destSurfaceWidth; srcSurfaceHeight = winedesc.height;
winedesc.Height = &destSurfaceHeight; srcPool = winedesc.pool;
winedesc.Pool = &destPool; srcFormat = winedesc.format;
winedesc.Format = &destFormat;
winedesc.Size = &destSize;
IWineD3DSurface_GetDesc(pDestinationSurface, &winedesc); 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){ 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); WARN("source %p must be SYSTEMMEM and dest %p must be DEFAULT, returning WINED3DERR_INVALIDCALL\n", pSourceSurface, pDestinationSurface);

View File

@ -1087,9 +1087,6 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_InitStartupStateBlock(IWineD3DStat
unsigned int i; unsigned int i;
IWineD3DSwapChain *swapchain; IWineD3DSwapChain *swapchain;
IWineD3DSurface *backbuffer; IWineD3DSurface *backbuffer;
WINED3DSURFACE_DESC desc = {0};
UINT width, height;
RECT scissorrect;
HRESULT hr; HRESULT hr;
/* Note this may have a large overhead but it should only be executed /* 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; 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 */ /* check the return values, because the GetBackBuffer call isn't valid for ddraw */
hr = IWineD3DDevice_GetSwapChain(device, 0, &swapchain); hr = IWineD3DDevice_GetSwapChain(device, 0, &swapchain);
if( hr == WINED3D_OK && swapchain != NULL) { if( hr == WINED3D_OK && swapchain != NULL) {
WINED3DVIEWPORT vp; WINED3DVIEWPORT vp;
hr = IWineD3DSwapChain_GetBackBuffer(swapchain, 0, WINED3DBACKBUFFER_TYPE_MONO, &backbuffer); 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_GetDesc(backbuffer, &desc);
IWineD3DSurface_Release(backbuffer); IWineD3DSurface_Release(backbuffer);
/* Set the default scissor rect values */
scissorrect.left = 0; scissorrect.left = 0;
scissorrect.right = width; scissorrect.right = desc.width;
scissorrect.top = 0; scissorrect.top = 0;
scissorrect.bottom = height; scissorrect.bottom = desc.height;
hr = IWineD3DDevice_SetScissorRect(device, &scissorrect); hr = IWineD3DDevice_SetScissorRect(device, &scissorrect);
if( hr != WINED3D_OK ) { if (FAILED(hr)) ERR("This should never happen, expect rendering issues!\n");
ERR("This should never happen, expect rendering issues!\n");
}
} }
/* Set the default viewport */ /* Set the default viewport */

View File

@ -181,15 +181,17 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetDesc(IWineD3DSurface *iface, WINED3DSU
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface; IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
TRACE("(%p) : copying into %p\n", This, pDesc); 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; pDesc->format = This->resource.format_desc->format;
if(pDesc->Usage != NULL) *(pDesc->Usage) = This->resource.usage; pDesc->resource_type = This->resource.resourceType;
if(pDesc->Pool != NULL) *(pDesc->Pool) = This->resource.pool; pDesc->usage = This->resource.usage;
if(pDesc->Size != NULL) *(pDesc->Size) = This->resource.size; /* dx8 only */ pDesc->pool = This->resource.pool;
if(pDesc->MultiSampleType != NULL) *(pDesc->MultiSampleType) = This->currentDesc.MultiSampleType; pDesc->size = This->resource.size; /* dx8 only */
if(pDesc->MultiSampleQuality != NULL) *(pDesc->MultiSampleQuality) = This->currentDesc.MultiSampleQuality; pDesc->multisample_type = This->currentDesc.MultiSampleType;
if(pDesc->Width != NULL) *(pDesc->Width) = This->currentDesc.Width; pDesc->multisample_quality = This->currentDesc.MultiSampleQuality;
if(pDesc->Height != NULL) *(pDesc->Height) = This->currentDesc.Height; pDesc->width = This->currentDesc.Width;
pDesc->height = This->currentDesc.Height;
return WINED3D_OK; return WINED3D_OK;
} }

View File

@ -1724,15 +1724,15 @@ typedef struct _WINED3DPRESENT_PARAMETERS
typedef struct _WINED3DSURFACE_DESC typedef struct _WINED3DSURFACE_DESC
{ {
WINED3DFORMAT *Format; WINED3DFORMAT format;
WINED3DRESOURCETYPE *Type; WINED3DRESOURCETYPE resource_type;
DWORD *Usage; DWORD usage;
WINED3DPOOL *Pool; WINED3DPOOL pool;
UINT *Size; UINT size;
WINED3DMULTISAMPLE_TYPE *MultiSampleType; WINED3DMULTISAMPLE_TYPE multisample_type;
DWORD *MultiSampleQuality; DWORD multisample_quality;
UINT *Width; UINT width;
UINT *Height; UINT height;
} WINED3DSURFACE_DESC; } WINED3DSURFACE_DESC;
typedef struct _WINED3DVOLUME_DESC typedef struct _WINED3DVOLUME_DESC