d3d8: Use wined3d_texture_get_sub_resource_desc() in d3d8_texture_cube_GetLevelDesc().

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2016-02-29 18:19:27 +01:00 committed by Alexandre Julliard
parent 704a11e6d6
commit 9136f9f9c4
1 changed files with 4 additions and 9 deletions

View File

@ -589,8 +589,8 @@ static DWORD WINAPI d3d8_texture_cube_GetLevelCount(IDirect3DCubeTexture8 *iface
static HRESULT WINAPI d3d8_texture_cube_GetLevelDesc(IDirect3DCubeTexture8 *iface, UINT level, D3DSURFACE_DESC *desc) static HRESULT WINAPI d3d8_texture_cube_GetLevelDesc(IDirect3DCubeTexture8 *iface, UINT level, D3DSURFACE_DESC *desc)
{ {
struct d3d8_texture *texture = impl_from_IDirect3DCubeTexture8(iface); struct d3d8_texture *texture = impl_from_IDirect3DCubeTexture8(iface);
struct wined3d_resource *sub_resource; struct wined3d_sub_resource_desc wined3d_desc;
HRESULT hr = D3D_OK; HRESULT hr;
TRACE("iface %p, level %u, desc %p.\n", iface, level, desc); TRACE("iface %p, level %u, desc %p.\n", iface, level, desc);
@ -601,15 +601,10 @@ static HRESULT WINAPI d3d8_texture_cube_GetLevelDesc(IDirect3DCubeTexture8 *ifac
return D3DERR_INVALIDCALL; return D3DERR_INVALIDCALL;
} }
if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, level))) if (SUCCEEDED(hr = wined3d_texture_get_sub_resource_desc(texture->wined3d_texture, level, &wined3d_desc)))
hr = D3DERR_INVALIDCALL;
else
{ {
struct wined3d_resource_desc wined3d_desc;
wined3d_resource_get_desc(sub_resource, &wined3d_desc);
desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format); desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format);
desc->Type = wined3d_desc.resource_type; desc->Type = D3DRTYPE_SURFACE;
desc->Usage = wined3d_desc.usage & WINED3DUSAGE_MASK; desc->Usage = wined3d_desc.usage & WINED3DUSAGE_MASK;
desc->Pool = wined3d_desc.pool; desc->Pool = wined3d_desc.pool;
desc->Size = wined3d_desc.size; desc->Size = wined3d_desc.size;