mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-09 06:03:32 +01:00
Merge pull request #5771 from Armada651/d3d-stereo-fix
D3DBase: Implement Windows 7 swapchain fallback.
This commit is contained in:
commit
07ab81e1bd
@ -304,9 +304,10 @@ HRESULT Create(HWND wnd)
|
|||||||
swap_chain_desc.Width = xres;
|
swap_chain_desc.Width = xres;
|
||||||
swap_chain_desc.Height = yres;
|
swap_chain_desc.Height = yres;
|
||||||
|
|
||||||
// By always creating a stereo swapchain we can toggle Quad-Buffered stereoscopy
|
// By creating a stereo swapchain early we can toggle Quad-Buffered stereoscopy
|
||||||
// while the game is running.
|
// while the game is running.
|
||||||
swap_chain_desc.Stereo = TRUE;
|
swap_chain_desc.Stereo =
|
||||||
|
g_ActiveConfig.iStereoMode == STEREO_QUADBUFFER || factory->IsWindowedStereoEnabled();
|
||||||
|
|
||||||
#if defined(_DEBUG) || defined(DEBUGFAST)
|
#if defined(_DEBUG) || defined(DEBUGFAST)
|
||||||
// Creating debug devices can sometimes fail if the user doesn't have the correct
|
// Creating debug devices can sometimes fail if the user doesn't have the correct
|
||||||
@ -317,10 +318,6 @@ HRESULT Create(HWND wnd)
|
|||||||
supported_feature_levels, NUM_SUPPORTED_FEATURE_LEVELS,
|
supported_feature_levels, NUM_SUPPORTED_FEATURE_LEVELS,
|
||||||
D3D11_SDK_VERSION, &device, &featlevel, &context);
|
D3D11_SDK_VERSION, &device, &featlevel, &context);
|
||||||
|
|
||||||
if (SUCCEEDED(hr))
|
|
||||||
hr = factory->CreateSwapChainForHwnd(device, hWnd, &swap_chain_desc, nullptr, nullptr,
|
|
||||||
&swapchain);
|
|
||||||
|
|
||||||
// Debugbreak on D3D error
|
// Debugbreak on D3D error
|
||||||
if (SUCCEEDED(hr) && SUCCEEDED(device->QueryInterface(__uuidof(ID3D11Debug), (void**)&debug)))
|
if (SUCCEEDED(hr) && SUCCEEDED(device->QueryInterface(__uuidof(ID3D11Debug), (void**)&debug)))
|
||||||
{
|
{
|
||||||
@ -348,10 +345,20 @@ HRESULT Create(HWND wnd)
|
|||||||
D3D11_CREATE_DEVICE_SINGLETHREADED, supported_feature_levels,
|
D3D11_CREATE_DEVICE_SINGLETHREADED, supported_feature_levels,
|
||||||
NUM_SUPPORTED_FEATURE_LEVELS, D3D11_SDK_VERSION, &device, &featlevel,
|
NUM_SUPPORTED_FEATURE_LEVELS, D3D11_SDK_VERSION, &device, &featlevel,
|
||||||
&context);
|
&context);
|
||||||
|
}
|
||||||
|
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
|
{
|
||||||
|
hr = factory->CreateSwapChainForHwnd(device, hWnd, &swap_chain_desc, nullptr, nullptr,
|
||||||
|
&swapchain);
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
// Flip-model swapchains aren't supported on Windows 7, so here we fall back to a legacy
|
||||||
|
// BitBlt-model swapchain
|
||||||
|
swap_chain_desc.SwapEffect = DXGI_SWAP_EFFECT_SEQUENTIAL;
|
||||||
hr = factory->CreateSwapChainForHwnd(device, hWnd, &swap_chain_desc, nullptr, nullptr,
|
hr = factory->CreateSwapChainForHwnd(device, hWnd, &swap_chain_desc, nullptr, nullptr,
|
||||||
&swapchain);
|
&swapchain);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
@ -579,8 +586,9 @@ void EndFrame()
|
|||||||
|
|
||||||
void Present()
|
void Present()
|
||||||
{
|
{
|
||||||
UINT present_flags =
|
UINT present_flags = 0;
|
||||||
g_ActiveConfig.iStereoMode != STEREO_QUADBUFFER ? DXGI_PRESENT_STEREO_TEMPORARY_MONO : 0;
|
if (swapchain->IsTemporaryMonoSupported() && g_ActiveConfig.iStereoMode != STEREO_QUADBUFFER)
|
||||||
|
present_flags = DXGI_PRESENT_STEREO_TEMPORARY_MONO;
|
||||||
|
|
||||||
// TODO: Is 1 the correct value for vsyncing?
|
// TODO: Is 1 the correct value for vsyncing?
|
||||||
swapchain->Present((UINT)g_ActiveConfig.IsVSync(), present_flags);
|
swapchain->Present((UINT)g_ActiveConfig.IsVSync(), present_flags);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user