diff --git a/dlls/d3d8/cubetexture.c b/dlls/d3d8/cubetexture.c index 891042edea4..1ecf47c8b0a 100644 --- a/dlls/d3d8/cubetexture.c +++ b/dlls/d3d8/cubetexture.c @@ -330,17 +330,21 @@ static HRESULT WINAPI IDirect3DCubeTexture8Impl_LockRect(IDirect3DCubeTexture8 * } static HRESULT WINAPI IDirect3DCubeTexture8Impl_UnlockRect(IDirect3DCubeTexture8 *iface, - D3DCUBEMAP_FACES FaceType, UINT Level) + D3DCUBEMAP_FACES face, UINT level) { - IDirect3DCubeTexture8Impl *This = impl_from_IDirect3DCubeTexture8(iface); + IDirect3DCubeTexture8Impl *texture = impl_from_IDirect3DCubeTexture8(iface); + struct wined3d_resource *sub_resource; UINT sub_resource_idx; HRESULT hr; - TRACE("iface %p, face %#x, level %u.\n", iface, FaceType, Level); + TRACE("iface %p, face %#x, level %u.\n", iface, face, level); wined3d_mutex_lock(); - sub_resource_idx = IWineD3DCubeTexture_GetLevelCount(This->wineD3DCubeTexture) * FaceType + Level; - hr = IWineD3DCubeTexture_Unmap(This->wineD3DCubeTexture, sub_resource_idx); + sub_resource_idx = IWineD3DCubeTexture_GetLevelCount(texture->wineD3DCubeTexture) * face + level; + if (!(sub_resource = IWineD3DCubeTexture_GetSubResource(texture->wineD3DCubeTexture, sub_resource_idx))) + hr = D3DERR_INVALIDCALL; + else + hr = IDirect3DSurface8_UnlockRect((IDirect3DSurface8 *)wined3d_resource_get_parent(sub_resource)); wined3d_mutex_unlock(); return hr; diff --git a/dlls/d3d9/cubetexture.c b/dlls/d3d9/cubetexture.c index 87d00c191ce..798ffc9ced4 100644 --- a/dlls/d3d9/cubetexture.c +++ b/dlls/d3d9/cubetexture.c @@ -345,17 +345,21 @@ static HRESULT WINAPI IDirect3DCubeTexture9Impl_LockRect(IDirect3DCubeTexture9 * } static HRESULT WINAPI IDirect3DCubeTexture9Impl_UnlockRect(IDirect3DCubeTexture9 *iface, - D3DCUBEMAP_FACES FaceType, UINT Level) + D3DCUBEMAP_FACES face, UINT level) { - IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; + IDirect3DCubeTexture9Impl *texture = (IDirect3DCubeTexture9Impl *)iface; + struct wined3d_resource *sub_resource; UINT sub_resource_idx; HRESULT hr; - TRACE("iface %p, face %#x, level %u.\n", iface, FaceType, Level); + TRACE("iface %p, face %#x, level %u.\n", iface, face, level); wined3d_mutex_lock(); - sub_resource_idx = IWineD3DCubeTexture_GetLevelCount(This->wineD3DCubeTexture) * FaceType + Level; - hr = IWineD3DCubeTexture_Unmap(This->wineD3DCubeTexture, sub_resource_idx); + sub_resource_idx = IWineD3DCubeTexture_GetLevelCount(texture->wineD3DCubeTexture) * face + level; + if (!(sub_resource = IWineD3DCubeTexture_GetSubResource(texture->wineD3DCubeTexture, sub_resource_idx))) + hr = D3DERR_INVALIDCALL; + else + hr = IDirect3DSurface9_UnlockRect((IDirect3DSurface9 *)wined3d_resource_get_parent(sub_resource)); wined3d_mutex_unlock(); return hr; diff --git a/dlls/wined3d/cubetexture.c b/dlls/wined3d/cubetexture.c index b5294ddd0d2..db5cbd3a2f8 100644 --- a/dlls/wined3d/cubetexture.c +++ b/dlls/wined3d/cubetexture.c @@ -336,24 +336,6 @@ static struct wined3d_resource * WINAPI IWineD3DCubeTextureImpl_GetSubResource(I return basetexture_get_sub_resource(texture, sub_resource_idx); } -static HRESULT WINAPI IWineD3DCubeTextureImpl_Unmap(IWineD3DCubeTexture *iface, - UINT sub_resource_idx) -{ - IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)iface; - struct wined3d_resource *sub_resource; - - TRACE("iface %p, sub_resource_idx %u.\n", - iface, sub_resource_idx); - - if (!(sub_resource = basetexture_get_sub_resource(texture, sub_resource_idx))) - { - WARN("Failed to get sub-resource.\n"); - return WINED3DERR_INVALIDCALL; - } - - return IWineD3DSurface_Unmap((IWineD3DSurface *)surface_from_resource(sub_resource)); -} - static HRESULT WINAPI IWineD3DCubeTextureImpl_AddDirtyRect(IWineD3DCubeTexture *iface, WINED3DCUBEMAP_FACES face, const RECT *dirty_rect) { @@ -401,7 +383,6 @@ static const IWineD3DCubeTextureVtbl IWineD3DCubeTexture_Vtbl = IWineD3DCubeTextureImpl_IsCondNP2, IWineD3DCubeTextureImpl_GetSubResource, /* IWineD3DCubeTexture */ - IWineD3DCubeTextureImpl_Unmap, IWineD3DCubeTextureImpl_AddDirtyRect }; diff --git a/include/wine/wined3d.idl b/include/wine/wined3d.idl index 83e0479651d..78270806329 100644 --- a/include/wine/wined3d.idl +++ b/include/wine/wined3d.idl @@ -2382,9 +2382,6 @@ interface IWineD3DTexture : IWineD3DBaseTexture ] interface IWineD3DCubeTexture : IWineD3DBaseTexture { - HRESULT Unmap( - [in] UINT sub_resource_idx - ); HRESULT AddDirtyRect( [in] WINED3DCUBEMAP_FACES face, [in] const RECT *dirty_rect