diff options
author | James Ross-Gowan <rossy@jrg.systems> | 2018-01-02 22:38:46 +1100 |
---|---|---|
committer | James Ross-Gowan <rossy@jrg.systems> | 2018-01-04 22:08:10 +1100 |
commit | baa18f76ca41fe92c6b7ed9f73a33b8b4de1337e (patch) | |
tree | b636ccead17dae62075c8da4a111301ea9a5c015 /video/out/gpu | |
parent | e894f75bb570e20966d64607aa69d64ba9022bd8 (diff) | |
download | mpv-baa18f76ca41fe92c6b7ed9f73a33b8b4de1337e.tar.bz2 mpv-baa18f76ca41fe92c6b7ed9f73a33b8b4de1337e.tar.xz |
vo_gpu: d3d11: don't use a bgra8 swapchain
Previously, mpv would attempt to use a BGRA swapchain in the hope that
it would give better performance, since the Windows desktop is also
composited in BGRA. In practice, it seems like there is no noticable
performance difference between RGBA and BGRA swapchains and BGRA
swapchains cause trouble with a42b8b1142fd, which attempts to use the
swapchain format for intermediate FBOs, even though D3D11 does not
guarantee BGRA surfaces will work with UAV typed stores.
Diffstat (limited to 'video/out/gpu')
-rw-r--r-- | video/out/gpu/d3d11_helpers.c | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/video/out/gpu/d3d11_helpers.c b/video/out/gpu/d3d11_helpers.c index b96b03a093..7bdd3c2eaa 100644 --- a/video/out/gpu/d3d11_helpers.c +++ b/video/out/gpu/d3d11_helpers.c @@ -315,29 +315,18 @@ bool mp_d3d11_create_swapchain(ID3D11Device *dev, struct mp_log *log, if (FAILED(hr)) factory2 = NULL; - // Try B8G8R8A8_UNORM first, since at least in Windows 8, it's always the - // format of the desktop image - static const DXGI_FORMAT formats[] = { - DXGI_FORMAT_B8G8R8A8_UNORM, - DXGI_FORMAT_R8G8B8A8_UNORM, - }; - static const int formats_len = MP_ARRAY_SIZE(formats); bool flip = factory2 && opts->flip; // Return here to retry creating the swapchain do { - for (int i = 0; i < formats_len; i++) { - if (factory2) { - // Create a DXGI 1.2+ (Windows 8+) swap chain if possible - hr = create_swapchain_1_2(dev, factory2, log, opts, flip, - formats[i], &swapchain); - } else { - // Fall back to DXGI 1.1 (Windows 7) - hr = create_swapchain_1_1(dev, factory, log, opts, formats[i], - &swapchain); - } - if (SUCCEEDED(hr)) - break; + if (factory2) { + // Create a DXGI 1.2+ (Windows 8+) swap chain if possible + hr = create_swapchain_1_2(dev, factory2, log, opts, flip, + DXGI_FORMAT_R8G8B8A8_UNORM, &swapchain); + } else { + // Fall back to DXGI 1.1 (Windows 7) + hr = create_swapchain_1_1(dev, factory, log, opts, + DXGI_FORMAT_R8G8B8A8_UNORM, &swapchain); } if (SUCCEEDED(hr)) break; |