[vlc-commits] d3d11va: reuse the global UWP context if possible
Steve Lhomme
git at videolan.org
Mon Feb 19 18:10:59 CET 2018
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon Feb 19 17:31:33 2018 +0100| [a15bca0d4be6258ee9f6d683dbdf6efb8d3f6edf] | committer: Steve Lhomme
d3d11va: reuse the global UWP context if possible
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a15bca0d4be6258ee9f6d683dbdf6efb8d3f6edf
---
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);
More information about the vlc-commits
mailing list