only apply vsync on changes

nvidia over bumblebee slows down on changes
This commit is contained in:
degasus 2013-03-30 22:17:39 +01:00
parent 485bd70df2
commit 6958822f19

View file

@ -136,6 +136,8 @@ static int s_LastMultisampleMode = 0;
static u32 s_blendMode; static u32 s_blendMode;
static bool s_vsync;
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
static std::thread scrshotThread; static std::thread scrshotThread;
#endif #endif
@ -349,8 +351,8 @@ Renderer::Renderer()
s_backbuffer_height = (int)GLInterface->GetBackBufferHeight(); s_backbuffer_height = (int)GLInterface->GetBackBufferHeight();
// Handle VSync on/off // Handle VSync on/off
int swapInterval = g_ActiveConfig.IsVSync() ? 1 : 0; s_vsync = g_ActiveConfig.IsVSync();
GLInterface->SwapInterval(swapInterval); GLInterface->SwapInterval(s_vsync);
// check the max texture width and height // check the max texture width and height
GLint max_texture_size; GLint max_texture_size;
@ -1341,7 +1343,11 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
GL_REPORT_ERRORD(); GL_REPORT_ERRORD();
GLInterface->SwapInterval(g_ActiveConfig.IsVSync() ? 1 : 0); if(s_vsync != g_ActiveConfig.IsVSync())
{
s_vsync = g_ActiveConfig.IsVSync();
GLInterface->SwapInterval(s_vsync);
}
// Clean out old stuff from caches. It's not worth it to clean out the shader caches. // Clean out old stuff from caches. It's not worth it to clean out the shader caches.
DLCache::ProgressiveCleanup(); DLCache::ProgressiveCleanup();