fix swap profile
authorhgn <hgodden00@gmail.com>
Fri, 5 Jan 2024 03:45:58 +0000 (03:45 +0000)
committerhgn <hgodden00@gmail.com>
Fri, 5 Jan 2024 03:45:58 +0000 (03:45 +0000)
vg.h

diff --git a/vg.h b/vg.h
index 2f6f340ac31d82078d02f53144f39f8e09437b8f..987ed73f7d3504c9785bfe9a67fe6447bde44e95 100644 (file)
--- a/vg.h
+++ b/vg.h
@@ -639,11 +639,14 @@ static void _vg_gameloop(void){
 
       vg_changevsync();
 
 
       vg_changevsync();
 
-      vg_profile_begin( &vg_prof_swap );
+      enum engine_status status = _vg_engine_status();
+      if( status == k_engine_status_running )
+         vg_profile_begin( &vg_prof_swap );
+
       SDL_GL_SwapWindow( vg.window );
       SDL_GL_SwapWindow( vg.window );
-      vg_profile_end( &vg_prof_swap );
 
 
-      enum engine_status status = _vg_engine_status();
+      if( status == k_engine_status_running )
+         vg_profile_end( &vg_prof_swap );
 
       vg.time_real += vg.time_frame_delta;
       vg.time_delta = vg.time_frame_delta * vg.time_rate;
 
       vg.time_real += vg.time_frame_delta;
       vg.time_delta = vg.time_frame_delta * vg.time_rate;