diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 9d603d5d072..bedccb0503e 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -4009,22 +4009,31 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetTexture(IWineD3DDevice *iface, DWORD /***** * Get Back Buffer *****/ -static HRESULT WINAPI IWineD3DDeviceImpl_GetBackBuffer(IWineD3DDevice *iface, UINT iSwapChain, UINT BackBuffer, WINED3DBACKBUFFER_TYPE Type, - IWineD3DSurface **ppBackBuffer) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - IWineD3DSwapChain *swapChain; +static HRESULT WINAPI IWineD3DDeviceImpl_GetBackBuffer(IWineD3DDevice *iface, UINT swapchain_idx, + UINT backbuffer_idx, WINED3DBACKBUFFER_TYPE backbuffer_type, IWineD3DSurface **backbuffer) +{ + IWineD3DSwapChain *swapchain; HRESULT hr; - TRACE("(%p) : BackBuf %d Type %d SwapChain %d returning %p\n", This, BackBuffer, Type, iSwapChain, *ppBackBuffer); + TRACE("iface %p, swapchain_idx %u, backbuffer_idx %u, backbuffer_type %#x, backbuffer %p.\n", + iface, swapchain_idx, backbuffer_idx, backbuffer_type, backbuffer); - hr = IWineD3DDeviceImpl_GetSwapChain(iface, iSwapChain, &swapChain); - if (hr == WINED3D_OK) { - hr = IWineD3DSwapChain_GetBackBuffer(swapChain, BackBuffer, Type, ppBackBuffer); - IWineD3DSwapChain_Release(swapChain); - } else { - *ppBackBuffer = NULL; + hr = IWineD3DDeviceImpl_GetSwapChain(iface, swapchain_idx, &swapchain); + if (FAILED(hr)) + { + WARN("Failed to get swapchain %u, hr %#x.\n", swapchain_idx, hr); + return hr; } - return hr; + + hr = IWineD3DSwapChain_GetBackBuffer(swapchain, backbuffer_idx, backbuffer_type, backbuffer); + IWineD3DSwapChain_Release(swapchain); + if (FAILED(hr)) + { + WARN("Failed to get backbuffer %u, hr %#x.\n", backbuffer_idx, hr); + return hr; + } + + return WINED3D_OK; } static HRESULT WINAPI IWineD3DDeviceImpl_GetDeviceCaps(IWineD3DDevice *iface, WINED3DCAPS* pCaps) {