[vlc-devel] [PATCH 2/6] direct3d11: check more return values

Steve Lhomme robux4 at gmail.com
Wed Jun 17 12:20:51 CEST 2015


---
 modules/video_output/msw/direct3d11.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/modules/video_output/msw/direct3d11.c b/modules/video_output/msw/direct3d11.c
index 2332ed2..7f3e30a 100644
--- a/modules/video_output/msw/direct3d11.c
+++ b/modules/video_output/msw/direct3d11.c
@@ -653,6 +653,10 @@ static HRESULT UpdateBackBuffer(vout_display_t *vd)
 
     hr = ID3D11Device_CreateRenderTargetView(sys->d3ddevice, (ID3D11Resource *)pBackBuffer, NULL, &sys->d3drenderTargetView);
     ID3D11Texture2D_Release(pBackBuffer);
+    if (FAILED(hr)) {
+        msg_Err(vd, "Failed to create the target view. (hr=0x%lX)", hr);
+        return hr;
+    }
 
     D3D11_TEXTURE2D_DESC deptTexDesc;
     memset(&deptTexDesc, 0,sizeof(deptTexDesc));
@@ -792,7 +796,11 @@ static void Display(vout_display_t *vd, picture_t *picture, subpicture_t *subpic
         }
     }
 
-    IDXGISwapChain_Present(sys->dxgiswapChain, 0, 0);
+    HRESULT hr = IDXGISwapChain_Present(sys->dxgiswapChain, 0, 0);
+    if (hr == DXGI_ERROR_DEVICE_REMOVED || hr == DXGI_ERROR_DEVICE_RESET)
+    {
+        /* TODO device lost */
+    }
 
     picture_Release(picture);
     if (subpicture)
-- 
2.4.3




More information about the vlc-devel mailing list