aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartijn Kaijser <martijn@xbmc.org>2016-04-02 11:45:31 +0200
committerMartijn Kaijser <martijn@xbmc.org>2016-04-02 11:45:31 +0200
commit17dd50aae422d12610811b6799f1d341bdeafde2 (patch)
treef2066baafd821e09274a55228952298497956fec
parent84f573f4f8441b7c5e3e6c032957a50e45e55c4c (diff)
parent9809c3cd3151c3e25d9f790851ce0731e572a107 (diff)
Merge pull request #9519 from afedchin/renderingdx_j
[Backport][RenderSystemDX] Fix possible segfault after ba2ff03
-rw-r--r--xbmc/rendering/dx/RenderSystemDX.cpp25
1 files changed, 14 insertions, 11 deletions
diff --git a/xbmc/rendering/dx/RenderSystemDX.cpp b/xbmc/rendering/dx/RenderSystemDX.cpp
index 9060b1eb82..4911abe488 100644
--- a/xbmc/rendering/dx/RenderSystemDX.cpp
+++ b/xbmc/rendering/dx/RenderSystemDX.cpp
@@ -842,6 +842,20 @@ bool CRenderSystemDX::CreateWindowSizeDependentResources()
hr = dxgiFactory2->CreateSwapChainForHwnd(m_pD3DDev, m_hFocusWnd, &scDesc1, &scFSDesc, NULL, &m_pSwapChain1);
+ // some drivers (AMD) are denied to switch in stereoscopic 3D mode, if so then fallback to mono mode
+ if (FAILED(hr) && bHWStereoEnabled)
+ {
+ // switch to stereo mode failed, create mono swapchain
+ CLog::Log(LOGERROR, "%s - Creating stereo swap chain failed with error: %s.", __FUNCTION__, GetErrorDescription(hr).c_str());
+ CLog::Log(LOGNOTICE, "%s - Fallback to monoscopic mode.", __FUNCTION__);
+
+ scDesc1.Stereo = false;
+ hr = dxgiFactory2->CreateSwapChainForHwnd(m_pD3DDev, m_hFocusWnd, &scDesc1, &scFSDesc, NULL, &m_pSwapChain1);
+
+ // fallback to split_horisontal mode.
+ g_graphicsContext.SetStereoMode(RENDER_STEREO_MODE_SPLIT_HORIZONTAL);
+ }
+
if (SUCCEEDED(hr))
{
m_pSwapChain1->QueryInterface(__uuidof(IDXGISwapChain), reinterpret_cast<void**>(&m_pSwapChain));
@@ -861,17 +875,6 @@ bool CRenderSystemDX::CreateWindowSizeDependentResources()
}
m_bHWStereoEnabled = bHWStereoEnabled;
}
- else if (bHWStereoEnabled)
- {
- // switch to stereo mode failed, create mono swapchain
- CLog::Log(LOGERROR, "%s - Creating swap chain failed with error: %s.", __FUNCTION__, GetErrorDescription(hr).c_str());
-
- scDesc1.Stereo = false;
- hr = dxgiFactory2->CreateSwapChainForHwnd(m_pD3DDev, m_hFocusWnd, &scDesc1, &scFSDesc, NULL, &m_pSwapChain1);
-
- // fallback to split_horisontal mode.
- g_graphicsContext.SetStereoMode(RENDER_STEREO_MODE_SPLIT_HORIZONTAL);
- }
dxgiFactory2->Release();
}
else