瀏覽代碼

Recreate the Vulkan GPU swap chain when resuming on Android

Fixes https://github.com/libsdl-org/SDL/issues/12957
Sam Lantinga 2 天之前
父節點
當前提交
2a92a3c9c5
共有 1 個文件被更改,包括 7 次插入0 次删除
  1. 7 0
      src/gpu/vulkan/SDL_gpu_vulkan.c

+ 7 - 0
src/gpu/vulkan/SDL_gpu_vulkan.c

@@ -9703,6 +9703,13 @@ static bool VULKAN_INTERNAL_OnWindowResize(void *userdata, SDL_Event *e)
         data->swapchainCreateHeight = e->window.data2;
         data->swapchainCreateHeight = e->window.data2;
     }
     }
 
 
+#ifdef SDL_PLATFORM_ANDROID
+    if (e->type == SDL_EVENT_DID_ENTER_BACKGROUND) {
+        data = VULKAN_INTERNAL_FetchWindowData(w);
+        data->needsSwapchainRecreate = true;
+    }
+#endif
+
     return true;
     return true;
 }
 }