mirror of https://github.com/sm64pc/sm64pc.git
Always syncronize framerate with timer (Fixes #381)
This commit is contained in:
parent
697a0b06e6
commit
c4a55e351d
|
@ -154,14 +154,12 @@ static inline void gfx_sdl_set_vsync(const bool enabled) {
|
||||||
if (vblanks) {
|
if (vblanks) {
|
||||||
printf("determined swap interval: %d\n", vblanks);
|
printf("determined swap interval: %d\n", vblanks);
|
||||||
SDL_GL_SetSwapInterval(vblanks);
|
SDL_GL_SetSwapInterval(vblanks);
|
||||||
use_timer = false;
|
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
printf("could not determine swap interval, falling back to timer sync\n");
|
printf("could not determine swap interval, falling back to timer sync\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
use_timer = true;
|
|
||||||
SDL_GL_SetSwapInterval(0);
|
SDL_GL_SetSwapInterval(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -233,6 +231,7 @@ static void gfx_sdl_init(const char *window_title) {
|
||||||
gfx_sdl_set_fullscreen();
|
gfx_sdl_set_fullscreen();
|
||||||
|
|
||||||
perf_freq = SDL_GetPerformanceFrequency();
|
perf_freq = SDL_GetPerformanceFrequency();
|
||||||
|
|
||||||
frame_time = perf_freq / FRAMERATE;
|
frame_time = perf_freq / FRAMERATE;
|
||||||
|
|
||||||
for (size_t i = 0; i < sizeof(windows_scancode_table) / sizeof(SDL_Scancode); i++) {
|
for (size_t i = 0; i < sizeof(windows_scancode_table) / sizeof(SDL_Scancode); i++) {
|
||||||
|
@ -362,7 +361,7 @@ static inline void sync_framerate_with_timer(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gfx_sdl_swap_buffers_begin(void) {
|
static void gfx_sdl_swap_buffers_begin(void) {
|
||||||
if (use_timer) sync_framerate_with_timer();
|
sync_framerate_with_timer();
|
||||||
SDL_GL_SwapWindow(wnd);
|
SDL_GL_SwapWindow(wnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue