diff options
| author | Charles Giessen <charles@lunarg.com> | 2025-04-08 15:56:08 -0500 |
|---|---|---|
| committer | Charles Giessen <46324611+charles-lunarg@users.noreply.github.com> | 2025-04-11 15:13:14 -0600 |
| commit | 5394fd5dd5edbd3d14e263b7883a40c2193ee296 (patch) | |
| tree | d21881e1a9a77c97721d9a4224575abc049a1ad2 | |
| parent | 555dca10345cc87918876ff8c55805e54014b6ac (diff) | |
| download | usermoji-5394fd5dd5edbd3d14e263b7883a40c2193ee296.tar.xz | |
cube: Only count non-minimized frames
| -rw-r--r-- | cube/cube.c | 32 | ||||
| -rw-r--r-- | 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<WsiPlatform::win32>() { } draw(); - curFrame++; + if (!is_minimized) { + curFrame++; + } if (frameCount != UINT32_MAX && curFrame == frameCount) { PostQuitMessage(validation_error); @@ -3231,7 +3233,9 @@ void Demo::run<WsiPlatform::xlib>() { } draw(); - curFrame++; + if (!is_minimized) { + curFrame++; + } if (frameCount != UINT32_MAX && curFrame == frameCount) { quit = true; @@ -3302,7 +3306,9 @@ void Demo::run<WsiPlatform::xcb>() { } draw(); - curFrame++; + if (!is_minimized) { + curFrame++; + } if (frameCount != UINT32_MAX && curFrame == frameCount) { quit = true; } @@ -3352,7 +3358,9 @@ void Demo::run<WsiPlatform::wayland>() { } 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<WsiPlatform::directfb>() { 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<WsiPlatform::directfb>() { template <> void Demo::run<WsiPlatform::metal>() { draw(); - curFrame++; + if (!is_minimized) { + curFrame++; + } if (frameCount != UINT32_MAX && curFrame == frameCount) { quit = true; } @@ -3730,7 +3742,9 @@ void Demo::run<WsiPlatform::qnx>() { } 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<WsiPlatform::fuchsia_display>() { draw(); - curFrame++; + if (!is_minimized) { + curFrame++; + } elapsed_frames++; if (frameCount != UINT32_MAX && curFrame == frameCount) { |
