disabled VSYNC

This commit is contained in:
BADIM-PC\Vadim 2018-02-05 22:56:10 +03:00
parent eb4a66072a
commit 85748cf477
1 changed files with 4 additions and 19 deletions

View File

@ -839,7 +839,7 @@ s32 main(s32 argc, char **argv)
#elif defined(__EMSCRIPTEN__)
SDL_RENDERER_ACCELERATED
#else
SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC//(getConfig()->useVsync ? SDL_RENDERER_PRESENTVSYNC : 0)
SDL_RENDERER_ACCELERATED// | (getConfig()->useVsync ? SDL_RENDERER_PRESENTVSYNC : 0)
#endif
);
@ -853,18 +853,6 @@ s32 main(s32 argc, char **argv)
emscripten_set_main_loop(emstick, TIC_FRAMERATE, 1);
#else
{
bool useDelay = false;
{
SDL_RendererInfo info;
SDL_DisplayMode mode;
SDL_GetRendererInfo(platform.renderer, &info);
SDL_GetCurrentDisplayMode(SDL_GetWindowDisplayIndex(platform.window), &mode);
useDelay = !(info.flags & SDL_RENDERER_PRESENTVSYNC) || mode.refresh_rate > TIC_FRAMERATE;
}
u64 nextTick = SDL_GetPerformanceCounter();
const u64 Delta = SDL_GetPerformanceFrequency() / TIC_FRAMERATE;
@ -886,12 +874,9 @@ s32 main(s32 argc, char **argv)
}
else
{
if(useDelay || SDL_GetWindowFlags(platform.window) & SDL_WINDOW_MINIMIZED)
{
u32 time = (u32)(delay * 1000 / SDL_GetPerformanceFrequency());
if(time >= 10)
SDL_Delay(time);
}
u32 time = (u32)(delay * 1000 / SDL_GetPerformanceFrequency());
if(time >= 10)
SDL_Delay(time);
}
}
}