[vlc-commits] direct3d9: reorder some code initialization

Steve Lhomme git at videolan.org
Tue Jun 11 16:31:37 CEST 2019


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Jun 11 13:06:41 2019 +0200| [30906df51e70f9f929e4e7b3a3906d1409ca1de0] | committer: Steve Lhomme

direct3d9: reorder some code initialization

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=30906df51e70f9f929e4e7b3a3906d1409ca1de0
---

 modules/video_output/win32/direct3d9.c | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/modules/video_output/win32/direct3d9.c b/modules/video_output/win32/direct3d9.c
index c26aeffba5..796c7f830c 100644
--- a/modules/video_output/win32/direct3d9.c
+++ b/modules/video_output/win32/direct3d9.c
@@ -1695,6 +1695,8 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
     if (!sys)
         return VLC_ENOMEM;
 
+    CommonInit(vd, &sys->area, cfg);
+
     sys->outside_opaque = var_InheritAddress( vd, "vout-cb-opaque" );
     sys->setupDeviceCb       = var_InheritAddress( vd, "vout-cb-setup" );
     sys->cleanupDeviceCb     = var_InheritAddress( vd, "vout-cb-cleanup" );
@@ -1705,6 +1707,9 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
     if ( sys->setupDeviceCb == NULL || sys->swapCb == NULL || sys->startEndRenderingCb == NULL || sys->updateOutputCb == NULL )
     {
         /* use our own callbacks, since there isn't any external ones */
+        if (CommonWindowInit(VLC_OBJECT(vd), &sys->area, &sys->sys, false))
+            goto error;
+
         sys->outside_opaque = vd;
         sys->setupDeviceCb       = LocalSwapchainSetupDevice;
         sys->cleanupDeviceCb     = NULL;
@@ -1746,6 +1751,9 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
         return VLC_EGENERIC;
     }
 
+    if (sys->setupDeviceCb != LocalSwapchainSetupDevice)
+        CommonPlacePicture(VLC_OBJECT(vd), &sys->area, &sys->sys);
+
     sys->hxdll = Direct3D9LoadShaderLibrary();
     if (!sys->hxdll)
         msg_Warn(vd, "cannot load Direct3D9 Shader Library; HLSL pixel shading will be disabled.");
@@ -1754,17 +1762,6 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
     sys->lost_not_ready = false;
     sys->allow_hw_yuv = var_CreateGetBool(vd, "directx-hw-yuv");
 
-    CommonInit(vd, &sys->area, cfg);
-    if (d3d9_device == NULL)
-    {
-        if (CommonWindowInit(VLC_OBJECT(vd), &sys->area, &sys->sys, false))
-            goto error;
-    }
-    else
-    {
-        CommonPlacePicture(VLC_OBJECT(vd), &sys->area, &sys->sys);
-    }
-
     /* */
     video_format_t fmt;
     if (Direct3D9Open(vd, &fmt, d3d9_device)) {



More information about the vlc-commits mailing list