From e409b83bcbad1c44ac20e0b9c585f9b0fae48f24 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Mon, 14 Mar 2011 21:02:58 +0100 Subject: [PATCH] wined3d: Get rid of IWineD3DVolumeTexture::Unmap(). --- dlls/d3d10core/texture.c | 12 +++++++++--- dlls/d3d8/volumetexture.c | 13 +++++++++---- dlls/d3d9/volumetexture.c | 15 +++++++++------ dlls/wined3d/volumetexture.c | 17 ----------------- include/wine/wined3d.idl | 3 --- 5 files changed, 27 insertions(+), 33 deletions(-) diff --git a/dlls/d3d10core/texture.c b/dlls/d3d10core/texture.c index 83796051f75..2f73a753f27 100644 --- a/dlls/d3d10core/texture.c +++ b/dlls/d3d10core/texture.c @@ -375,11 +375,17 @@ static HRESULT STDMETHODCALLTYPE d3d10_texture3d_Map(ID3D10Texture3D *iface, UIN return hr; } -static void STDMETHODCALLTYPE d3d10_texture3d_Unmap(ID3D10Texture3D *iface, UINT sub_resource) +static void STDMETHODCALLTYPE d3d10_texture3d_Unmap(ID3D10Texture3D *iface, UINT sub_resource_idx) { - TRACE("iface %p, sub_resource %u.\n", iface, sub_resource); + struct d3d10_texture3d *texture = (struct d3d10_texture3d *)iface; + struct wined3d_resource *sub_resource; - IWineD3DVolumeTexture_Unmap(((struct d3d10_texture3d *)iface)->wined3d_texture, sub_resource); + TRACE("iface %p, sub_resource_idx %u.\n", iface, sub_resource_idx); + + if (!(sub_resource = IWineD3DVolumeTexture_GetSubResource(texture->wined3d_texture, sub_resource_idx))) + return; + + IWineD3DVolume_Unmap(wined3d_volume_from_resource(sub_resource)); } static void STDMETHODCALLTYPE d3d10_texture3d_GetDesc(ID3D10Texture3D *iface, D3D10_TEXTURE3D_DESC *desc) diff --git a/dlls/d3d8/volumetexture.c b/dlls/d3d8/volumetexture.c index 873822bd937..8c693f00881 100644 --- a/dlls/d3d8/volumetexture.c +++ b/dlls/d3d8/volumetexture.c @@ -298,14 +298,19 @@ static HRESULT WINAPI IDirect3DVolumeTexture8Impl_LockBox(IDirect3DVolumeTexture return hr; } -static HRESULT WINAPI IDirect3DVolumeTexture8Impl_UnlockBox(LPDIRECT3DVOLUMETEXTURE8 iface, UINT Level) { - IDirect3DVolumeTexture8Impl *This = (IDirect3DVolumeTexture8Impl *)iface; +static HRESULT WINAPI IDirect3DVolumeTexture8Impl_UnlockBox(IDirect3DVolumeTexture8 *iface, UINT level) +{ + IDirect3DVolumeTexture8Impl *texture = (IDirect3DVolumeTexture8Impl *)iface; + struct wined3d_resource *sub_resource; HRESULT hr; - TRACE("iface %p, level %u.\n", iface, Level); + TRACE("iface %p, level %u.\n", iface, level); wined3d_mutex_lock(); - hr = IWineD3DVolumeTexture_Unmap(This->wineD3DVolumeTexture, Level); + if (!(sub_resource = IWineD3DVolumeTexture_GetSubResource(texture->wineD3DVolumeTexture, level))) + hr = D3DERR_INVALIDCALL; + else + hr = IDirect3DVolume8_UnlockBox((IDirect3DVolume8 *)wined3d_resource_get_parent(sub_resource)); wined3d_mutex_unlock(); return hr; diff --git a/dlls/d3d9/volumetexture.c b/dlls/d3d9/volumetexture.c index b4b55036496..0a8932c4fed 100644 --- a/dlls/d3d9/volumetexture.c +++ b/dlls/d3d9/volumetexture.c @@ -360,16 +360,19 @@ static HRESULT WINAPI IDirect3DVolumeTexture9Impl_LockBox(IDirect3DVolumeTexture return hr; } -static HRESULT WINAPI IDirect3DVolumeTexture9Impl_UnlockBox(LPDIRECT3DVOLUMETEXTURE9 iface, UINT Level) { - IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; +static HRESULT WINAPI IDirect3DVolumeTexture9Impl_UnlockBox(IDirect3DVolumeTexture9 *iface, UINT level) +{ + IDirect3DVolumeTexture9Impl *texture = (IDirect3DVolumeTexture9Impl *)iface; + struct wined3d_resource *sub_resource; HRESULT hr; - TRACE("iface %p, level %u.\n", iface, Level); + TRACE("iface %p, level %u.\n", iface, level); wined3d_mutex_lock(); - - hr = IWineD3DVolumeTexture_Unmap(This->wineD3DVolumeTexture, Level); - + if (!(sub_resource = IWineD3DVolumeTexture_GetSubResource(texture->wineD3DVolumeTexture, level))) + hr = D3DERR_INVALIDCALL; + else + hr = IDirect3DVolume9_UnlockBox((IDirect3DVolume9 *)wined3d_resource_get_parent(sub_resource)); wined3d_mutex_unlock(); return hr; diff --git a/dlls/wined3d/volumetexture.c b/dlls/wined3d/volumetexture.c index 643141f9e1d..9d942d70e1a 100644 --- a/dlls/wined3d/volumetexture.c +++ b/dlls/wined3d/volumetexture.c @@ -273,22 +273,6 @@ static struct wined3d_resource * WINAPI IWineD3DVolumeTextureImpl_GetSubResource return basetexture_get_sub_resource(texture, sub_resource_idx); } -static HRESULT WINAPI IWineD3DVolumeTextureImpl_Unmap(IWineD3DVolumeTexture *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 IWineD3DVolume_Unmap((IWineD3DVolume *)volume_from_resource(sub_resource)); -} - static HRESULT WINAPI IWineD3DVolumeTextureImpl_AddDirtyBox(IWineD3DVolumeTexture *iface, const WINED3DBOX *dirty_box) { IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)iface; @@ -333,7 +317,6 @@ static const IWineD3DVolumeTextureVtbl IWineD3DVolumeTexture_Vtbl = IWineD3DVolumeTextureImpl_IsCondNP2, IWineD3DVolumeTextureImpl_GetSubResource, /* volume texture */ - IWineD3DVolumeTextureImpl_Unmap, IWineD3DVolumeTextureImpl_AddDirtyBox }; diff --git a/include/wine/wined3d.idl b/include/wine/wined3d.idl index d7c8b9740a3..34449d0e64e 100644 --- a/include/wine/wined3d.idl +++ b/include/wine/wined3d.idl @@ -2395,9 +2395,6 @@ interface IWineD3DCubeTexture : IWineD3DBaseTexture ] interface IWineD3DVolumeTexture : IWineD3DBaseTexture { - HRESULT Unmap( - [in] UINT sub_resource_idx - ); HRESULT AddDirtyBox( [in] const WINED3DBOX *dirty_box );