[PATCH 2/5] wined3d: Reject multisampled readbacks in wined3d_surface_get_render_target_data().
Henri Verbeet
hverbeet at codeweavers.com
Sun Oct 23 11:23:58 CDT 2011
---
dlls/d3d9/device.c | 3 +--
dlls/d3d9/tests/visual.c | 2 +-
dlls/wined3d/surface.c | 13 +++++++++++++
dlls/wined3d/wined3d.spec | 1 +
include/wine/wined3d.h | 2 ++
5 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index 0372239..4768ece 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -971,8 +971,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetRenderTargetData(IDirect3DDevice9E
TRACE("iface %p, render_target %p, dst_surface %p.\n", iface, pRenderTarget, pDestSurface);
wined3d_mutex_lock();
- hr = wined3d_surface_bltfast(destSurface->wined3d_surface, 0, 0,
- renderTarget->wined3d_surface, NULL, WINEDDBLTFAST_NOCOLORKEY);
+ hr = wined3d_surface_get_render_target_data(destSurface->wined3d_surface, renderTarget->wined3d_surface);
wined3d_mutex_unlock();
return hr;
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c
index c583b12..2d651bf 100644
--- a/dlls/d3d9/tests/visual.c
+++ b/dlls/d3d9/tests/visual.c
@@ -12644,7 +12644,7 @@ static void multisample_get_rtdata_test(IDirect3DDevice9 *device)
hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xff00ff00, 0.0, 0);
ok(SUCCEEDED(hr), "Failed to clear render target, hr %#x.\n", hr);
hr = IDirect3DDevice9_GetRenderTargetData(device, rt, readback);
- todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
+ ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice9_SetDepthStencilSurface(device, original_ds);
ok(SUCCEEDED(hr), "Failed to set depth/stencil, hr %#x.\n", hr);
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 54b46b1..7b17e2f 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -1826,6 +1826,19 @@ HRESULT CDECL wined3d_surface_bltfast(struct wined3d_surface *dst_surface, DWORD
return wined3d_surface_blt(dst_surface, &dst_rect, src_surface, &src_rect, flags, NULL, WINED3DTEXF_POINT);
}
+HRESULT CDECL wined3d_surface_get_render_target_data(struct wined3d_surface *surface,
+ struct wined3d_surface *render_target)
+{
+ TRACE("surface %p, render_target %p.\n", surface, render_target);
+
+ /* TODO: Check surface sizes, pools, etc. */
+
+ if (render_target->resource.multisample_type)
+ return WINED3DERR_INVALIDCALL;
+
+ return wined3d_surface_blt(surface, NULL, render_target, NULL, 0, NULL, WINED3DTEXF_POINT);
+}
+
/* Context activation is done by the caller. */
static void surface_remove_pbo(struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info)
{
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index 6af4d3c..9cac395 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -212,6 +212,7 @@
@ cdecl wined3d_surface_get_parent(ptr)
@ cdecl wined3d_surface_get_pitch(ptr)
@ cdecl wined3d_surface_get_priority(ptr)
+@ cdecl wined3d_surface_get_render_target_data(ptr ptr)
@ cdecl wined3d_surface_get_resource(ptr)
@ cdecl wined3d_surface_getdc(ptr ptr)
@ cdecl wined3d_surface_incref(ptr)
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index e4ca4c4..a67949b 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2428,6 +2428,8 @@ struct wined3d_palette * __cdecl wined3d_surface_get_palette(const struct wined3
void * __cdecl wined3d_surface_get_parent(const struct wined3d_surface *surface);
DWORD __cdecl wined3d_surface_get_pitch(const struct wined3d_surface *surface);
DWORD __cdecl wined3d_surface_get_priority(const struct wined3d_surface *surface);
+HRESULT __cdecl wined3d_surface_get_render_target_data(struct wined3d_surface *surface,
+ struct wined3d_surface *render_target);
struct wined3d_resource * __cdecl wined3d_surface_get_resource(struct wined3d_surface *surface);
HRESULT __cdecl wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc);
ULONG __cdecl wined3d_surface_incref(struct wined3d_surface *surface);
--
1.7.3.4
More information about the wine-patches
mailing list