I have a weird issue in our engine in DirectX11. When I run our game windowed, I can enable or disable VSync just fine. However, when the game's resolution is the same as the screen resolution, VSync is somehow always on. This happens both in Exclusive Fullscreen and in Borderless Window Fullscreen.
So for example, my monitor is 1920*1200. If I run in DirectX11 in Borderless Window Fullscreen on 1920*1200, I always get 60fps (so vsync is apparently on). If I run on 1920*1080, I can turn off vsync and get other framerates (for example 250fps, so vsync really is turned off).
I've seen this on more than one computer, but I don't know whether it happens on all computers.
Our engine also supports DirectX9 and OpenGL and the problem doesn't happen there: I can turn VSync on and off just fine there, regardless of resolution.
I turn VSync on and off by calling either of these, respectively:
swapChain->Present(1, 0); //on
swapChain->Present(0, 0); //off
I create the swapChain like this:
DXGI_SWAP_CHAIN_DESC1 swapChainDesc = {0};
swapChainDesc.Width = windowWidth;
swapChainDesc.Height = windowHeight;
swapChainDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
swapChainDesc.Stereo = false;
swapChainDesc.SampleDesc.Count = 1;
swapChainDesc.SampleDesc.Quality = 0;
swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
swapChainDesc.BufferCount = 2;
swapChainDesc.Scaling = DXGI_SCALING_STRETCH;
swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL;
swapChainDesc.Flags = 0;
SDL_SysWMinfo& windowInfo = getWindowInfo();
IDXGISwapChain1* swapChain = nullptr;
dxgiFactory->CreateSwapChainForHwnd(device, windowInfo .info.win.window, &swapChainDesc, nullptr, nullptr, &swapChain);
What am I doing wrong here? Why does turning VSync off only work when the game isn't covering the entire screen?