From 5394fd5dd5edbd3d14e263b7883a40c2193ee296 Mon Sep 17 00:00:00 2001 From: Charles Giessen Date: Tue, 8 Apr 2025 15:56:08 -0500 Subject: cube: Only count non-minimized frames --- cube/cube.c | 32 ++++++++++++++++++++++++-------- cube/cube.cpp | 32 ++++++++++++++++++++++++-------- 2 files changed, 48 insertions(+), 16 deletions(-) diff --git a/cube/cube.c b/cube/cube.c index 9e58ea36..e424836d 100644 --- a/cube/cube.c +++ b/cube/cube.c @@ -2656,7 +2656,9 @@ static void demo_run(struct demo *demo) { if (!demo->prepared) return; demo_draw(demo); - demo->curFrame++; + if (demo->is_minimized) { + demo->curFrame++; + } if (demo->frameCount != INT32_MAX && demo->curFrame == demo->frameCount) { PostQuitMessage(validation_error); } @@ -2844,7 +2846,9 @@ static void demo_run_xlib(struct demo *demo) { } demo_draw(demo); - demo->curFrame++; + if (demo->is_minimized) { + demo->curFrame++; + } if (demo->frameCount != INT32_MAX && demo->curFrame == demo->frameCount) demo->quit = true; } } @@ -2910,7 +2914,9 @@ static void demo_run_xcb(struct demo *demo) { } demo_draw(demo); - demo->curFrame++; + if (demo->is_minimized) { + demo->curFrame++; + } if (demo->frameCount != INT32_MAX && demo->curFrame == demo->frameCount) demo->quit = true; } } @@ -2969,7 +2975,9 @@ static void demo_run(struct demo *demo) { wl_display_dispatch_pending(demo->wayland_display); demo_draw(demo); - demo->curFrame++; + if (demo->is_minimized) { + demo->curFrame++; + } if (demo->frameCount != INT32_MAX && demo->curFrame == demo->frameCount) demo->quit = true; } } @@ -3115,7 +3123,9 @@ static void demo_run_directfb(struct demo *demo) { if (!demo->event_buffer->GetEvent(demo->event_buffer, DFB_EVENT(&event))) demo_handle_directfb_event(demo, &event); demo_draw(demo); - demo->curFrame++; + if (demo->is_minimized) { + demo->curFrame++; + } if (demo->frameCount != INT32_MAX && demo->curFrame == demo->frameCount) demo->quit = true; } } @@ -3126,13 +3136,17 @@ static void demo_run(struct demo *demo) { if (!demo->prepared) return; demo_draw(demo); - demo->curFrame++; + if (demo->is_minimized) { + demo->curFrame++; + } } #endif #if defined(VK_USE_PLATFORM_METAL_EXT) static void demo_run(struct demo *demo) { demo_draw(demo); - demo->curFrame++; + if (demo->is_minimized) { + demo->curFrame++; + } if (demo->frameCount != INT32_MAX && demo->curFrame == demo->frameCount) { demo->quit = TRUE; } @@ -3377,7 +3391,9 @@ static void demo_run(struct demo *demo) { if (demo->pause) { } else { demo_draw(demo); - demo->curFrame++; + if (demo->is_minimized) { + demo->curFrame++; + } if (demo->frameCount != INT32_MAX && demo->curFrame == demo->frameCount) { demo->quit = true; } diff --git a/cube/cube.cpp b/cube/cube.cpp index 1d462b0e..24f7b3f0 100644 --- a/cube/cube.cpp +++ b/cube/cube.cpp @@ -3081,7 +3081,9 @@ void Demo::run() { } draw(); - curFrame++; + if (!is_minimized) { + curFrame++; + } if (frameCount != UINT32_MAX && curFrame == frameCount) { PostQuitMessage(validation_error); @@ -3231,7 +3233,9 @@ void Demo::run() { } draw(); - curFrame++; + if (!is_minimized) { + curFrame++; + } if (frameCount != UINT32_MAX && curFrame == frameCount) { quit = true; @@ -3302,7 +3306,9 @@ void Demo::run() { } draw(); - curFrame++; + if (!is_minimized) { + curFrame++; + } if (frameCount != UINT32_MAX && curFrame == frameCount) { quit = true; } @@ -3352,7 +3358,9 @@ void Demo::run() { } else { wl_display_dispatch_pending(wayland_display); draw(); - curFrame++; + if (!is_minimized) { + curFrame++; + } if (frameCount != UINT32_MAX && curFrame == frameCount) { quit = true; } @@ -3465,7 +3473,9 @@ void Demo::run() { if (!event_buffer->GetEvent(event_buffer, DFB_EVENT(&event))) handle_directfb_event(&event); draw(); - curFrame++; + if (!is_minimized) { + curFrame++; + } if (frameCount != UINT32_MAX && curFrame == frameCount) { quit = true; } @@ -3515,7 +3525,9 @@ void Demo::create_window() { template <> void Demo::run() { draw(); - curFrame++; + if (!is_minimized) { + curFrame++; + } if (frameCount != UINT32_MAX && curFrame == frameCount) { quit = true; } @@ -3730,7 +3742,9 @@ void Demo::run() { } else { update_data_buffer(); draw(); - curFrame++; + if (!is_minimized) { + curFrame++; + } if (frameCount != UINT32_MAX && curFrame == frameCount) { quit = true; } @@ -3900,7 +3914,9 @@ void Demo::run() { draw(); - curFrame++; + if (!is_minimized) { + curFrame++; + } elapsed_frames++; if (frameCount != UINT32_MAX && curFrame == frameCount) { -- cgit v1.2.3