Hi,
When you create the swapchain you have to set the numerator and the denominator for the refresh rate.
Here what MSDN says :
The DXGI_RATIONAL structure operates under the following rules:
- 0/0 is legal and will be interpreted as 0/1.
- 0/anything is interpreted as zero.
- If you are representing a whole number, the denominator should be 1.
What is the good values for fullscreen and windowed, also about the VSync ?
When I call "present" I do like that :
m_SwapChain->Present( m_VSync ? 1 : 0, 0 );
Is it correct to only use 1 as VSync interval ?
What is the real meaning of 0/1, is it bad to use it ?
What is the good way to find the good refresh rate ?
Apparently, MSDN also recommend to do that after CreateSwapChain :
// Detect if newly created full-screen swap chain isn't actually full screen. IDXGIOutput* pTarget; BOOL bFullscreen; if (SUCCEEDED(pSwapChain->GetFullscreenState(&bFullscreen, &pTarget))) { pTarget->Release(); } else bFullscreen = FALSE; // If not full screen, enable full screen again. if (!bFullscreen) { ShowWindow(hWnd, SW_MINIMIZE); ShowWindow(hWnd, SW_RESTORE); pSwapChain->SetFullscreenState(TRUE, NULL); }
Also that :
Because the target output can't be chosen explicitly when the swap chain is created, we recommend not to create a full-screen swap chain. This can reduce presentation performance if the swap chain size and the output window size do not match. Here are two ways to ensure that the sizes match:
- Create a windowed swap chain and then set it full-screen using IDXGISwapChain::SetFullscreenState.
- Save a pointer to the swap chain immediately after creation, and use it to get the output window size during a WM_SIZE event. Then resize the swap chain buffers (with IDXGISwapChain::ResizeBuffers) during the transition from windowed to full-screen.
Last point :
If the swap chain is in full-screen mode, before you release it you must use SetFullscreenState to switch it to windowed mode.
Thanks