File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2420,8 +2420,22 @@ static void PrintAllocatorStats()
24202420#endif
24212421}
24222422
2423+ static bool IsWindowMinimizedOrZeroSized ()
2424+ {
2425+ if ((g_hWnd == NULL ) || IsIconic (g_hWnd))
2426+ return true ;
2427+
2428+ RECT clientRect = {};
2429+ GetClientRect (g_hWnd, &clientRect);
2430+ return clientRect.right <= clientRect.left
2431+ || clientRect.bottom <= clientRect.top ;
2432+ }
2433+
24232434static void RecreateSwapChain ()
24242435{
2436+ if (IsWindowMinimizedOrZeroSized ())
2437+ return ;
2438+
24252439 vkDeviceWaitIdle (g_hDevice);
24262440 DestroySwapchain (false );
24272441 CreateSwapchain ();
@@ -2738,10 +2752,10 @@ int MainWindow()
27382752 TranslateMessage (&msg);
27392753 DispatchMessage (&msg);
27402754 }
2755+ else if (IsWindowMinimizedOrZeroSized ())
2756+ Sleep (25 );
27412757 else
2742- {
27432758 DrawFrame ();
2744- }
27452759 }
27462760
27472761 return (int )msg.wParam ;;
You can’t perform that action at this time.
0 commit comments