Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better framepacing - Windows SDL Edition #330

Merged
merged 2 commits into from
Oct 2, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Use high-resolution timer on Win 10
  • Loading branch information
Spodi committed Sep 26, 2023
commit e5f6e7f2145662663243a238202eac3d8002da09
7 changes: 6 additions & 1 deletion src/graphic/Fast3D/gfx_sdl2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,12 @@ static void gfx_sdl_init(const char* game_name, const char* gfx_api_name, bool s
#endif

#ifdef _WIN32
timer = CreateWaitableTimer(nullptr, false, nullptr);
// Use high-resolution timer by default on Windows 10 (so that NtSetTimerResolution (...) hacks are not needed)
timer = CreateWaitableTimerExW(nullptr, nullptr, CREATE_WAITABLE_TIMER_HIGH_RESOLUTION, TIMER_ALL_ACCESS);
// Fallback to low resolution timer if unsupported by the OS
if (timer == nullptr) {
timer = CreateWaitableTimer(nullptr, false, nullptr);
}
#endif

char title[512];
Expand Down