[PATCH 7/8] d3d9: Implement d3d9_device_UpdateSurface() on top of wined3d_device_copy_sub_resource_region().
Henri Verbeet
hverbeet at codeweavers.com
Wed Jan 27 13:44:40 CST 2016
From: Riccardo Bortolato <rikyz619 at gmail.com>
Signed-off-by: Riccardo Bortolato <rikyz619 at gmail.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
---
Maybe these are the same as 118538 and 118535, maybe not. I fixed 118379 and
118380, I'm not going to review them again.
dlls/d3d9/device.c | 20 ++++++++++++++++++--
dlls/d3d9/tests/device.c | 2 +-
dlls/wined3d/device.c | 2 +-
3 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index 6047a2c..3b1c859 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -1227,16 +1227,32 @@ static HRESULT WINAPI d3d9_device_UpdateSurface(IDirect3DDevice9Ex *iface,
struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface);
struct d3d9_surface *src = unsafe_impl_from_IDirect3DSurface9(src_surface);
struct d3d9_surface *dst = unsafe_impl_from_IDirect3DSurface9(dst_surface);
+ struct wined3d_box src_box;
HRESULT hr;
TRACE("iface %p, src_surface %p, src_rect %p, dst_surface %p, dst_point %p.\n",
iface, src_surface, src_rect, dst_surface, dst_point);
+ if (src_rect)
+ {
+ src_box.left = src_rect->left;
+ src_box.top = src_rect->top;
+ src_box.right = src_rect->right;
+ src_box.bottom = src_rect->bottom;
+ src_box.front = 0;
+ src_box.back = 1;
+ }
+
wined3d_mutex_lock();
- hr = wined3d_device_update_surface(device->wined3d_device, src->wined3d_surface, src_rect,
- dst->wined3d_surface, dst_point);
+ hr = wined3d_device_copy_sub_resource_region(device->wined3d_device,
+ wined3d_texture_get_resource(dst->wined3d_texture), dst->sub_resource_idx, dst_point ? dst_point->x : 0,
+ dst_point ? dst_point->y : 0, 0, wined3d_texture_get_resource(src->wined3d_texture),
+ src->sub_resource_idx, src_rect ? &src_box : NULL);
wined3d_mutex_unlock();
+ if (FAILED(hr))
+ return D3DERR_INVALIDCALL;
+
return hr;
}
diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
index ed5f731..39789a8 100644
--- a/dlls/d3d9/tests/device.c
+++ b/dlls/d3d9/tests/device.c
@@ -10163,7 +10163,7 @@ static void test_mipmap_lock(void)
hr = IDirect3DDevice9_UpdateSurface(device, surface, NULL, surface_dst, NULL);
ok(SUCCEEDED(hr), "Failed to update surface, hr %#x.\n", hr);
hr = IDirect3DDevice9_UpdateSurface(device, surface2, NULL, surface_dst2, NULL);
- todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
+ ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
/* Apparently there's no validation on the container. */
hr = IDirect3DDevice9_UpdateTexture(device, (IDirect3DBaseTexture9 *)texture,
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 97586f4..177d008 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4027,7 +4027,7 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev
dst_rect.bottom = dst_y + (src_rect.bottom - src_rect.top);
if (FAILED(hr = wined3d_surface_blt(dst_surface, &dst_rect, src_surface, &src_rect, 0, NULL, WINED3D_TEXF_POINT)))
- ERR("Failed to blit, hr %#x.\n", hr);
+ WARN("Failed to blit, hr %#x.\n", hr);
return hr;
}
--
2.1.4
More information about the wine-patches
mailing list