From 6dd9109358f259903f935a0335387e2783d92afb Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Mon, 25 Oct 2010 12:33:39 +0200 Subject: [PATCH] wined3d: Pass a sub-resource index instead of a face + miplevel to cube texture methods. --- dlls/d3d8/cubetexture.c | 23 +++++++++++++++------- dlls/d3d9/cubetexture.c | 23 +++++++++++++++------- dlls/wined3d/basetexture.c | 16 ++++++--------- dlls/wined3d/cubetexture.c | 36 ++++++++++++++++------------------ dlls/wined3d/device.c | 29 +++++++++++---------------- dlls/wined3d/texture.c | 23 +++++----------------- dlls/wined3d/volumetexture.c | 23 +++++----------------- dlls/wined3d/wined3d_private.h | 2 +- include/wine/wined3d.idl | 11 ++++------- 9 files changed, 81 insertions(+), 105 deletions(-) diff --git a/dlls/d3d8/cubetexture.c b/dlls/d3d8/cubetexture.c index b8de291c68d..7fa48b76406 100644 --- a/dlls/d3d8/cubetexture.c +++ b/dlls/d3d8/cubetexture.c @@ -258,13 +258,14 @@ static HRESULT WINAPI IDirect3DCubeTexture8Impl_GetCubeMapSurface(IDirect3DCubeT { IDirect3DCubeTexture8Impl *This = (IDirect3DCubeTexture8Impl *)iface; IWineD3DSurface *mySurface = NULL; + UINT sub_resource_idx; HRESULT hr; TRACE("iface %p, face %#x, level %u, surface %p.\n", iface, FaceType, Level, ppCubeMapSurface); wined3d_mutex_lock(); - hr = IWineD3DCubeTexture_GetCubeMapSurface(This->wineD3DCubeTexture, - (WINED3DCUBEMAP_FACES) FaceType, Level, &mySurface); + sub_resource_idx = IWineD3DCubeTexture_GetLevelCount(This->wineD3DCubeTexture) * FaceType + Level; + hr = IWineD3DCubeTexture_GetCubeMapSurface(This->wineD3DCubeTexture, sub_resource_idx, &mySurface); if (SUCCEEDED(hr) && ppCubeMapSurface) { *ppCubeMapSurface = IWineD3DCubeTexture_GetParent(mySurface); @@ -276,29 +277,37 @@ static HRESULT WINAPI IDirect3DCubeTexture8Impl_GetCubeMapSurface(IDirect3DCubeT return hr; } -static HRESULT WINAPI IDirect3DCubeTexture8Impl_LockRect(LPDIRECT3DCUBETEXTURE8 iface, D3DCUBEMAP_FACES FaceType, UINT Level, D3DLOCKED_RECT* pLockedRect, CONST RECT *pRect, DWORD Flags) { +static HRESULT WINAPI IDirect3DCubeTexture8Impl_LockRect(IDirect3DCubeTexture8 *iface, + D3DCUBEMAP_FACES FaceType, UINT Level, D3DLOCKED_RECT *pLockedRect, const RECT *pRect, DWORD Flags) +{ IDirect3DCubeTexture8Impl *This = (IDirect3DCubeTexture8Impl *)iface; + UINT sub_resource_idx; HRESULT hr; TRACE("iface %p, face %#x, level %u, locked_rect %p, rect %p, flags %#x.\n", iface, FaceType, Level, pLockedRect, pRect, Flags); wined3d_mutex_lock(); - hr = IWineD3DCubeTexture_Map(This->wineD3DCubeTexture, (WINED3DCUBEMAP_FACES)FaceType, - Level, (WINED3DLOCKED_RECT *)pLockedRect, pRect, Flags); + sub_resource_idx = IWineD3DCubeTexture_GetLevelCount(This->wineD3DCubeTexture) * FaceType + Level; + hr = IWineD3DCubeTexture_Map(This->wineD3DCubeTexture, sub_resource_idx, + (WINED3DLOCKED_RECT *)pLockedRect, pRect, Flags); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DCubeTexture8Impl_UnlockRect(LPDIRECT3DCUBETEXTURE8 iface, D3DCUBEMAP_FACES FaceType, UINT Level) { +static HRESULT WINAPI IDirect3DCubeTexture8Impl_UnlockRect(IDirect3DCubeTexture8 *iface, + D3DCUBEMAP_FACES FaceType, UINT Level) +{ IDirect3DCubeTexture8Impl *This = (IDirect3DCubeTexture8Impl *)iface; + UINT sub_resource_idx; HRESULT hr; TRACE("iface %p, face %#x, level %u.\n", iface, FaceType, Level); wined3d_mutex_lock(); - hr = IWineD3DCubeTexture_Unmap(This->wineD3DCubeTexture, (WINED3DCUBEMAP_FACES)FaceType, Level); + sub_resource_idx = IWineD3DCubeTexture_GetLevelCount(This->wineD3DCubeTexture) * FaceType + Level; + hr = IWineD3DCubeTexture_Unmap(This->wineD3DCubeTexture, sub_resource_idx); wined3d_mutex_unlock(); return hr; diff --git a/dlls/d3d9/cubetexture.c b/dlls/d3d9/cubetexture.c index 9564aa01535..3efd98d74e3 100644 --- a/dlls/d3d9/cubetexture.c +++ b/dlls/d3d9/cubetexture.c @@ -297,13 +297,14 @@ static HRESULT WINAPI IDirect3DCubeTexture9Impl_GetCubeMapSurface(IDirect3DCubeT { IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; IWineD3DSurface *mySurface = NULL; + UINT sub_resource_idx; HRESULT hr; TRACE("iface %p, face %#x, level %u, surface %p.\n", iface, FaceType, Level, ppCubeMapSurface); wined3d_mutex_lock(); - hr = IWineD3DCubeTexture_GetCubeMapSurface(This->wineD3DCubeTexture, - (WINED3DCUBEMAP_FACES)FaceType, Level, &mySurface); + sub_resource_idx = IWineD3DCubeTexture_GetLevelCount(This->wineD3DCubeTexture) * FaceType + Level; + hr = IWineD3DCubeTexture_GetCubeMapSurface(This->wineD3DCubeTexture, sub_resource_idx, &mySurface); if (SUCCEEDED(hr) && ppCubeMapSurface) { *ppCubeMapSurface = IWineD3DCubeTexture_GetParent(mySurface); @@ -315,29 +316,37 @@ static HRESULT WINAPI IDirect3DCubeTexture9Impl_GetCubeMapSurface(IDirect3DCubeT return hr; } -static HRESULT WINAPI IDirect3DCubeTexture9Impl_LockRect(LPDIRECT3DCUBETEXTURE9 iface, D3DCUBEMAP_FACES FaceType, UINT Level, D3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags) { +static HRESULT WINAPI IDirect3DCubeTexture9Impl_LockRect(IDirect3DCubeTexture9 *iface, + D3DCUBEMAP_FACES FaceType, UINT Level, D3DLOCKED_RECT *pLockedRect, const RECT *pRect, DWORD Flags) +{ IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; + UINT sub_resource_idx; HRESULT hr; TRACE("iface %p, face %#x, level %u, locked_rect %p, rect %p, flags %#x.\n", iface, FaceType, Level, pLockedRect, pRect, Flags); wined3d_mutex_lock(); - hr = IWineD3DCubeTexture_Map(This->wineD3DCubeTexture, (WINED3DCUBEMAP_FACES)FaceType, - Level, (WINED3DLOCKED_RECT *)pLockedRect, pRect, Flags); + sub_resource_idx = IWineD3DCubeTexture_GetLevelCount(This->wineD3DCubeTexture) * FaceType + Level; + hr = IWineD3DCubeTexture_Map(This->wineD3DCubeTexture, sub_resource_idx, + (WINED3DLOCKED_RECT *)pLockedRect, pRect, Flags); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DCubeTexture9Impl_UnlockRect(LPDIRECT3DCUBETEXTURE9 iface, D3DCUBEMAP_FACES FaceType, UINT Level) { +static HRESULT WINAPI IDirect3DCubeTexture9Impl_UnlockRect(IDirect3DCubeTexture9 *iface, + D3DCUBEMAP_FACES FaceType, UINT Level) +{ IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; + UINT sub_resource_idx; HRESULT hr; TRACE("iface %p, face %#x, level %u.\n", iface, FaceType, Level); wined3d_mutex_lock(); - hr = IWineD3DCubeTexture_Unmap(This->wineD3DCubeTexture, (WINED3DCUBEMAP_FACES)FaceType, Level); + sub_resource_idx = IWineD3DCubeTexture_GetLevelCount(This->wineD3DCubeTexture) * FaceType + Level; + hr = IWineD3DCubeTexture_Unmap(This->wineD3DCubeTexture, sub_resource_idx); wined3d_mutex_unlock(); return hr; diff --git a/dlls/wined3d/basetexture.c b/dlls/wined3d/basetexture.c index bf3b4d4ff70..f826f912c0a 100644 --- a/dlls/wined3d/basetexture.c +++ b/dlls/wined3d/basetexture.c @@ -81,21 +81,17 @@ void basetexture_cleanup(IWineD3DBaseTexture *iface) resource_cleanup((IWineD3DResource *)iface); } -IWineD3DResourceImpl *basetexture_get_sub_resource(IWineD3DBaseTextureImpl *texture, UINT layer, UINT level) +IWineD3DResourceImpl *basetexture_get_sub_resource(IWineD3DBaseTextureImpl *texture, UINT sub_resource_idx) { - if (layer >= texture->baseTexture.layer_count) + UINT sub_count = texture->baseTexture.level_count * texture->baseTexture.layer_count; + + if (sub_resource_idx >= sub_count) { - WARN("layer %u >= layer_count %u.\n", layer, texture->baseTexture.layer_count); + WARN("sub_resource_idx %u >= sub_count %u.\n", sub_resource_idx, sub_count); return NULL; } - if (level >= texture->baseTexture.level_count) - { - WARN("level %u >= level_count %u.\n", level, texture->baseTexture.level_count); - return NULL; - } - - return texture->baseTexture.sub_resources[layer * texture->baseTexture.level_count + level]; + return texture->baseTexture.sub_resources[sub_resource_idx]; } /* A GL context is provided by the caller */ diff --git a/dlls/wined3d/cubetexture.c b/dlls/wined3d/cubetexture.c index a3170a195e4..4881ac1d540 100644 --- a/dlls/wined3d/cubetexture.c +++ b/dlls/wined3d/cubetexture.c @@ -313,18 +313,15 @@ static BOOL WINAPI IWineD3DCubeTextureImpl_IsCondNP2(IWineD3DCubeTexture *iface) return FALSE; } -/* ******************************************* - IWineD3DCubeTexture IWineD3DCubeTexture parts follow - ******************************************* */ static HRESULT WINAPI IWineD3DCubeTextureImpl_GetLevelDesc(IWineD3DCubeTexture *iface, - UINT level, WINED3DSURFACE_DESC *desc) + UINT sub_resource_idx, WINED3DSURFACE_DESC *desc) { IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)iface; IWineD3DSurface *surface; - TRACE("iface %p, level %u, desc %p.\n", iface, level, desc); + TRACE("iface %p, sub_resource_idx %u, desc %p.\n", iface, sub_resource_idx, desc); - if (!(surface = (IWineD3DSurface *)basetexture_get_sub_resource(texture, 0, level))) + if (!(surface = (IWineD3DSurface *)basetexture_get_sub_resource(texture, sub_resource_idx))) { WARN("Failed to get sub-resource.\n"); return WINED3DERR_INVALIDCALL; @@ -336,15 +333,15 @@ static HRESULT WINAPI IWineD3DCubeTextureImpl_GetLevelDesc(IWineD3DCubeTexture * } static HRESULT WINAPI IWineD3DCubeTextureImpl_GetCubeMapSurface(IWineD3DCubeTexture *iface, - WINED3DCUBEMAP_FACES face, UINT level, IWineD3DSurface **surface) + UINT sub_resource_idx, IWineD3DSurface **surface) { IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)iface; IWineD3DSurface *s; - TRACE("iface %p, face %u, level %u, surface %p.\n", - iface, face, level, surface); + TRACE("iface %p, sub_resource_idx %u, surface %p.\n", + iface, sub_resource_idx, surface); - if (!(s = (IWineD3DSurface *)basetexture_get_sub_resource(texture, face, level))) + if (!(s = (IWineD3DSurface *)basetexture_get_sub_resource(texture, sub_resource_idx))) { WARN("Failed to get sub-resource.\n"); return WINED3DERR_INVALIDCALL; @@ -359,15 +356,15 @@ static HRESULT WINAPI IWineD3DCubeTextureImpl_GetCubeMapSurface(IWineD3DCubeText } static HRESULT WINAPI IWineD3DCubeTextureImpl_Map(IWineD3DCubeTexture *iface, - WINED3DCUBEMAP_FACES face, UINT level, WINED3DLOCKED_RECT *locked_rect, const RECT *rect, DWORD flags) + UINT sub_resource_idx, WINED3DLOCKED_RECT *locked_rect, const RECT *rect, DWORD flags) { IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)iface; IWineD3DSurface *surface; - TRACE("iface %p, face %u, level %u, locked_rect %p, rect %s, flags %#x.\n", - iface, face, level, locked_rect, wine_dbgstr_rect(rect), flags); + TRACE("iface %p, sub_resource_idx %u, locked_rect %p, rect %s, flags %#x.\n", + iface, sub_resource_idx, locked_rect, wine_dbgstr_rect(rect), flags); - if (!(surface = (IWineD3DSurface *)basetexture_get_sub_resource(texture, face, level))) + if (!(surface = (IWineD3DSurface *)basetexture_get_sub_resource(texture, sub_resource_idx))) { WARN("Failed to get sub-resource.\n"); return WINED3DERR_INVALIDCALL; @@ -377,15 +374,15 @@ static HRESULT WINAPI IWineD3DCubeTextureImpl_Map(IWineD3DCubeTexture *iface, } static HRESULT WINAPI IWineD3DCubeTextureImpl_Unmap(IWineD3DCubeTexture *iface, - WINED3DCUBEMAP_FACES face, UINT level) + UINT sub_resource_idx) { IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)iface; IWineD3DSurface *surface; - TRACE("iface %p, face %u, level %u.\n", - iface, face, level); + TRACE("iface %p, sub_resource_idx %u.\n", + iface, sub_resource_idx); - if (!(surface = (IWineD3DSurface *)basetexture_get_sub_resource(texture, face, level))) + if (!(surface = (IWineD3DSurface *)basetexture_get_sub_resource(texture, sub_resource_idx))) { WARN("Failed to get sub-resource.\n"); return WINED3DERR_INVALIDCALL; @@ -398,12 +395,13 @@ static HRESULT WINAPI IWineD3DCubeTextureImpl_AddDirtyRect(IWineD3DCubeTexture * WINED3DCUBEMAP_FACES face, const RECT *dirty_rect) { IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)iface; + UINT sub_resource_idx = face * texture->baseTexture.level_count; IWineD3DSurfaceImpl *surface; TRACE("iface %p, face %u, dirty_rect %s.\n", iface, face, wine_dbgstr_rect(dirty_rect)); - if (!(surface = (IWineD3DSurfaceImpl *)basetexture_get_sub_resource(texture, face, 0))) + if (!(surface = (IWineD3DSurfaceImpl *)basetexture_get_sub_resource(texture, sub_resource_idx))) { WARN("Failed to get sub-resource.\n"); return WINED3DERR_INVALIDCALL; diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 34a766f77dc..34d53c0441f 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -5007,27 +5007,20 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateTexture(IWineD3DDevice *iface, { IWineD3DSurface *src_surface; IWineD3DSurface *dst_surface; - WINED3DCUBEMAP_FACES face; - for (i = 0; i < level_count; ++i) + for (i = 0; i < level_count * 6; ++i) { - /* Update each cube face. */ - for (face = WINED3DCUBEMAP_FACE_POSITIVE_X; face <= WINED3DCUBEMAP_FACE_NEGATIVE_Z; ++face) + hr = IWineD3DCubeTexture_GetCubeMapSurface((IWineD3DCubeTexture *)src_texture, i, &src_surface); + if (FAILED(hr)) ERR("Failed to get src cube sub-resource %u, hr %#x.\n", i, hr); + hr = IWineD3DCubeTexture_GetCubeMapSurface((IWineD3DCubeTexture *)dst_texture, i, &dst_surface); + if (FAILED(hr)) ERR("Failed to get dst cube sub-resource %u, hr %#x.\n", i, hr); + hr = IWineD3DDevice_UpdateSurface(iface, src_surface, NULL, dst_surface, NULL); + IWineD3DSurface_Release(dst_surface); + IWineD3DSurface_Release(src_surface); + if (FAILED(hr)) { - hr = IWineD3DCubeTexture_GetCubeMapSurface((IWineD3DCubeTexture *)src_texture, - face, i, &src_surface); - if (FAILED(hr)) ERR("Failed to get src cube surface face %u, level %u, hr %#x.\n", face, i, hr); - hr = IWineD3DCubeTexture_GetCubeMapSurface((IWineD3DCubeTexture *)dst_texture, - face, i, &dst_surface); - if (FAILED(hr)) ERR("Failed to get dst cube surface face %u, level %u, hr %#x.\n", face, i, hr); - hr = IWineD3DDevice_UpdateSurface(iface, src_surface, NULL, dst_surface, NULL); - IWineD3DSurface_Release(dst_surface); - IWineD3DSurface_Release(src_surface); - if (FAILED(hr)) - { - WARN("IWineD3DDevice_UpdateSurface failed, hr %#x.\n", hr); - return hr; - } + WARN("IWineD3DDevice_UpdateSurface failed, hr %#x.\n", hr); + return hr; } } break; diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c index f7eaea75630..12c2043d899 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -333,19 +333,6 @@ static BOOL WINAPI IWineD3DTextureImpl_IsCondNP2(IWineD3DTexture *iface) { return This->cond_np2; } -static IWineD3DResourceImpl *texture_get_sub_resource(IWineD3DBaseTextureImpl *texture, UINT sub_resource_idx) -{ - UINT sub_count = texture->baseTexture.level_count * texture->baseTexture.layer_count; - - if (sub_resource_idx >= sub_count) - { - WARN("sub_resource_idx %u >= sub_count %u.\n", sub_resource_idx, sub_count); - return NULL; - } - - return texture->baseTexture.sub_resources[sub_resource_idx]; -} - static HRESULT WINAPI IWineD3DTextureImpl_GetLevelDesc(IWineD3DTexture *iface, UINT sub_resource_idx, WINED3DSURFACE_DESC *desc) { @@ -354,7 +341,7 @@ static HRESULT WINAPI IWineD3DTextureImpl_GetLevelDesc(IWineD3DTexture *iface, TRACE("iface %p, sub_resource_idx %u, desc %p.\n", iface, sub_resource_idx, desc); - if (!(surface = (IWineD3DSurface *)texture_get_sub_resource(texture, sub_resource_idx))) + if (!(surface = (IWineD3DSurface *)basetexture_get_sub_resource(texture, sub_resource_idx))) { WARN("Failed to get sub-resource.\n"); return WINED3DERR_INVALIDCALL; @@ -373,7 +360,7 @@ static HRESULT WINAPI IWineD3DTextureImpl_GetSurfaceLevel(IWineD3DTexture *iface TRACE("iface %p, sub_resource_idx %u, surface %p.\n", iface, sub_resource_idx, surface); - if (!(s = (IWineD3DSurface *)texture_get_sub_resource(texture, sub_resource_idx))) + if (!(s = (IWineD3DSurface *)basetexture_get_sub_resource(texture, sub_resource_idx))) { WARN("Failed to get sub-resource.\n"); return WINED3DERR_INVALIDCALL; @@ -396,7 +383,7 @@ static HRESULT WINAPI IWineD3DTextureImpl_Map(IWineD3DTexture *iface, TRACE("iface %p, sub_resource_idx %u, locked_rect %p, rect %s, flags %#x.\n", iface, sub_resource_idx, locked_rect, wine_dbgstr_rect(rect), flags); - if (!(surface = (IWineD3DSurface *)texture_get_sub_resource(texture, sub_resource_idx))) + if (!(surface = (IWineD3DSurface *)basetexture_get_sub_resource(texture, sub_resource_idx))) { WARN("Failed to get sub-resource.\n"); return WINED3DERR_INVALIDCALL; @@ -412,7 +399,7 @@ static HRESULT WINAPI IWineD3DTextureImpl_Unmap(IWineD3DTexture *iface, UINT sub TRACE("iface %p, sub_resource_idx %u.\n", iface, sub_resource_idx); - if (!(surface = (IWineD3DSurface *)texture_get_sub_resource(texture, sub_resource_idx))) + if (!(surface = (IWineD3DSurface *)basetexture_get_sub_resource(texture, sub_resource_idx))) { WARN("Failed to get sub-resource.\n"); return WINED3DERR_INVALIDCALL; @@ -428,7 +415,7 @@ static HRESULT WINAPI IWineD3DTextureImpl_AddDirtyRect(IWineD3DTexture *iface, c TRACE("iface %p, dirty_rect %s.\n", iface, wine_dbgstr_rect(dirty_rect)); - if (!(surface = (IWineD3DSurfaceImpl *)texture_get_sub_resource(texture, 0))) + if (!(surface = (IWineD3DSurfaceImpl *)basetexture_get_sub_resource(texture, 0))) { WARN("Failed to get sub-resource.\n"); return WINED3DERR_INVALIDCALL; diff --git a/dlls/wined3d/volumetexture.c b/dlls/wined3d/volumetexture.c index 9773c604e56..bfe1fba218b 100644 --- a/dlls/wined3d/volumetexture.c +++ b/dlls/wined3d/volumetexture.c @@ -249,19 +249,6 @@ static BOOL WINAPI IWineD3DVolumeTextureImpl_IsCondNP2(IWineD3DVolumeTexture *if return FALSE; } -static IWineD3DResourceImpl *volumetexture_get_sub_resource(IWineD3DBaseTextureImpl *texture, UINT sub_resource_idx) -{ - UINT sub_count = texture->baseTexture.level_count * texture->baseTexture.layer_count; - - if (sub_resource_idx >= sub_count) - { - WARN("sub_resource_idx %u >= sub_count %u.\n", sub_resource_idx, sub_count); - return NULL; - } - - return texture->baseTexture.sub_resources[sub_resource_idx]; -} - static HRESULT WINAPI IWineD3DVolumeTextureImpl_GetLevelDesc(IWineD3DVolumeTexture *iface, UINT sub_resource_idx, WINED3DVOLUME_DESC *desc) { @@ -270,7 +257,7 @@ static HRESULT WINAPI IWineD3DVolumeTextureImpl_GetLevelDesc(IWineD3DVolumeTextu TRACE("iface %p, sub_resource_idx %u, desc %p.\n", iface, sub_resource_idx, desc); - if (!(volume = (IWineD3DVolume *)volumetexture_get_sub_resource(texture, sub_resource_idx))) + if (!(volume = (IWineD3DVolume *)basetexture_get_sub_resource(texture, sub_resource_idx))) { WARN("Failed to get sub-resource.\n"); return WINED3DERR_INVALIDCALL; @@ -289,7 +276,7 @@ static HRESULT WINAPI IWineD3DVolumeTextureImpl_GetVolumeLevel(IWineD3DVolumeTex TRACE("iface %p, sub_resource_idx %u, volume %p.\n", iface, sub_resource_idx, volume); - if (!(v= (IWineD3DVolume *)volumetexture_get_sub_resource(texture, sub_resource_idx))) + if (!(v= (IWineD3DVolume *)basetexture_get_sub_resource(texture, sub_resource_idx))) { WARN("Failed to get sub-resource.\n"); return WINED3DERR_INVALIDCALL; @@ -312,7 +299,7 @@ static HRESULT WINAPI IWineD3DVolumeTextureImpl_Map(IWineD3DVolumeTexture *iface TRACE("iface %p, sub_resource_idx %u, locked_box %p, box %p, flags %#x.\n", iface, sub_resource_idx, locked_box, box, flags); - if (!(volume = (IWineD3DVolume *)volumetexture_get_sub_resource(texture, sub_resource_idx))) + if (!(volume = (IWineD3DVolume *)basetexture_get_sub_resource(texture, sub_resource_idx))) { WARN("Failed to get sub-resource.\n"); return WINED3DERR_INVALIDCALL; @@ -328,7 +315,7 @@ static HRESULT WINAPI IWineD3DVolumeTextureImpl_Unmap(IWineD3DVolumeTexture *ifa TRACE("iface %p, sub_resource_idx %u.\n", iface, sub_resource_idx); - if (!(volume = (IWineD3DVolume *)volumetexture_get_sub_resource(texture, sub_resource_idx))) + if (!(volume = (IWineD3DVolume *)basetexture_get_sub_resource(texture, sub_resource_idx))) { WARN("Failed to get sub-resource.\n"); return WINED3DERR_INVALIDCALL; @@ -344,7 +331,7 @@ static HRESULT WINAPI IWineD3DVolumeTextureImpl_AddDirtyBox(IWineD3DVolumeTextur TRACE("iface %p, dirty_box %p.\n", iface, dirty_box); - if (!(volume = (IWineD3DVolume *)volumetexture_get_sub_resource(texture, 0))) + if (!(volume = (IWineD3DVolume *)basetexture_get_sub_resource(texture, 0))) { WARN("Failed to get sub-resource.\n"); return WINED3DERR_INVALIDCALL; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index bc77f624bd8..329bee1cb7f 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -1916,7 +1916,7 @@ BOOL basetexture_get_dirty(IWineD3DBaseTexture *iface) DECLSPEC_HIDDEN; DWORD basetexture_get_level_count(IWineD3DBaseTexture *iface) DECLSPEC_HIDDEN; DWORD basetexture_get_lod(IWineD3DBaseTexture *iface) DECLSPEC_HIDDEN; IWineD3DResourceImpl *basetexture_get_sub_resource(IWineD3DBaseTextureImpl *texture, - UINT layer, UINT level) DECLSPEC_HIDDEN; + UINT sub_resource_idx) DECLSPEC_HIDDEN; HRESULT basetexture_init(IWineD3DBaseTextureImpl *texture, UINT layer_count, UINT level_count, WINED3DRESOURCETYPE resource_type, IWineD3DDeviceImpl *device, UINT size, DWORD usage, const struct wined3d_format *format, WINED3DPOOL pool, void *parent, diff --git a/include/wine/wined3d.idl b/include/wine/wined3d.idl index df2cc84e047..63de52848cf 100644 --- a/include/wine/wined3d.idl +++ b/include/wine/wined3d.idl @@ -2573,24 +2573,21 @@ interface IWineD3DTexture : IWineD3DBaseTexture interface IWineD3DCubeTexture : IWineD3DBaseTexture { HRESULT GetLevelDesc( - [in] UINT level, + [in] UINT sub_resource_idx, [out] WINED3DSURFACE_DESC *desc ); HRESULT GetCubeMapSurface( - [in] WINED3DCUBEMAP_FACES face, - [in] UINT level, + [in] UINT sub_resource_idx, [out] IWineD3DSurface **surface ); HRESULT Map( - [in] WINED3DCUBEMAP_FACES face, - [in] UINT level, + [in] UINT sub_resource_idx, [out] WINED3DLOCKED_RECT *locked_rect, [in] const RECT *rect, [in] DWORD flags ); HRESULT Unmap( - [in] WINED3DCUBEMAP_FACES face, - [in] UINT level + [in] UINT sub_resource_idx ); HRESULT AddDirtyRect( [in] WINED3DCUBEMAP_FACES face,