[vlc-devel] [PATCH 2/2] direct3d11: only use the D3D11 decoder device automatically on Win8+
Steve Lhomme
robux4 at ycbcr.xyz
Wed Sep 18 16:09:17 CEST 2019
---
modules/hw/d3d11/d3d11_device.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/modules/hw/d3d11/d3d11_device.c b/modules/hw/d3d11/d3d11_device.c
index b259be7ba33..625b890b173 100644
--- a/modules/hw/d3d11/d3d11_device.c
+++ b/modules/hw/d3d11/d3d11_device.c
@@ -73,7 +73,6 @@ static const struct vlc_decoder_device_operations d3d11_dev_ops = {
int D3D11OpenDecoderDevice(vlc_decoder_device *device, bool forced, vout_window_t *wnd)
{
- VLC_UNUSED(forced);
VLC_UNUSED(wnd);
d3d11_decoder_device *sys = vlc_obj_malloc(VLC_OBJECT(device), sizeof(*sys));
if (unlikely(sys==NULL))
@@ -115,6 +114,19 @@ int D3D11OpenDecoderDevice(vlc_decoder_device *device, bool forced, vout_window_
else
{
/* internal decoder device */
+#if !VLC_WINSTORE_APP
+ if (!forced)
+ {
+ /* Allow using D3D11 automatically starting from Windows 8.1 */
+ bool isWin81OrGreater = false;
+ HMODULE hKernel32 = GetModuleHandle(TEXT("kernel32.dll"));
+ if (likely(hKernel32 != NULL))
+ isWin81OrGreater = GetProcAddress(hKernel32, "IsProcessCritical") != NULL;
+ if (!isWin81OrGreater)
+ return VLC_EGENERIC;
+ }
+#endif /* !VLC_WINSTORE_APP */
+
HRESULT hr = D3D11_CreateDevice( device, &sys->hd3d, NULL,
true /* is_d3d11_opaque(chroma) */,
&sys->d3d_dev );
--
2.17.1
More information about the vlc-devel
mailing list