vlc/vlc-3.0 | branch: master | Steve Lhomme <[email protected]> | Mon Feb 19 17:31:33 2018 +0100| [515aa98249f268e5d4693cbc0302652d896d19ab] | committer: Hugo Beauzée-Luyssen
d3d11va: reuse the global UWP context if possible (cherry picked from commit a15bca0d4be6258ee9f6d683dbdf6efb8d3f6edf) Signed-off-by: Hugo Beauzée-Luyssen <[email protected]> > http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=515aa98249f268e5d4693cbc0302652d896d19ab --- modules/codec/avcodec/d3d11va.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c index bf6dcf5b0c..4a83ab1a15 100644 --- a/modules/codec/avcodec/d3d11va.c +++ b/modules/codec/avcodec/d3d11va.c @@ -409,12 +409,26 @@ static int D3dCreateDevice(vlc_va_t *va) return VLC_SUCCESS; } - /* */ - hr = D3D11_CreateDevice(va, &sys->hd3d, true, &sys->d3d_dev); - if (FAILED(hr)) { - msg_Err(va, "D3D11CreateDevice failed. (hr=0x%lX)", hr); - return VLC_EGENERIC; +#if VLC_WINSTORE_APP + sys->d3d_dev.d3dcontext = var_InheritInteger(va, "winrt-d3dcontext"); + if (likely(sys->d3d_dev.d3dcontext)) + { + ID3D11Device* d3ddevice = NULL; + ID3D11DeviceContext_GetDevice(sys->d3d_dev.d3dcontext, &sys->d3d_dev.d3ddevice); + ID3D11DeviceContext_AddRef(sys->d3d_dev.d3dcontext); + ID3D11Device_Release(sys->d3d_dev.d3ddevice); } +#endif + + /* */ + if (!sys->d3d_dev.d3ddevice) + { + hr = D3D11_CreateDevice(va, &sys->hd3d, true, &sys->d3d_dev); + if (FAILED(hr)) { + msg_Err(va, "D3D11CreateDevice failed. (hr=0x%lX)", hr); + return VLC_EGENERIC; + } + } void *d3dvidctx = NULL; hr = ID3D11DeviceContext_QueryInterface(sys->d3d_dev.d3dcontext, &IID_ID3D11VideoContext, &d3dvidctx); _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
