mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-29 22:48:30 +00:00
Fixed ERROR: IDXGIFactory::CreateSwapChain: The flag DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING is only allowed for FLIP swapchains
This commit is contained in:
@@ -614,14 +614,16 @@ static HRESULT D3D11_CreateDeviceResources(SDL_Renderer *renderer)
|
|||||||
#ifdef HAVE_DXGI1_5_H
|
#ifdef HAVE_DXGI1_5_H
|
||||||
// Check for tearing support, which requires the IDXGIFactory5 interface.
|
// Check for tearing support, which requires the IDXGIFactory5 interface.
|
||||||
data->swapChainFlags = 0;
|
data->swapChainFlags = 0;
|
||||||
result = IDXGIFactory2_QueryInterface(data->dxgiFactory, &SDL_IID_IDXGIFactory5, (void **)&dxgiFactory5);
|
if (!(SDL_GetWindowFlags(renderer->window) & SDL_WINDOW_TRANSPARENT)) {
|
||||||
if (SUCCEEDED(result)) {
|
result = IDXGIFactory2_QueryInterface(data->dxgiFactory, &SDL_IID_IDXGIFactory5, (void **)&dxgiFactory5);
|
||||||
BOOL allowTearing = FALSE;
|
if (SUCCEEDED(result)) {
|
||||||
result = IDXGIFactory5_CheckFeatureSupport(dxgiFactory5, DXGI_FEATURE_PRESENT_ALLOW_TEARING, &allowTearing, sizeof(allowTearing));
|
BOOL allowTearing = FALSE;
|
||||||
if (SUCCEEDED(result) && allowTearing) {
|
result = IDXGIFactory5_CheckFeatureSupport(dxgiFactory5, DXGI_FEATURE_PRESENT_ALLOW_TEARING, &allowTearing, sizeof(allowTearing));
|
||||||
data->swapChainFlags = DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING;
|
if (SUCCEEDED(result) && allowTearing) {
|
||||||
|
data->swapChainFlags = DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING;
|
||||||
|
}
|
||||||
|
IDXGIFactory5_Release(dxgiFactory5);
|
||||||
}
|
}
|
||||||
IDXGIFactory5_Release(dxgiFactory5);
|
|
||||||
}
|
}
|
||||||
#endif // HAVE_DXGI1_5_H
|
#endif // HAVE_DXGI1_5_H
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user