shinyquagsire23 / OpenJKDF2

A cross-platform reimplementation of JKDF2 in C
Other
493 stars 39 forks source link

VSync option doesn't seem to work properly #268

Open Havner opened 1 year ago

Havner commented 1 year ago

I've tried OpenJKDF2 on Steam Deck where I don't have a VRR display. In a static scene I achieve 75fps. When the display is set to 60Hz and I turn on vsync option the FPS goes down to 33fps. When I set the display to 45Hz and turn on vsync the FPS goes down to 33 FPS as well. I don't have such issues with any other game I play. Regardless whether the display is set to 45/50/60 Hz. All games lock the FPS to exactly the value of display refresh rate (the driver actually does that by blocking the buffer swap).

What I also noticed is that the FPS limiter doesn't actually set the FPS to the value set, but some value smaller. E.g. when I set FPS limiter to 60fps I get something like 40. Isn't the vsync implemented using FPS limiter? If that is the case that's pretty incorrect.

In any case a proper and working VSync would be very useful.

shinyquagsire23 commented 1 year ago

Yeah the FPS limiter undershoot has been on my radar for a bit, VSync has been, ehhhhh. So I basically just set the SDL2 option and hope for the best, but I know I could get way better results with like. Vulkan and actual triple buffering/swapchain stuff. But Vulkan is an entire other can of worms bc it's like 10x more difficult to make sure Vulkan code works on every platform.

Really even the frame limiter thing falls under this "I need way better frametime measurement utilities because there's no way it should be as inconsistent as it is" issue bloc I've been ~planning on tackling eventually

Havner commented 1 year ago

FPS limiter is one thing, but vsync in theory shouldn't be a huge deal. Vulcan is definitely not required for vsync to work. It has been done for years in pre Vulcan times :-) Strange the SDL2 option seems to work incorrectly.