How to find out the actual refresh rate of the screen (not rounded number)

According to this Microsoft article , the screen refresh rate set by the user can be (and basically) a fractional number. The user sets 59 Hz, but the screen works in accordance with the display on the screen with a frequency of 60 Hz, but in fact it is 59.94 Hz. What I need for extremely smooth animation is 59.94 Hz.

Using IDirect3DDevice9 :: GetDisplayMode I get only an int value , which by definition cannot represent real time (same for EnumDisplaySettings ). I encounter a visible stutter every second because it reports rounded / truncated 59. If I manually fix the synchronized report in my application to 59.94, it runs smoothly.

Does anyone know how I can get the actual screen refresh rate?

My current workaround is to display 60 Hz and 59 Hz as a constant of 59.94 Hz, but not satisfying either.

+4
source share
1 answer

Windows Vista , .

( ), (DWM) . DwmGetCompositionTimingInfo DWM_TIMING_INFO:: rateRefresh, .

, . (DXGI_SWAP_CHAIN_FULLSCREEN_DESC:: RefreshRate) . IDXGIOutput:: GetDisplayModeList. , :

UINT numModes = 0;
dxgiOutput->GetDisplayModeList(DXGI_FORMAT_B8G8R8A8_UNORM, 0, &numModes, NULL);
DXGI_MODE_DESC* modes = new DXGI_MODE_DESC[numModes];
dxgiOutput->GetDisplayModeList(DXGI_FORMAT_B8G8R8A8_UNORM, 0, &numModes, modes);
// see modes[i].RefreshRate

, . , ​​. , , , vblank ( , ). , , , OS . Present() s (, ), IDXGIOutput:: WaitForVBlank , . , IDXGISwapChain:: GetFrameStatistics, , , .

!

+9

Source: https://habr.com/ru/post/1502553/


All Articles