diff options
author | pommicket <pommicket@gmail.com> | 2022-12-31 10:46:58 -0500 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2022-12-31 10:46:58 -0500 |
commit | 949eb5b1b8a1835cc872741930fef767b0885e36 (patch) | |
tree | ab2082186c83cd0d95f85251e84780932f5a2be0 | |
parent | 31520dd979ef8abe4e38d4ba0b2912a8385b8351 (diff) |
only set swap interval if needed
-rw-r--r-- | main.c | 10 | ||||
-rw-r--r-- | ted.cfg | 2 |
2 files changed, 10 insertions, 2 deletions
@@ -1147,7 +1147,15 @@ int main(int argc, char **argv) { SDL_Delay((u32)ms_wait); } } - SDL_GL_SetSwapInterval(settings->vsync ? 1 : 0); + + // i don't know if SDL_GL_SetSwapInterval is slow on any platform + // (if you're not actually changing it). just in case, let's make sure + // we only call it when the vsync setting actually changes. + static int prev_vsync = -1; + if (settings->vsync != prev_vsync) { + prev_vsync = settings->vsync; + SDL_GL_SetSwapInterval(settings->vsync ? 1 : 0); + } SDL_GL_SwapWindow(window); } PROFILE_TIME(frame_end) @@ -52,7 +52,7 @@ max-file-size = 20000000 max-file-size-view-only = 100000000 # whether to use vsync or not. you probably want this on. -vsync = off +vsync = on # max framerate. vsync overrides this. # you might want to increase this if you have a >60Hz monitor and you don't care about CPU usage. framerate-cap = 60 |