[vlc-commits] d3d11va: simplify D3dCreateDevice

Steve Lhomme git at videolan.org
Fri Oct 25 12:57:02 CEST 2019


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Oct  1 09:36:27 2019 +0200| [c912742e2f834992c85822b2ff7a90dbced7767e] | committer: Steve Lhomme

d3d11va: simplify D3dCreateDevice

We always have d3d_dev filled as it's coming from the mandatory decoder device.

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

 modules/codec/avcodec/d3d11va.c | 27 +--------------------------
 1 file changed, 1 insertion(+), 26 deletions(-)

diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index 3540b2769d..5d5e1551c7 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -366,32 +366,7 @@ static int D3dCreateDevice(vlc_va_t *va)
     vlc_va_sys_t *sys = va->sys;
     HRESULT hr;
 
-    if (sys->d3d_dev.d3ddevice && sys->d3d_dev.d3dcontext) {
-        msg_Dbg(va, "Reusing Direct3D11 device");
-        ID3D11DeviceContext_AddRef(sys->d3d_dev.d3dcontext);
-    }
-    else
-    {
-#if VLC_WINSTORE_APP
-        if (sys->d3d_dev.d3dcontext == NULL)
-            sys->d3d_dev.d3dcontext = var_InheritInteger(va, "winrt-d3dcontext"); /* LEGACY */
-#endif
-        if (sys->d3d_dev.d3dcontext != NULL)
-        {
-            ID3D11DeviceContext_GetDevice(sys->d3d_dev.d3dcontext, &sys->d3d_dev.d3ddevice);
-            ID3D11DeviceContext_AddRef(sys->d3d_dev.d3dcontext);
-            ID3D11Device_Release(sys->d3d_dev.d3ddevice);
-        }
-        else
-        {
-            hr = D3D11_CreateDevice(va, &sys->hd3d, NULL, true, &sys->d3d_dev);
-            if (FAILED(hr)) {
-                msg_Err(va, "D3D11CreateDevice failed. (hr=0x%lX)", hr);
-                return VLC_EGENERIC;
-            }
-        }
-    }
-
+    assert(sys->d3d_dev.d3ddevice && sys->d3d_dev.d3dcontext);
     void *d3dvidctx = NULL;
     hr = ID3D11DeviceContext_QueryInterface(sys->d3d_dev.d3dcontext, &IID_ID3D11VideoContext, &d3dvidctx);
     if (FAILED(hr)) {



More information about the vlc-commits mailing list