[vlc-commits] d3d11_fmt: simplify the nvidia check

Steve Lhomme git at videolan.org
Sat Feb 24 15:27:05 CET 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Sat Feb 24 13:41:30 2018 +0100| [92371944a2a3a11e05c6a2765394afbfe41da995] | committer: Steve Lhomme

d3d11_fmt: simplify the nvidia check

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

 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 667a601c8d..a6e279607e 100644
--- a/modules/video_chroma/d3d11_fmt.h
+++ b/modules/video_chroma/d3d11_fmt.h
@@ -109,7 +109,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