mirror of https://github.com/mpv-player/mpv
vo_gpu: d3d11_helpers: don't try BGRA_SUPPORT
The D3D11_CREATE_DEVICE_BGRA_SUPPORT flag doesn't enable support for BGRA textures. BGRA textures will be supported whether or not the flag is passed. The flag just fails device creation if they are not supported as an API convenience for programs that need BGRA textures, such as programs that use D2D or D3D9 interop. We can handle devices without BGRA support fine, so don't bother with the flag.
This commit is contained in:
parent
021fe791e1
commit
b9c742df10
|
@ -72,9 +72,8 @@ static int get_feature_levels(int max_fl, int min_fl,
|
|||
return len;
|
||||
}
|
||||
|
||||
static HRESULT create_device(struct mp_log *log, bool warp, bool bgra,
|
||||
bool debug, int max_fl, int min_fl,
|
||||
ID3D11Device **dev)
|
||||
static HRESULT create_device(struct mp_log *log, bool warp, bool debug,
|
||||
int max_fl, int min_fl, ID3D11Device **dev)
|
||||
{
|
||||
const D3D_FEATURE_LEVEL *levels;
|
||||
int levels_len = get_feature_levels(max_fl, min_fl, &levels);
|
||||
|
@ -85,11 +84,7 @@ static HRESULT create_device(struct mp_log *log, bool warp, bool bgra,
|
|||
|
||||
D3D_DRIVER_TYPE type = warp ? D3D_DRIVER_TYPE_WARP
|
||||
: D3D_DRIVER_TYPE_HARDWARE;
|
||||
UINT flags = 0;
|
||||
if (bgra)
|
||||
flags |= D3D11_CREATE_DEVICE_BGRA_SUPPORT;
|
||||
if (debug)
|
||||
flags |= D3D11_CREATE_DEVICE_DEBUG;
|
||||
UINT flags = debug ? D3D11_CREATE_DEVICE_DEBUG : 0;
|
||||
return pD3D11CreateDevice(NULL, type, NULL, flags, levels, levels_len,
|
||||
D3D11_SDK_VERSION, dev, NULL, NULL);
|
||||
}
|
||||
|
@ -102,7 +97,6 @@ bool mp_d3d11_create_present_device(struct mp_log *log,
|
|||
ID3D11Device **dev_out)
|
||||
{
|
||||
bool warp = opts->force_warp;
|
||||
bool bgra = true;
|
||||
int max_fl = opts->max_feature_level;
|
||||
int min_fl = opts->min_feature_level;
|
||||
ID3D11Device *dev = NULL;
|
||||
|
@ -123,17 +117,10 @@ bool mp_d3d11_create_present_device(struct mp_log *log,
|
|||
max_fl = max_fl ? max_fl : D3D_FEATURE_LEVEL_11_0;
|
||||
min_fl = min_fl ? min_fl : D3D_FEATURE_LEVEL_9_1;
|
||||
|
||||
hr = create_device(log, warp, bgra, opts->debug, max_fl, min_fl, &dev);
|
||||
hr = create_device(log, warp, opts->debug, max_fl, min_fl, &dev);
|
||||
if (SUCCEEDED(hr))
|
||||
break;
|
||||
|
||||
// BGRA is recommended, but FL 10_0 hardware may not support it
|
||||
if (bgra) {
|
||||
mp_dbg(log, "Failed to create D3D device with BGRA support\n");
|
||||
bgra = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Trying to create a D3D_FEATURE_LEVEL_12_0 device on Windows 8.1 or
|
||||
// below will not succeed. Try an 11_1 device.
|
||||
if (max_fl >= D3D_FEATURE_LEVEL_12_0 &&
|
||||
|
@ -141,7 +128,6 @@ bool mp_d3d11_create_present_device(struct mp_log *log,
|
|||
{
|
||||
mp_dbg(log, "Failed to create 12_0+ device, trying 11_1\n");
|
||||
max_fl = D3D_FEATURE_LEVEL_11_1;
|
||||
bgra = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -152,7 +138,6 @@ bool mp_d3d11_create_present_device(struct mp_log *log,
|
|||
{
|
||||
mp_dbg(log, "Failed to create 11_1+ device, trying 11_0\n");
|
||||
max_fl = D3D_FEATURE_LEVEL_11_0;
|
||||
bgra = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -162,7 +147,6 @@ bool mp_d3d11_create_present_device(struct mp_log *log,
|
|||
warp = true;
|
||||
max_fl = opts->max_feature_level;
|
||||
min_fl = opts->min_feature_level;
|
||||
bgra = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue