diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2024-02-28 21:20:03 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2024-02-28 21:35:53 +0100 |
commit | efa8631ad22c370f88950e2454665c5f10eb7452 (patch) | |
tree | e3653fdd98ab2588c03026ae6818a9946491c1e6 /main/setup.cpp | |
parent | 78a3eec9be053a1f82cf2e6235bbaa4deb4a1335 (diff) |
main: add debug code for vsync jank
Diffstat (limited to 'main/setup.cpp')
-rw-r--r-- | main/setup.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/main/setup.cpp b/main/setup.cpp index a413d8b6..a16165ba 100644 --- a/main/setup.cpp +++ b/main/setup.cpp @@ -61,13 +61,20 @@ void main_impl::update_window_state() dt_expected.do_sleep = true; dt_expected.jitter = 0; + dt_expected.has_focus = true; if (flags & SDL_WINDOW_HIDDEN) + { + dt_expected.has_focus = false; dt_expected.value = 1; + } else if (int interval = std::abs(SDL_GL_GetSwapInterval()); s.vsync && interval > 0) { int hz = get_window_refresh_rate(window()) / interval; if (!(flags & SDL_WINDOW_INPUT_FOCUS)) + { dt_expected.value = 2.f / hz; + dt_expected.has_focus = false; + } else dt_expected.value = 1.f/hz; } |