compute frame time before syncing to avoid div-by-zero in first frame

Fri, 13 Jun 2025 17:45:19 +0200

author
Mike Becker <universe@uap-core.de>
date
Fri, 13 Jun 2025 17:45:19 +0200
changeset 147
4908cc6c2e01
parent 146
bd62381be983
child 148
9f030f402699

compute frame time before syncing to avoid div-by-zero in first frame

src/context.c file | annotate | diff | comparison | revisions
--- a/src/context.c	Fri Jun 13 17:06:10 2025 +0200
+++ b/src/context.c	Fri Jun 13 17:45:19 2025 +0200
@@ -200,11 +200,6 @@
         }
     }
 
-    // sync the windows
-    for (unsigned int i = 0 ; i < ASC_MAX_WINDOWS ; i++) {
-        asc_window_sync(i);
-    }
-
     // compute frame time
     uint64_t frame_nanos, ns;
     do {
@@ -214,6 +209,11 @@
     asc_context.frame_nanos = frame_nanos;
     asc_context.total_nanos = ns;
 
+    // sync the windows
+    for (unsigned int i = 0 ; i < ASC_MAX_WINDOWS ; i++) {
+        asc_window_sync(i);
+    }
+
     return !asc_test_flag(asc_context.flags, ASC_FLAG_QUIT);
 }
 

mercurial