mirror of
https://github.com/mpv-player/mpv
synced 2025-02-02 05:01:56 +00:00
262ceca731
Although D3D11 video decoding is unuspported on Windows 7, the associated APIs almost work. Where they fail is texture creation, where we try to create D3D11_BIND_DECODER surfaces. So specifically try to detect this situation. One issue is that once the hwdec interop is created, the damage is done, and it can't use another backend (because currently only 1 hwdec backend is supported). So that's where we prevent attempts to use it. It still can fail when trying to use d3d11va-copy (since that doesn't require an interop backend), but at that point we don't care anymore - dxva2(-copy) is tried before that anyway.
14 lines
485 B
C
14 lines
485 B
C
#include "angle_common.h"
|
|
|
|
// 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);
|
|
}
|