feat: pause Metal renderer and graph when app is in background

This commit is contained in:
Acaki committed 2025-08-25 00:42:01 +08:00
1 parent a2c4d440db
commit c8f61b0b87
5 files changed
+98 -19

No files matched your search

+6
View File
@@ -128,6 +128,12 @@
- (void)drawInMTKView:(MTKView *)view
{
#if !defined(IMGUI_DISABLE)
// Don't render if app is in background to avoid GPU submission errors
// Allow rendering when inactive (control center, notifications)
if ([[UIApplication sharedApplication] applicationState] == UIApplicationStateBackground) {
return;
}
ImGuiIO &io = ImGui::GetIO();
io.DisplaySize.x = view.bounds.size.width;
io.DisplaySize.y = view.bounds.size.height;