wined3d: Get rid of IWineD3DVolumeTexture::Map().

This commit is contained in:
Henri Verbeet 2011-03-14 21:02:57 +01:00 committed by Alexandre Julliard
parent 2ce5be2ce3
commit 4c3d55f10e
7 changed files with 42 additions and 49 deletions

View File

@ -346,32 +346,32 @@ static UINT STDMETHODCALLTYPE d3d10_texture3d_GetEvictionPriority(ID3D10Texture3
return 0;
}
static HRESULT STDMETHODCALLTYPE d3d10_texture3d_Map(ID3D10Texture3D *iface, UINT sub_resource,
static HRESULT STDMETHODCALLTYPE d3d10_texture3d_Map(ID3D10Texture3D *iface, UINT sub_resource_idx,
D3D10_MAP map_type, UINT map_flags, D3D10_MAPPED_TEXTURE3D *mapped_texture)
{
struct d3d10_texture3d *texture = (struct d3d10_texture3d *)iface;
struct wined3d_resource *sub_resource;
WINED3DLOCKED_BOX wined3d_map_desc;
HRESULT hr;
TRACE("iface %p, sub_resource %u, map_type %u, map_flags %#x, mapped_texture %p.\n",
iface, sub_resource, map_type, map_flags, mapped_texture);
TRACE("iface %p, sub_resource_idx %u, map_type %u, map_flags %#x, mapped_texture %p.\n",
iface, sub_resource_idx, map_type, map_flags, mapped_texture);
if (map_type != D3D10_MAP_READ_WRITE)
FIXME("Ignoring map_type %#x.\n", map_type);
if (map_flags)
FIXME("Ignoring map_flags %#x.\n", map_flags);
hr = IWineD3DVolumeTexture_Map(texture->wined3d_texture, sub_resource, &wined3d_map_desc, NULL, 0);
if (FAILED(hr))
if (!(sub_resource = IWineD3DVolumeTexture_GetSubResource(texture->wined3d_texture, sub_resource_idx)))
hr = E_INVALIDARG;
else if (SUCCEEDED(hr = IWineD3DVolume_Map(wined3d_volume_from_resource(sub_resource),
&wined3d_map_desc, NULL, 0)))
{
WARN("Failed to map texture, hr %#x.\n", hr);
return hr;
mapped_texture->pData = wined3d_map_desc.pBits;
mapped_texture->RowPitch = wined3d_map_desc.RowPitch;
mapped_texture->DepthPitch = wined3d_map_desc.SlicePitch;
}
mapped_texture->pData = wined3d_map_desc.pBits;
mapped_texture->RowPitch = wined3d_map_desc.RowPitch;
mapped_texture->DepthPitch = wined3d_map_desc.SlicePitch;
return hr;
}

View File

@ -277,16 +277,22 @@ static HRESULT WINAPI IDirect3DVolumeTexture8Impl_GetVolumeLevel(IDirect3DVolume
return D3D_OK;
}
static HRESULT WINAPI IDirect3DVolumeTexture8Impl_LockBox(LPDIRECT3DVOLUMETEXTURE8 iface, UINT Level, D3DLOCKED_BOX *pLockedVolume, CONST D3DBOX *pBox, DWORD Flags) {
IDirect3DVolumeTexture8Impl *This = (IDirect3DVolumeTexture8Impl *)iface;
static HRESULT WINAPI IDirect3DVolumeTexture8Impl_LockBox(IDirect3DVolumeTexture8 *iface,
UINT level, D3DLOCKED_BOX *locked_box, const D3DBOX *box, DWORD flags)
{
IDirect3DVolumeTexture8Impl *texture = (IDirect3DVolumeTexture8Impl *)iface;
struct wined3d_resource *sub_resource;
HRESULT hr;
TRACE("iface %p, level %u, locked_box %p, box %p, flags %#x.\n",
iface, Level, pLockedVolume, pBox, Flags);
iface, level, locked_box, box, flags);
wined3d_mutex_lock();
hr = IWineD3DVolumeTexture_Map(This->wineD3DVolumeTexture, Level,
(WINED3DLOCKED_BOX *)pLockedVolume, (const WINED3DBOX *)pBox, Flags);
if (!(sub_resource = IWineD3DVolumeTexture_GetSubResource(texture->wineD3DVolumeTexture, level)))
hr = D3DERR_INVALIDCALL;
else
hr = IDirect3DVolume8_LockBox((IDirect3DVolume8 *)wined3d_resource_get_parent(sub_resource),
locked_box, box, flags);
wined3d_mutex_unlock();
return hr;

View File

@ -339,18 +339,22 @@ static HRESULT WINAPI IDirect3DVolumeTexture9Impl_GetVolumeLevel(IDirect3DVolume
return D3D_OK;
}
static HRESULT WINAPI IDirect3DVolumeTexture9Impl_LockBox(LPDIRECT3DVOLUMETEXTURE9 iface, UINT Level, D3DLOCKED_BOX* pLockedVolume, CONST D3DBOX* pBox, DWORD Flags) {
IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface;
static HRESULT WINAPI IDirect3DVolumeTexture9Impl_LockBox(IDirect3DVolumeTexture9 *iface,
UINT level, D3DLOCKED_BOX *locked_box, const D3DBOX *box, DWORD flags)
{
IDirect3DVolumeTexture9Impl *texture = (IDirect3DVolumeTexture9Impl *)iface;
struct wined3d_resource *sub_resource;
HRESULT hr;
TRACE("iface %p, level %u, locked_box %p, box %p, flags %#x.\n",
iface, Level, pLockedVolume, pBox, Flags);
iface, level, locked_box, box, flags);
wined3d_mutex_lock();
hr = IWineD3DVolumeTexture_Map(This->wineD3DVolumeTexture, Level,
(WINED3DLOCKED_BOX *)pLockedVolume, (const WINED3DBOX *)pBox, Flags);
if (!(sub_resource = IWineD3DVolumeTexture_GetSubResource(texture->wineD3DVolumeTexture, level)))
hr = D3DERR_INVALIDCALL;
else
hr = IDirect3DVolume9_LockBox((IDirect3DVolume9 *)wined3d_resource_get_parent(sub_resource),
locked_box, box, flags);
wined3d_mutex_unlock();
return hr;

View File

@ -277,6 +277,11 @@ static HRESULT WINAPI IWineD3DVolumeImpl_Map(IWineD3DVolume *iface,
return WINED3D_OK;
}
IWineD3DVolume * CDECL wined3d_volume_from_resource(struct wined3d_resource *resource)
{
return (IWineD3DVolume *)volume_from_resource(resource);
}
static HRESULT WINAPI IWineD3DVolumeImpl_Unmap(IWineD3DVolume *iface)
{
IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface;

View File

@ -273,25 +273,6 @@ static struct wined3d_resource * WINAPI IWineD3DVolumeTextureImpl_GetSubResource
return basetexture_get_sub_resource(texture, sub_resource_idx);
}
static HRESULT WINAPI IWineD3DVolumeTextureImpl_Map(IWineD3DVolumeTexture *iface,
UINT sub_resource_idx, WINED3DLOCKED_BOX *locked_box, const WINED3DBOX *box, DWORD flags)
{
IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)iface;
struct wined3d_resource *sub_resource;
TRACE("iface %p, sub_resource_idx %u, locked_box %p, box %p, flags %#x.\n",
iface, sub_resource_idx, locked_box, box, flags);
if (!(sub_resource = basetexture_get_sub_resource(texture, sub_resource_idx)))
{
WARN("Failed to get sub-resource.\n");
return WINED3DERR_INVALIDCALL;
}
return IWineD3DVolume_Map((IWineD3DVolume *)volume_from_resource(sub_resource),
locked_box, box, flags);
}
static HRESULT WINAPI IWineD3DVolumeTextureImpl_Unmap(IWineD3DVolumeTexture *iface, UINT sub_resource_idx)
{
IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)iface;
@ -352,7 +333,6 @@ static const IWineD3DVolumeTextureVtbl IWineD3DVolumeTexture_Vtbl =
IWineD3DVolumeTextureImpl_IsCondNP2,
IWineD3DVolumeTextureImpl_GetSubResource,
/* volume texture */
IWineD3DVolumeTextureImpl_Map,
IWineD3DVolumeTextureImpl_Unmap,
IWineD3DVolumeTextureImpl_AddDirtyBox
};

View File

@ -69,3 +69,5 @@
@ cdecl wined3d_vertex_declaration_decref(ptr)
@ cdecl wined3d_vertex_declaration_get_parent(ptr)
@ cdecl wined3d_vertex_declaration_incref(ptr)
@ cdecl wined3d_volume_from_resource(ptr)

View File

@ -2395,12 +2395,6 @@ interface IWineD3DCubeTexture : IWineD3DBaseTexture
]
interface IWineD3DVolumeTexture : IWineD3DBaseTexture
{
HRESULT Map(
[in] UINT sub_resource_idx,
[out] WINED3DLOCKED_BOX *locked_box,
[in] const WINED3DBOX *box,
[in] DWORD flags
);
HRESULT Unmap(
[in] UINT sub_resource_idx
);
@ -3200,3 +3194,5 @@ ULONG __cdecl wined3d_stateblock_incref(struct wined3d_stateblock *stateblock);
ULONG __cdecl wined3d_vertex_declaration_decref(struct wined3d_vertex_declaration *declaration);
void * __cdecl wined3d_vertex_declaration_get_parent(const struct wined3d_vertex_declaration *declaration);
ULONG __cdecl wined3d_vertex_declaration_incref(struct wined3d_vertex_declaration *declaration);
IWineD3DVolume * __cdecl wined3d_volume_from_resource(struct wined3d_resource *resource);