From 4cd1abd5a677e4e371e914fba1b9103afa1b7dc7 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Mon, 2 Mar 2026 08:47:06 -0800 Subject: [PATCH] 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. --- src/core/application.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/core/application.cpp b/src/core/application.cpp index d84ee47b..58795ce2 100644 --- a/src/core/application.cpp +++ b/src/core/application.cpp @@ -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");