| 633 | } |
| 634 | |
| 635 | void DeviceManager::RunMessageLoop() |
| 636 | { |
| 637 | m_PreviousFrameTimestamp = glfwGetTime(); |
| 638 | |
| 639 | #if DONUT_WITH_AFTERMATH |
| 640 | bool dumpingCrash = false; |
| 641 | #endif |
| 642 | while(!glfwWindowShouldClose(m_Window)) |
| 643 | { |
| 644 | #if DONUT_WITH_STREAMLINE |
| 645 | StreamlineIntegration::Get().SimStart(*this); |
| 646 | #endif |
| 647 | if (m_callbacks.beforeFrame) m_callbacks.beforeFrame(*this, m_FrameIndex); |
| 648 | glfwPollEvents(); |
| 649 | UpdateWindowSize(); |
| 650 | bool presentSuccess = AnimateRenderPresent(); |
| 651 | if (!presentSuccess) |
| 652 | { |
| 653 | #if DONUT_WITH_AFTERMATH |
| 654 | dumpingCrash = true; |
| 655 | #endif |
| 656 | break; |
| 657 | } |
| 658 | } |
| 659 | |
| 660 | bool waitSuccess = GetDevice()->waitForIdle(); |
| 661 | #if DONUT_WITH_AFTERMATH |
| 662 | dumpingCrash |= !waitSuccess; |
| 663 | // wait for Aftermath dump to complete before exiting application |
| 664 | if (dumpingCrash && m_DeviceParams.enableAftermath) |
| 665 | AftermathCrashDump::WaitForCrashDump(); |
| 666 | #else |
| 667 | assert(waitSuccess); |
| 668 | (void)waitSuccess; |
| 669 | #endif |
| 670 | } |
| 671 | |
| 672 | bool DeviceManager::AnimateRenderPresent() |
| 673 | { |