[vlc-commits] d3d11_fmt: simplify the nvidia check

Steve Lhomme git at videolan.org
Sun Feb 25 17:19:02 CET 2018


vlc/vlc-3.0 | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Sat Feb 24 13:41:30 2018 +0100| [6d80cc6d59cdcb55457d3021b97bc62146d0e502] | committer: Hugo Beauzée-Luyssen

d3d11_fmt: simplify the nvidia check

(cherry picked from commit 92371944a2a3a11e05c6a2765394afbfe41da995)
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=6d80cc6d59cdcb55457d3021b97bc62146d0e502
---

 modules/video_chroma/d3d11_fmt.c | 13 ++++++-------
 modules/video_chroma/d3d11_fmt.h |  1 -
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/modules/video_chroma/d3d11_fmt.c b/modules/video_chroma/d3d11_fmt.c
index ef4b7b9bf3..f01ad8b31c 100644
--- a/modules/video_chroma/d3d11_fmt.c
+++ b/modules/video_chroma/d3d11_fmt.c
@@ -334,19 +334,18 @@ bool isXboxHardware(ID3D11Device *d3ddev)
     return result;
 }
 
-bool isNvidiaHardware(ID3D11Device *d3ddev)
+static bool isNvidiaHardware(ID3D11Device *d3ddev)
 {
     IDXGIAdapter *p_adapter = D3D11DeviceAdapter(d3ddev);
     if (!p_adapter)
-        return NULL;
+        return false;
 
-    bool result = false;
     DXGI_ADAPTER_DESC adapterDesc;
-    if (SUCCEEDED(IDXGIAdapter_GetDesc(p_adapter, &adapterDesc)))
-        result = adapterDesc.VendorId == GPU_MANUFACTURER_NVIDIA;
-
+    if (FAILED(IDXGIAdapter_GetDesc(p_adapter, &adapterDesc)))
+        adapterDesc.VendorId = 0;
     IDXGIAdapter_Release(p_adapter);
-    return result;
+
+    return adapterDesc.VendorId == GPU_MANUFACTURER_NVIDIA;
 }
 
 bool CanUseVoutPool(d3d11_device_t *d3d_dev, UINT slices)
diff --git a/modules/video_chroma/d3d11_fmt.h b/modules/video_chroma/d3d11_fmt.h
index 4e1a848352..bf8dadf35a 100644
--- a/modules/video_chroma/d3d11_fmt.h
+++ b/modules/video_chroma/d3d11_fmt.h
@@ -107,7 +107,6 @@ int D3D11_Create(vlc_object_t *, d3d11_handle_t *);
 void D3D11_Destroy(d3d11_handle_t *);
 
 bool isXboxHardware(ID3D11Device *d3ddev);
-bool isNvidiaHardware(ID3D11Device *d3ddev);
 bool CanUseVoutPool(d3d11_device_t *, UINT slices);
 IDXGIAdapter *D3D11DeviceAdapter(ID3D11Device *d3ddev);
 int D3D11CheckDriverVersion(d3d11_device_t *, UINT vendorId,



More information about the vlc-commits mailing list