[vlc-commits] direct3d11: do not use D3D11 on older systems unless forced

Steve Lhomme git at videolan.org
Thu Aug 10 21:13:10 CEST 2017


vlc | branch: master | Steve Lhomme <robux4 at videolabs.io> | Thu Aug 10 14:37:21 2017 +0200| [c30147e56b062c54547be9d9c5e3d8c0b795494b] | committer: Jean-Baptiste Kempf

direct3d11: do not use D3D11 on older systems unless forced

Using D3D 11.1 means we are at least on Windows 8.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/video_output/win32/direct3d11.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index cb0d0a302b..13ef64617d 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -1675,10 +1675,16 @@ static int Direct3D11Open(vout_display_t *vd, video_format_t *fmt)
 #endif
     };
 
+    D3D_FEATURE_LEVEL features[] = {
+       D3D_FEATURE_LEVEL_11_1, D3D_FEATURE_LEVEL_11_0,
+       D3D_FEATURE_LEVEL_10_1, D3D_FEATURE_LEVEL_10_0,
+       D3D_FEATURE_LEVEL_9_3, D3D_FEATURE_LEVEL_9_2, D3D_FEATURE_LEVEL_9_1
+    };
+
     for (UINT driver = 0; driver < ARRAYSIZE(driverAttempts); driver++) {
         D3D_FEATURE_LEVEL i_feature_level;
         hr = D3D11CreateDevice(NULL, driverAttempts[driver], NULL, creationFlags,
-                    NULL, 0, D3D11_SDK_VERSION,
+                    features, ARRAY_SIZE(features), D3D11_SDK_VERSION,
                     &sys->d3ddevice, &i_feature_level, &sys->d3dcontext);
         if (SUCCEEDED(hr)) {
 #ifndef NDEBUG
@@ -1686,7 +1692,12 @@ static int Direct3D11Open(vout_display_t *vd, video_format_t *fmt)
                     (void *)sys->d3ddevice, (void *)sys->d3dcontext,
                     driverAttempts[driver], i_feature_level);
 #endif
-            break;
+            if ( vd->obj.force || i_feature_level >= D3D_FEATURE_LEVEL_11_1 )
+                break;
+            ID3D11DeviceContext_Release(sys->d3dcontext);
+            sys->d3dcontext = NULL;
+            ID3D11Device_Release(sys->d3ddevice);
+            sys->d3ddevice = NULL;
         }
     }
 



More information about the vlc-commits mailing list