From: Henri Verbeet Subject: [PATCH 1/5] wined3d: Return WINED3DERR_NOTFOUND if the render target is NULL in wined3d_device_get_render_target(). Message-Id: <1318179682-23231-1-git-send-email-hverbeet@codeweavers.com> Date: Sun, 9 Oct 2011 19:01:18 +0200 This is similar to how wined3d_device_get_depth_stencil() works. --- dlls/d3d9/device.c | 19 +++++++------------ dlls/wined3d/device.c | 8 +++++--- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index 2c67391..33c443a 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -1142,24 +1142,19 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetRenderTarget(IDirect3DDevice9Ex *i } wined3d_mutex_lock(); - hr = wined3d_device_get_render_target(This->wined3d_device, RenderTargetIndex, &wined3d_surface); - - if (FAILED(hr)) - { - FIXME("Call to IWineD3DDevice_GetRenderTarget failed, hr %#x\n", hr); - } - else if (!wined3d_surface) - { - *ppRenderTarget = NULL; - } - else + if (SUCCEEDED(hr)) { *ppRenderTarget = wined3d_surface_get_parent(wined3d_surface); IDirect3DSurface9_AddRef(*ppRenderTarget); wined3d_surface_decref(wined3d_surface); } - + else + { + if (hr != WINED3DERR_NOTFOUND) + WARN("Failed to get render target %u, hr %#x.\n", RenderTargetIndex, hr); + *ppRenderTarget = NULL; + } wined3d_mutex_unlock(); return hr; diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 8e4d827..f291a7a 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -5119,11 +5119,13 @@ HRESULT CDECL wined3d_device_get_render_target(struct wined3d_device *device, } *render_target = device->fb.render_targets[render_target_idx]; - if (*render_target) - wined3d_surface_incref(*render_target); - TRACE("Returning render target %p.\n", *render_target); + if (!*render_target) + return WINED3DERR_NOTFOUND; + + wined3d_surface_incref(*render_target); + return WINED3D_OK; } -- 1.7.3.4