VSYNC fixes for 100Hz displays
This commit is contained in:
		
							
								
								
									
										10
									
								
								src/studio.c
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								src/studio.c
									
									
									
									
									
								
							@@ -2755,11 +2755,15 @@ s32 main(s32 argc, char **argv)
 | 
			
		||||
		u64 nextTick = SDL_GetPerformanceCounter();
 | 
			
		||||
		const u64 Delta = SDL_GetPerformanceFrequency() / TIC_FRAMERATE;
 | 
			
		||||
 | 
			
		||||
		bool noVsync = false;
 | 
			
		||||
		bool useTimer = false;
 | 
			
		||||
		{
 | 
			
		||||
			SDL_RendererInfo info;
 | 
			
		||||
			SDL_DisplayMode mode;
 | 
			
		||||
 | 
			
		||||
			SDL_GetRendererInfo(studio.renderer, &info);
 | 
			
		||||
			noVsync = info.flags & SDL_RENDERER_PRESENTVSYNC ? false : true;
 | 
			
		||||
			SDL_GetCurrentDisplayMode(SDL_GetWindowDisplayIndex(studio.window), &mode);
 | 
			
		||||
 | 
			
		||||
			useTimer = !(info.flags & SDL_RENDERER_PRESENTVSYNC) || mode.refresh_rate != TIC_FRAMERATE;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		while (!studio.quitFlag)
 | 
			
		||||
@@ -2767,7 +2771,7 @@ s32 main(s32 argc, char **argv)
 | 
			
		||||
			nextTick += Delta;
 | 
			
		||||
			tick();
 | 
			
		||||
 | 
			
		||||
			if(SDL_GetWindowFlags(studio.window) & SDL_WINDOW_MINIMIZED || noVsync)
 | 
			
		||||
			if(SDL_GetWindowFlags(studio.window) & SDL_WINDOW_MINIMIZED || useTimer)
 | 
			
		||||
			{
 | 
			
		||||
				s64 delay = nextTick - SDL_GetPerformanceCounter();
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user