Commit 4c3d55f1 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

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

parent 2ce5be2c
...@@ -346,31 +346,31 @@ static UINT STDMETHODCALLTYPE d3d10_texture3d_GetEvictionPriority(ID3D10Texture3 ...@@ -346,31 +346,31 @@ static UINT STDMETHODCALLTYPE d3d10_texture3d_GetEvictionPriority(ID3D10Texture3
return 0; 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) D3D10_MAP map_type, UINT map_flags, D3D10_MAPPED_TEXTURE3D *mapped_texture)
{ {
struct d3d10_texture3d *texture = (struct d3d10_texture3d *)iface; struct d3d10_texture3d *texture = (struct d3d10_texture3d *)iface;
struct wined3d_resource *sub_resource;
WINED3DLOCKED_BOX wined3d_map_desc; WINED3DLOCKED_BOX wined3d_map_desc;
HRESULT hr; HRESULT hr;
TRACE("iface %p, sub_resource %u, map_type %u, map_flags %#x, mapped_texture %p.\n", TRACE("iface %p, sub_resource_idx %u, map_type %u, map_flags %#x, mapped_texture %p.\n",
iface, sub_resource, map_type, map_flags, mapped_texture); iface, sub_resource_idx, map_type, map_flags, mapped_texture);
if (map_type != D3D10_MAP_READ_WRITE) if (map_type != D3D10_MAP_READ_WRITE)
FIXME("Ignoring map_type %#x.\n", map_type); FIXME("Ignoring map_type %#x.\n", map_type);
if (map_flags) if (map_flags)
FIXME("Ignoring map_flags %#x.\n", map_flags); FIXME("Ignoring map_flags %#x.\n", map_flags);
hr = IWineD3DVolumeTexture_Map(texture->wined3d_texture, sub_resource, &wined3d_map_desc, NULL, 0); if (!(sub_resource = IWineD3DVolumeTexture_GetSubResource(texture->wined3d_texture, sub_resource_idx)))
if (FAILED(hr)) 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->pData = wined3d_map_desc.pBits;
mapped_texture->RowPitch = wined3d_map_desc.RowPitch; mapped_texture->RowPitch = wined3d_map_desc.RowPitch;
mapped_texture->DepthPitch = wined3d_map_desc.SlicePitch; mapped_texture->DepthPitch = wined3d_map_desc.SlicePitch;
}
return hr; return hr;
} }
......
...@@ -277,16 +277,22 @@ static HRESULT WINAPI IDirect3DVolumeTexture8Impl_GetVolumeLevel(IDirect3DVolume ...@@ -277,16 +277,22 @@ static HRESULT WINAPI IDirect3DVolumeTexture8Impl_GetVolumeLevel(IDirect3DVolume
return D3D_OK; return D3D_OK;
} }
static HRESULT WINAPI IDirect3DVolumeTexture8Impl_LockBox(LPDIRECT3DVOLUMETEXTURE8 iface, UINT Level, D3DLOCKED_BOX *pLockedVolume, CONST D3DBOX *pBox, DWORD Flags) { static HRESULT WINAPI IDirect3DVolumeTexture8Impl_LockBox(IDirect3DVolumeTexture8 *iface,
IDirect3DVolumeTexture8Impl *This = (IDirect3DVolumeTexture8Impl *)iface; UINT level, D3DLOCKED_BOX *locked_box, const D3DBOX *box, DWORD flags)
{
IDirect3DVolumeTexture8Impl *texture = (IDirect3DVolumeTexture8Impl *)iface;
struct wined3d_resource *sub_resource;
HRESULT hr; HRESULT hr;
TRACE("iface %p, level %u, locked_box %p, box %p, flags %#x.\n", 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(); wined3d_mutex_lock();
hr = IWineD3DVolumeTexture_Map(This->wineD3DVolumeTexture, Level, if (!(sub_resource = IWineD3DVolumeTexture_GetSubResource(texture->wineD3DVolumeTexture, level)))
(WINED3DLOCKED_BOX *)pLockedVolume, (const WINED3DBOX *)pBox, Flags); hr = D3DERR_INVALIDCALL;
else
hr = IDirect3DVolume8_LockBox((IDirect3DVolume8 *)wined3d_resource_get_parent(sub_resource),
locked_box, box, flags);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return hr; return hr;
......
...@@ -339,18 +339,22 @@ static HRESULT WINAPI IDirect3DVolumeTexture9Impl_GetVolumeLevel(IDirect3DVolume ...@@ -339,18 +339,22 @@ static HRESULT WINAPI IDirect3DVolumeTexture9Impl_GetVolumeLevel(IDirect3DVolume
return D3D_OK; return D3D_OK;
} }
static HRESULT WINAPI IDirect3DVolumeTexture9Impl_LockBox(LPDIRECT3DVOLUMETEXTURE9 iface, UINT Level, D3DLOCKED_BOX* pLockedVolume, CONST D3DBOX* pBox, DWORD Flags) { static HRESULT WINAPI IDirect3DVolumeTexture9Impl_LockBox(IDirect3DVolumeTexture9 *iface,
IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; UINT level, D3DLOCKED_BOX *locked_box, const D3DBOX *box, DWORD flags)
{
IDirect3DVolumeTexture9Impl *texture = (IDirect3DVolumeTexture9Impl *)iface;
struct wined3d_resource *sub_resource;
HRESULT hr; HRESULT hr;
TRACE("iface %p, level %u, locked_box %p, box %p, flags %#x.\n", 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(); wined3d_mutex_lock();
if (!(sub_resource = IWineD3DVolumeTexture_GetSubResource(texture->wineD3DVolumeTexture, level)))
hr = IWineD3DVolumeTexture_Map(This->wineD3DVolumeTexture, Level, hr = D3DERR_INVALIDCALL;
(WINED3DLOCKED_BOX *)pLockedVolume, (const WINED3DBOX *)pBox, Flags); else
hr = IDirect3DVolume9_LockBox((IDirect3DVolume9 *)wined3d_resource_get_parent(sub_resource),
locked_box, box, flags);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return hr; return hr;
......
...@@ -277,6 +277,11 @@ static HRESULT WINAPI IWineD3DVolumeImpl_Map(IWineD3DVolume *iface, ...@@ -277,6 +277,11 @@ static HRESULT WINAPI IWineD3DVolumeImpl_Map(IWineD3DVolume *iface,
return WINED3D_OK; 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) static HRESULT WINAPI IWineD3DVolumeImpl_Unmap(IWineD3DVolume *iface)
{ {
IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface; IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface;
......
...@@ -273,25 +273,6 @@ static struct wined3d_resource * WINAPI IWineD3DVolumeTextureImpl_GetSubResource ...@@ -273,25 +273,6 @@ static struct wined3d_resource * WINAPI IWineD3DVolumeTextureImpl_GetSubResource
return basetexture_get_sub_resource(texture, sub_resource_idx); 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) static HRESULT WINAPI IWineD3DVolumeTextureImpl_Unmap(IWineD3DVolumeTexture *iface, UINT sub_resource_idx)
{ {
IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)iface; IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)iface;
...@@ -352,7 +333,6 @@ static const IWineD3DVolumeTextureVtbl IWineD3DVolumeTexture_Vtbl = ...@@ -352,7 +333,6 @@ static const IWineD3DVolumeTextureVtbl IWineD3DVolumeTexture_Vtbl =
IWineD3DVolumeTextureImpl_IsCondNP2, IWineD3DVolumeTextureImpl_IsCondNP2,
IWineD3DVolumeTextureImpl_GetSubResource, IWineD3DVolumeTextureImpl_GetSubResource,
/* volume texture */ /* volume texture */
IWineD3DVolumeTextureImpl_Map,
IWineD3DVolumeTextureImpl_Unmap, IWineD3DVolumeTextureImpl_Unmap,
IWineD3DVolumeTextureImpl_AddDirtyBox IWineD3DVolumeTextureImpl_AddDirtyBox
}; };
......
...@@ -69,3 +69,5 @@ ...@@ -69,3 +69,5 @@
@ cdecl wined3d_vertex_declaration_decref(ptr) @ cdecl wined3d_vertex_declaration_decref(ptr)
@ cdecl wined3d_vertex_declaration_get_parent(ptr) @ cdecl wined3d_vertex_declaration_get_parent(ptr)
@ cdecl wined3d_vertex_declaration_incref(ptr) @ cdecl wined3d_vertex_declaration_incref(ptr)
@ cdecl wined3d_volume_from_resource(ptr)
...@@ -2395,12 +2395,6 @@ interface IWineD3DCubeTexture : IWineD3DBaseTexture ...@@ -2395,12 +2395,6 @@ interface IWineD3DCubeTexture : IWineD3DBaseTexture
] ]
interface IWineD3DVolumeTexture : 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( HRESULT Unmap(
[in] UINT sub_resource_idx [in] UINT sub_resource_idx
); );
...@@ -3200,3 +3194,5 @@ ULONG __cdecl wined3d_stateblock_incref(struct wined3d_stateblock *stateblock); ...@@ -3200,3 +3194,5 @@ ULONG __cdecl wined3d_stateblock_incref(struct wined3d_stateblock *stateblock);
ULONG __cdecl wined3d_vertex_declaration_decref(struct wined3d_vertex_declaration *declaration); ULONG __cdecl wined3d_vertex_declaration_decref(struct wined3d_vertex_declaration *declaration);
void * __cdecl wined3d_vertex_declaration_get_parent(const 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); ULONG __cdecl wined3d_vertex_declaration_incref(struct wined3d_vertex_declaration *declaration);
IWineD3DVolume * __cdecl wined3d_volume_from_resource(struct wined3d_resource *resource);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment