From: Stefan Dösinger Subject: [PATCH 4/6] d3d9: Forward Volume::Lock to VolumeTexture::Lock. Message-Id: <1397742453-22083-4-git-send-email-stefan@codeweavers.com> Date: Thu, 17 Apr 2014 15:47:31 +0200 The goal is to merge wined3d_buffer/surface/volume_map to wined3d_resource_map (textures and buffers, but not surfaces and volumes), but this needs a lot more preparation work. --- dlls/d3d9/texture.c | 9 ++++++--- dlls/d3d9/volume.c | 13 ++----------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/dlls/d3d9/texture.c b/dlls/d3d9/texture.c index fc15b80..19442b0 100644 --- a/dlls/d3d9/texture.c +++ b/dlls/d3d9/texture.c @@ -1134,7 +1134,6 @@ static HRESULT WINAPI d3d9_texture_3d_LockBox(IDirect3DVolumeTexture9 *iface, { struct d3d9_texture *texture = impl_from_IDirect3DVolumeTexture9(iface); struct wined3d_resource *sub_resource; - struct d3d9_volume *volume_impl; HRESULT hr; TRACE("iface %p, level %u, locked_box %p, box %p, flags %#x.\n", @@ -1145,8 +1144,12 @@ static HRESULT WINAPI d3d9_texture_3d_LockBox(IDirect3DVolumeTexture9 *iface, hr = D3DERR_INVALIDCALL; else { - volume_impl = wined3d_resource_get_parent(sub_resource); - hr = IDirect3DVolume9_LockBox(&volume_impl->IDirect3DVolume9_iface, locked_box, box, flags); + struct wined3d_map_desc map_desc; + struct wined3d_volume *volume = wined3d_volume_from_resource(sub_resource); + hr = wined3d_volume_map(volume, &map_desc, (const struct wined3d_box *)box, flags); + locked_box->RowPitch = map_desc.row_pitch; + locked_box->SlicePitch = map_desc.slice_pitch; + locked_box->pBits = map_desc.data; } wined3d_mutex_unlock(); diff --git a/dlls/d3d9/volume.c b/dlls/d3d9/volume.c index 5213c4a..5d7e198 100644 --- a/dlls/d3d9/volume.c +++ b/dlls/d3d9/volume.c @@ -178,21 +178,12 @@ static HRESULT WINAPI d3d9_volume_LockBox(IDirect3DVolume9 *iface, D3DLOCKED_BOX *locked_box, const D3DBOX *box, DWORD flags) { struct d3d9_volume *volume = impl_from_IDirect3DVolume9(iface); - struct wined3d_map_desc map_desc; - HRESULT hr; TRACE("iface %p, locked_box %p, box %p, flags %#x.\n", iface, locked_box, box, flags); - wined3d_mutex_lock(); - hr = wined3d_volume_map(volume->wined3d_volume, &map_desc, (const struct wined3d_box *)box, flags); - wined3d_mutex_unlock(); - - locked_box->RowPitch = map_desc.row_pitch; - locked_box->SlicePitch = map_desc.slice_pitch; - locked_box->pBits = map_desc.data; - - return hr; + return IDirect3DVolumeTexture9_LockBox((IDirect3DVolumeTexture9 *)volume->container, + volume->level, locked_box, box, flags); } static HRESULT WINAPI d3d9_volume_UnlockBox(IDirect3DVolume9 *iface) -- 1.8.3.2