[vlc-commits] d3d11_fmt: rework the driver version check

Steve Lhomme git at videolan.org
Wed Mar 14 11:52:08 CET 2018


vlc/vlc-3.0 | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Mar 13 13:00:39 2018 +0100| [ae9103198935c2ef18c240300e02a8b29f46e9bd] | committer: Hugo Beauzée-Luyssen

d3d11_fmt: rework the driver version check

In some case we may only want to check the build number so the other values
should be set to 0.
That's also how driver versions are written for Winstore build so the code
becomes more generic.

(cherry picked from commit da7edaa574e54cba62d55b31a85ce97c76b14a68)
Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>

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

 modules/video_chroma/d3d11_fmt.c | 46 +++++++++++++++++++++++++++-------------
 1 file changed, 31 insertions(+), 15 deletions(-)

diff --git a/modules/video_chroma/d3d11_fmt.c b/modules/video_chroma/d3d11_fmt.c
index f01ad8b31c..1ebc5ddd45 100644
--- a/modules/video_chroma/d3d11_fmt.c
+++ b/modules/video_chroma/d3d11_fmt.c
@@ -166,11 +166,11 @@ static HKEY GetAdapterRegistry(DXGI_ADAPTER_DESC *adapterDesc)
 #undef D3D11_GetDriverVersion
 void D3D11_GetDriverVersion(vlc_object_t *obj, d3d11_device_t *d3d_dev)
 {
+    memset(&d3d_dev->WDDM, 0, sizeof(d3d_dev->WDDM));
+
 #if VLC_WINSTORE_APP
     return;
 #else
-    memset(&d3d_dev->WDDM, 0, sizeof(d3d_dev->WDDM));
-
     IDXGIAdapter *pAdapter = D3D11DeviceAdapter(d3d_dev->d3ddevice);
     if (!pAdapter)
         return;
@@ -376,19 +376,35 @@ int D3D11CheckDriverVersion(d3d11_device_t *d3d_dev, UINT vendorId, const struct
     if (vendorId && adapterDesc.VendorId != vendorId)
         return VLC_SUCCESS;
 
-#if VLC_WINSTORE_APP
-    return VLC_EGENERIC;
-#else
-    bool newer =
-           d3d_dev->WDDM.wddm > min_ver->wddm ||
-          (d3d_dev->WDDM.wddm == min_ver->wddm && (d3d_dev->WDDM.d3d_features > min_ver->d3d_features ||
-                                    (d3d_dev->WDDM.d3d_features == min_ver->d3d_features &&
-                                                (d3d_dev->WDDM.revision > min_ver->revision ||
-                                                (d3d_dev->WDDM.revision == min_ver->revision &&
-                                                       d3d_dev->WDDM.build > min_ver->build)))));
-
-    return newer ? VLC_SUCCESS : VLC_EGENERIC;
-#endif
+    if (min_ver->wddm)
+    {
+        if (d3d_dev->WDDM.wddm > min_ver->wddm)
+            return VLC_SUCCESS;
+        else if (d3d_dev->WDDM.wddm != min_ver->wddm)
+            return VLC_EGENERIC;
+    }
+    if (min_ver->d3d_features)
+    {
+        if (d3d_dev->WDDM.d3d_features > min_ver->d3d_features)
+            return VLC_SUCCESS;
+        else if (d3d_dev->WDDM.d3d_features != min_ver->d3d_features)
+            return VLC_EGENERIC;
+    }
+    if (min_ver->revision)
+    {
+        if (d3d_dev->WDDM.revision > min_ver->revision)
+            return VLC_SUCCESS;
+        else if (d3d_dev->WDDM.revision != min_ver->revision)
+            return VLC_EGENERIC;
+    }
+    if (min_ver->build)
+    {
+        if (d3d_dev->WDDM.build > min_ver->build)
+            return VLC_SUCCESS;
+        else if (d3d_dev->WDDM.build != min_ver->build)
+            return VLC_EGENERIC;
+    }
+    return VLC_SUCCESS;
 }
 
 const d3d_format_t *FindD3D11Format(ID3D11Device *d3ddevice,



More information about the vlc-commits mailing list