libsdl-org / SDL

Simple Directmedia Layer
https://libsdl.org
zlib License
8.78k stars 1.66k forks source link

floating point Refresh Rate not reported correctly #10185

Closed TylerGlaiel closed 2 days ago

TylerGlaiel commented 1 week ago

Windows says my monitor is 143.963hz SDL reports this as 144.0hz

slouken commented 1 week ago

Can you debug it and find out why?

TylerGlaiel commented 1 week ago

image something to do with windows maybe, or the comment that suggests theres a better way to query it

TylerGlaiel commented 1 week ago

I can confirm that using DXGI instead reports the correct framerate

slouken commented 2 days ago

Fixed!

TylerGlaiel commented 2 days ago

image theres still a little bit of weird rounding here (float refresh rate is 143.960, but actual refresh rate (numerator / denominator) is 143.963

windows shows 3 digits of precision for this image

slouken commented 2 days ago

The floating point value has 2 digits of precision for display purposes. If you want the full precision, you should use the numerator and denominator to calculate it.