main.c: proper fix for render frame drops
This commit is contained in:
parent
35b7c23d27
commit
71292a1995
@ -144,8 +144,11 @@ static void main_loop(void) {
|
||||
}
|
||||
|
||||
/* finally, let's get to work */
|
||||
int frames = 0;
|
||||
while (ctx.frame_accumulator >= ctx.desired_frametime * ctx.update_multiplicity) {
|
||||
frames += 1;
|
||||
for (size_t i = 0; i < ctx.update_multiplicity; ++i) {
|
||||
/* TODO: disable rendering pushes on not-last ? */
|
||||
render_queue_clear();
|
||||
|
||||
poll_events();
|
||||
@ -163,10 +166,12 @@ static void main_loop(void) {
|
||||
ctx.frame_accumulator -= ctx.desired_frametime;
|
||||
ctx.tick_count = (ctx.tick_count % ULLONG_MAX) + 1;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (frames != 0)
|
||||
render();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static bool initialize(void) {
|
||||
|
Loading…
Reference in New Issue
Block a user