[vlc-devel] [PATCH 5/6] direct3d11: reorder some calls

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


When sharing the D3D11 context some settings may be overridden,
so we make sure we always have the right setup to render
---
 modules/video_output/msw/direct3d11.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/modules/video_output/msw/direct3d11.c b/modules/video_output/msw/direct3d11.c
index d7210ed..f591778 100644
--- a/modules/video_output/msw/direct3d11.c
+++ b/modules/video_output/msw/direct3d11.c
@@ -692,8 +692,6 @@ static HRESULT UpdateBackBuffer(vout_display_t *vd)
        return hr;
     }
 
-    ID3D11DeviceContext_OMSetRenderTargets(sys->d3dcontext, 1, &sys->d3drenderTargetView, sys->d3ddepthStencilView);
-
     D3D11_VIEWPORT vp;
     vp.Width = (FLOAT)RECTWidth(sys->rect_dest_clipped);
     vp.Height = (FLOAT)RECTHeight(sys->rect_dest_clipped);
@@ -747,12 +745,6 @@ static void Prepare(vout_display_t *vd, picture_t *picture, subpicture_t *subpic
     }
 #endif
 
-#if VLC_WINSTORE_APP /* TODO: Choose the WinRT app background clear color */
-    float ClearColor[4] = { 1.0f, 0.125f, 0.3f, 1.0f };
-    ID3D11DeviceContext_ClearRenderTargetView(sys->d3dcontext,sys->d3drenderTargetView, ClearColor);
-#endif
-    ID3D11DeviceContext_ClearDepthStencilView(sys->d3dcontext,sys->d3ddepthStencilView, D3D11_CLEAR_DEPTH, 1.0f, 0);
-
     if (subpicture) {
         int subpicture_region_count    = 0;
         picture_t **subpicture_regions = NULL;
@@ -785,6 +777,10 @@ static void Display(vout_display_t *vd, picture_t *picture, subpicture_t *subpic
 
     /* no ID3D11Device operations should come here */
 
+    ID3D11DeviceContext_OMSetRenderTargets(sys->d3dcontext, 1, &sys->d3drenderTargetView, sys->d3ddepthStencilView);
+
+    ID3D11DeviceContext_ClearDepthStencilView(sys->d3dcontext, sys->d3ddepthStencilView, D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 1.0f, 0);
+
     /* Render the quad */
     DisplayD3DPicture(sys, &sys->picQuad);
 
-- 
2.4.3




More information about the vlc-devel mailing list