[vlc-commits] direct3d9: only use the opengl converter with a valid D3D9 video context

Steve Lhomme git at videolan.org
Mon Oct 21 10:11:06 CEST 2019


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon Oct 21 10:01:45 2019 +0200| [d8161551b63e7c51e5ae3f677f3f02bb53f9b768] | committer: Steve Lhomme

direct3d9: only use the opengl converter with a valid D3D9 video context

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

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

diff --git a/modules/video_output/win32/direct3d9.c b/modules/video_output/win32/direct3d9.c
index 5e8d1d3d18..bcb53b2e01 100644
--- a/modules/video_output/win32/direct3d9.c
+++ b/modules/video_output/win32/direct3d9.c
@@ -1888,6 +1888,10 @@ GLConvOpen(vlc_object_t *obj)
      && tc->fmt.i_chroma != VLC_CODEC_D3D9_OPAQUE_10B)
         return VLC_EGENERIC;
 
+    d3d9_video_context_t *vctx_sys = GetD3D9ContextPrivate( tc->vctx );
+    if ( vctx_sys == NULL )
+        return VLC_EGENERIC;
+
     if (tc->gl->ext != VLC_GL_EXT_WGL || !tc->gl->wgl.getExtensionsString)
         return VLC_EGENERIC;
 
@@ -1919,27 +1923,16 @@ GLConvOpen(vlc_object_t *obj)
     tc->priv = priv;
     priv->vt = vt;
 
-    HRESULT hr;
-    int adapter = -1;
-    d3d9_decoder_device_t *d3d9_decoder = GetD3D9OpaqueContext( tc->vctx );
-    if ( d3d9_decoder != NULL )
-    {
-        D3D9_CloneExternal(&priv->hd3d, d3d9_decoder->device);
-        adapter = d3d9_decoder->adapter;
-    }
-    else
-    {
-        if (D3D9_Create(obj, &priv->hd3d) != VLC_SUCCESS)
-            goto error;
-    }
+    if (D3D9_Create(obj, &priv->hd3d) != VLC_SUCCESS)
+        goto error;
     if (!priv->hd3d.use_ex)
     {
         msg_Warn(obj, "DX/GL interrop only working on d3d9x");
         goto error;
     }
 
-    hr = D3D9_CreateDevice(obj, &priv->hd3d, adapter,
-                            &priv->d3d_dev);
+    HRESULT hr;
+    hr = D3D9_CreateDeviceExternal(vctx_sys->dev, &priv->hd3d, &priv->d3d_dev );
     if (FAILED(hr))
         goto error;
 



More information about the vlc-commits mailing list