Exit gracefully on VK_ERROR_DEVICE_LOST instead of spinning forever

When the GPU device is lost (unrecoverable Vulkan error), the app now
closes cleanly instead of looping with a black screen. Also adds
vk_context.hpp include for the isDeviceLost() check.
This commit is contained in:
Kelsi 2026-03-02 08:47:06 -08:00
parent b948720ec3
commit 4cd1abd5a6

View file

@ -6,6 +6,7 @@
#include "core/logger.hpp"
#include "core/memory_monitor.hpp"
#include "rendering/renderer.hpp"
#include "rendering/vk_context.hpp"
#include "audio/npc_voice_manager.hpp"
#include "rendering/camera.hpp"
#include "rendering/camera_controller.hpp"
@ -416,6 +417,12 @@ void Application::run() {
LOG_ERROR("Exception during swapBuffers: ", e.what());
throw;
}
// Exit gracefully on GPU device lost (unrecoverable)
if (renderer && renderer->getVkContext() && renderer->getVkContext()->isDeviceLost()) {
LOG_ERROR("GPU device lost — exiting application");
window->setShouldClose(true);
}
}
LOG_INFO("Main loop ended");