[vlc-commits] direct3d11: the rendering is "windowless" with an external callback

Steve Lhomme git at videolan.org
Tue Apr 30 11:14:04 CEST 2019


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu Apr 18 11:29:18 2019 +0200| [2fd859d00c7a97c8c3e1917803d06725866277fc] | committer: Steve Lhomme

direct3d11: the rendering is "windowless" with an external callback

In that case we don't call CommonInit.

We also check that on Winstore the legacy "winrt-d3dcontext" variable is set if
an external callback is not used.

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

 modules/video_output/win32/direct3d11.c | 39 ++++++++++++++++-----------------
 1 file changed, 19 insertions(+), 20 deletions(-)

diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 081b6c8510..18a1e43115 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -428,38 +428,37 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
     if (ret != VLC_SUCCESS)
         return ret;
 
-    ID3D11DeviceContext *d3d11_ctx = NULL;
-#if VLC_WINSTORE_APP
-    if (d3d11_ctx == NULL)
-        d3d11_ctx = var_InheritInteger(vd, "winrt-d3dcontext");
-    if (d3d11_ctx == NULL)
+    bool uses_external_callbacks = true;
+    if (!sys->swapCb || !sys->starRenderCb || !sys->endRenderCb || !sys->resizeCb)
     {
-        msg_Err(vd, "missing direct3d context for winstore");
-        goto error;
+        sys->outside_opaque = vd;
+        sys->swapCb       = Swap;
+        sys->starRenderCb = StartRendering;
+        sys->endRenderCb  = NULL;
+        sys->resizeCb     = Resize;
+        uses_external_callbacks = false;
     }
-#endif
+
     InitArea(vd, &sys->area, cfg);
-#if !VLC_WINSTORE_APP
-    if (d3d11_ctx == NULL)
+    if ( !uses_external_callbacks )
     {
+#if VLC_WINSTORE_APP
+        /* LEGACY, the d3dcontext and swapchain were given by the host app */
+        if (var_InheritInteger(vd, "winrt-d3dcontext") == 0)
+        {
+            msg_Err(vd, "missing direct3d context for winstore");
+            goto error;
+        }
+#else /* !VLC_WINSTORE_APP */
         if (CommonInit(VLC_OBJECT(vd), &sys->area, &sys->sys,
                        vd->source.projection_mode != PROJECTION_MODE_RECTANGULAR))
             goto error;
-    }
 #endif /* !VLC_WINSTORE_APP */
+    }
 
     if (vd->source.projection_mode != PROJECTION_MODE_RECTANGULAR && sys->sys.hvideownd)
         sys->p_sensors = HookWindowsSensors(vd, sys->sys.hvideownd);
 
-    if (!sys->swapCb || !sys->starRenderCb || !sys->endRenderCb || !sys->resizeCb)
-    {
-        sys->outside_opaque = vd;
-        sys->swapCb       = Swap;
-        sys->starRenderCb = StartRendering;
-        sys->endRenderCb  = NULL;
-        sys->resizeCb     = Resize;
-    }
-
     if (Direct3D11Open(vd, fmtp)) {
         msg_Err(vd, "Direct3D11 could not be opened");
         goto error;



More information about the vlc-commits mailing list