diff options
Diffstat (limited to 'video/decode/d3d.c')
-rw-r--r-- | video/decode/d3d.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/video/decode/d3d.c b/video/decode/d3d.c index 59d2a81664..5c65da469f 100644 --- a/video/decode/d3d.c +++ b/video/decode/d3d.c @@ -266,3 +266,15 @@ void copy_nv12(struct mp_image *dest, uint8_t *src_bits, buf.stride[1] = src_pitch; mp_image_copy_gpu(dest, &buf); } + +// Test if Direct3D11 can be used by us. Basically, this prevents trying to use +// D3D11 on Win7, and then failing somewhere in the process. +bool d3d11_check_decoding(ID3D11Device *dev) +{ + HRESULT hr; + // We assume that NV12 is always supported, if hw decoding is supported at + // all. + UINT supported = 0; + hr = ID3D11Device_CheckFormatSupport(dev, DXGI_FORMAT_NV12, &supported); + return !FAILED(hr) && (supported & D3D11_BIND_DECODER); +} |