Fixed ERROR: IDXGIFactory::CreateSwapChain: The flag DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING is only allowed for FLIP swapchains

This commit is contained in:
Sam Lantinga
2025-09-07 16:53:25 -07:00
parent a7ee54f9a3
commit 174d411b50

View File

@@ -614,6 +614,7 @@ 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;
if (!(SDL_GetWindowFlags(renderer->window) & SDL_WINDOW_TRANSPARENT)) {
result = IDXGIFactory2_QueryInterface(data->dxgiFactory, &SDL_IID_IDXGIFactory5, (void **)&dxgiFactory5); result = IDXGIFactory2_QueryInterface(data->dxgiFactory, &SDL_IID_IDXGIFactory5, (void **)&dxgiFactory5);
if (SUCCEEDED(result)) { if (SUCCEEDED(result)) {
BOOL allowTearing = FALSE; BOOL allowTearing = FALSE;
@@ -623,6 +624,7 @@ static HRESULT D3D11_CreateDeviceResources(SDL_Renderer *renderer)
} }
IDXGIFactory5_Release(dxgiFactory5); IDXGIFactory5_Release(dxgiFactory5);
} }
}
#endif // HAVE_DXGI1_5_H #endif // HAVE_DXGI1_5_H
if (SDL_GetHintBoolean(SDL_HINT_RENDER_DIRECT3D11_WARP, false)) { if (SDL_GetHintBoolean(SDL_HINT_RENDER_DIRECT3D11_WARP, false)) {