diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index 2c6739137d8..33c443adac4 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 8e4d827d7fa..f291a7a6e62 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; }