Commit 53183b4c authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: IWineD3DSurface_GetDesc() should never fail.

parent f49028d9
......@@ -190,27 +190,23 @@ static HRESULT WINAPI IDirect3DSurface8Impl_GetContainer(LPDIRECT3DSURFACE8 ifac
static HRESULT WINAPI IDirect3DSurface8Impl_GetDesc(LPDIRECT3DSURFACE8 iface, D3DSURFACE_DESC *pDesc) {
IDirect3DSurface8Impl *This = (IDirect3DSurface8Impl *)iface;
WINED3DSURFACE_DESC wined3ddesc;
HRESULT hr;
TRACE("iface %p, desc %p.\n", iface, pDesc);
wined3d_mutex_lock();
hr = IWineD3DSurface_GetDesc(This->wineD3DSurface, &wined3ddesc);
IWineD3DSurface_GetDesc(This->wineD3DSurface, &wined3ddesc);
wined3d_mutex_unlock();
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;
}
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 D3D_OK;
}
static HRESULT WINAPI IDirect3DSurface8Impl_LockRect(LPDIRECT3DSURFACE8 iface, D3DLOCKED_RECT *pLockedRect, CONST RECT *pRect, DWORD Flags) {
......
......@@ -246,27 +246,23 @@ static HRESULT WINAPI IDirect3DSurface9Impl_GetContainer(LPDIRECT3DSURFACE9 ifac
static HRESULT WINAPI IDirect3DSurface9Impl_GetDesc(LPDIRECT3DSURFACE9 iface, D3DSURFACE_DESC* pDesc) {
IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
WINED3DSURFACE_DESC wined3ddesc;
HRESULT hr;
TRACE("iface %p, desc %p.\n", iface, pDesc);
wined3d_mutex_lock();
hr = IWineD3DSurface_GetDesc(This->wineD3DSurface, &wined3ddesc);
IWineD3DSurface_GetDesc(This->wineD3DSurface, &wined3ddesc);
wined3d_mutex_unlock();
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;
}
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 D3D_OK;
}
static HRESULT WINAPI IDirect3DSurface9Impl_LockRect(LPDIRECT3DSURFACE9 iface, D3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags) {
......
......@@ -2389,8 +2389,7 @@ HRESULT WINAPI ddraw_recreate_surfaces_cb(IDirectDrawSurface7 *surf, DDSURFACEDE
IWineD3DSurface_GetClipper(wineD3DSurface, &clipper);
/* Get the surface properties */
hr = IWineD3DSurface_GetDesc(wineD3DSurface, &Desc);
if(hr != D3D_OK) return hr;
IWineD3DSurface_GetDesc(wineD3DSurface, &Desc);
Format = Desc.format;
Usage = Desc.usage;
......
......@@ -3588,13 +3588,7 @@ HRESULT ddraw_surface_init(IDirectDrawSurfaceImpl *surface, IDirectDrawImpl *ddr
}
surface->surface_desc.dwFlags |= DDSD_PIXELFORMAT;
hr = IWineD3DSurface_GetDesc(surface->WineD3DSurface, &wined3d_desc);
if (FAILED(hr))
{
ERR("Failed to get wined3d surface desc, hr %#x.\n", hr);
IWineD3DSurface_Release(surface->WineD3DSurface);
return hr;
}
IWineD3DSurface_GetDesc(surface->WineD3DSurface, &wined3d_desc);
format = wined3d_desc.format;
if (format == WINED3DFMT_UNKNOWN)
......
......@@ -337,7 +337,9 @@ static HRESULT WINAPI IWineD3DCubeTextureImpl_GetLevelDesc(IWineD3DCubeTexture *
return WINED3DERR_INVALIDCALL;
}
return IWineD3DSurface_GetDesc(surface, desc);
IWineD3DSurface_GetDesc(surface, desc);
return WINED3D_OK;
}
static HRESULT WINAPI IWineD3DCubeTextureImpl_GetCubeMapSurface(IWineD3DCubeTexture *iface,
......
......@@ -146,7 +146,7 @@ void * WINAPI IWineD3DBaseSurfaceImpl_GetParent(IWineD3DSurface *iface)
return ((IWineD3DSurfaceImpl *)iface)->resource.parent;
}
HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetDesc(IWineD3DSurface *iface, WINED3DSURFACE_DESC *desc)
void WINAPI IWineD3DBaseSurfaceImpl_GetDesc(IWineD3DSurface *iface, WINED3DSURFACE_DESC *desc)
{
IWineD3DSurfaceImpl *surface = (IWineD3DSurfaceImpl *)iface;
......@@ -161,8 +161,6 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetDesc(IWineD3DSurface *iface, WINED3DSU
desc->multisample_quality = surface->currentDesc.MultiSampleQuality;
desc->width = surface->currentDesc.Width;
desc->height = surface->currentDesc.Height;
return WINED3D_OK;
}
HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetBltStatus(IWineD3DSurface *iface, DWORD Flags)
......
......@@ -353,7 +353,9 @@ static HRESULT WINAPI IWineD3DTextureImpl_GetLevelDesc(IWineD3DTexture *iface, U
return WINED3DERR_INVALIDCALL;
}
return IWineD3DSurface_GetDesc(surface, desc);
IWineD3DSurface_GetDesc(surface, desc);
return WINED3D_OK;
}
static HRESULT WINAPI IWineD3DTextureImpl_GetSurfaceLevel(IWineD3DTexture *iface,
......
......@@ -2151,7 +2151,7 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_FreePrivateData(IWineD3DSurface *iface, R
DWORD WINAPI IWineD3DBaseSurfaceImpl_SetPriority(IWineD3DSurface *iface, DWORD PriorityNew) DECLSPEC_HIDDEN;
DWORD WINAPI IWineD3DBaseSurfaceImpl_GetPriority(IWineD3DSurface *iface) DECLSPEC_HIDDEN;
WINED3DRESOURCETYPE WINAPI IWineD3DBaseSurfaceImpl_GetType(IWineD3DSurface *iface) DECLSPEC_HIDDEN;
HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetDesc(IWineD3DSurface *iface, WINED3DSURFACE_DESC *desc) DECLSPEC_HIDDEN;
void WINAPI IWineD3DBaseSurfaceImpl_GetDesc(IWineD3DSurface *iface, WINED3DSURFACE_DESC *desc) DECLSPEC_HIDDEN;
HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetBltStatus(IWineD3DSurface *iface, DWORD Flags) DECLSPEC_HIDDEN;
HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetFlipStatus(IWineD3DSurface *iface, DWORD Flags) DECLSPEC_HIDDEN;
HRESULT WINAPI IWineD3DBaseSurfaceImpl_IsLost(IWineD3DSurface *iface) DECLSPEC_HIDDEN;
......
......@@ -2373,7 +2373,7 @@ interface IWineD3DClipper : IUnknown
]
interface IWineD3DSurface : IWineD3DResource
{
HRESULT GetDesc(
void GetDesc(
[out] WINED3DSURFACE_DESC *desc
);
HRESULT LockRect(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment