Commit 99b260eb authored by Steve Lhomme's avatar Steve Lhomme Committed by Jean-Baptiste Kempf

d3d9_fmt: add a function to check the driver vendor/version is OK

Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent eb10517a
......@@ -248,3 +248,31 @@ error:
D3D9_Destroy( hd3d );
return VLC_EGENERIC;
}
int D3D9CheckDriverVersion(d3d9_handle_t *hd3d, d3d9_device_t *d3d_dev,
UINT vendorId, const struct wddm_version *min_ver)
{
D3DADAPTER_IDENTIFIER9 identifier;
HRESULT hr = IDirect3D9_GetAdapterIdentifier(hd3d->obj, d3d_dev->adapterId, 0, &identifier);
if (FAILED(hr))
return VLC_EGENERIC;
if (vendorId && identifier.VendorId != vendorId)
return VLC_SUCCESS;
int wddm, d3d_features, revision, build;
wddm = (int) (identifier.DriverVersion.HighPart >> 16 & 0xFFFF);
d3d_features = (int) (identifier.DriverVersion.HighPart >> 0 & 0xFFFF);
revision = (int) (identifier.DriverVersion.LowPart >> 16 & 0xFFFF);
build = (int) (identifier.DriverVersion.LowPart >> 0 & 0xFFFF);
bool newer =
wddm > min_ver->wddm ||
(wddm == min_ver->wddm && (d3d_features > min_ver->d3d_features ||
(d3d_features == min_ver->d3d_features &&
(revision > min_ver->revision ||
(revision == min_ver->revision &&
build > min_ver->build)))));
return newer ? VLC_SUCCESS : VLC_EGENERIC;
}
......@@ -88,4 +88,12 @@ void D3D9_Destroy(d3d9_handle_t *);
int D3D9_FillPresentationParameters(d3d9_handle_t *, const video_format_t *, d3d9_device_t *);
struct wddm_version
{
int wddm, d3d_features, revision, build;
};
int D3D9CheckDriverVersion(d3d9_handle_t *hd3d, d3d9_device_t *d3d_dev, UINT vendorId,
const struct wddm_version *min_ver);
#endif /* VLC_VIDEOCHROMA_D3D9_FMT_H_ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment