D3DBase: Implement Windows 7 swapchain fallback.
This commit is contained in:
parent
938939136e
commit
77a318789a
|
@ -317,10 +317,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 +344,21 @@ 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,
|
hr = factory->CreateSwapChainForHwnd(device, hWnd, &swap_chain_desc, nullptr, nullptr,
|
||||||
&swapchain);
|
&swapchain);
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
// Some swapchain features aren't supported on Windows 7, so here we fall back to legacy
|
||||||
|
// swapchain features
|
||||||
|
swap_chain_desc.Stereo = FALSE;
|
||||||
|
swap_chain_desc.SwapEffect = DXGI_SWAP_EFFECT_SEQUENTIAL;
|
||||||
|
hr = factory->CreateSwapChainForHwnd(device, hWnd, &swap_chain_desc, nullptr, nullptr,
|
||||||
|
&swapchain);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
|
|
Loading…
Reference in New Issue