[vlc-commits] d3d11_fmt: rework the driver version check
Steve Lhomme
git at videolan.org
Tue Mar 13 13:00:54 CET 2018
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Mar 13 13:00:39 2018 +0100| [da7edaa574e54cba62d55b31a85ce97c76b14a68] | committer: Steve Lhomme
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.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=da7edaa574e54cba62d55b31a85ce97c76b14a68
---
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