Browse Source

Only use VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR on Android

This fixes Nintendo Switch where the identity bit isn't available. We only needed this on Android to automatically handle device user orientation.

(cherry picked from commit 2c7c3d4d7b86921fa03b071e7f9082779480dac3)
Sam Lantinga 1 month ago
parent
commit
18d93d11e1
1 changed files with 4 additions and 0 deletions
  1. 4 0
      src/gpu/vulkan/SDL_gpu_vulkan.c

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

@@ -4634,7 +4634,11 @@ static Uint32 VULKAN_INTERNAL_CreateSwapchain(
     swapchainCreateInfo.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE;
     swapchainCreateInfo.queueFamilyIndexCount = 0;
     swapchainCreateInfo.pQueueFamilyIndices = NULL;
+#ifdef SDL_PLATFORM_ANDROID
     swapchainCreateInfo.preTransform = VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR;
+#else
+    swapchainCreateInfo.preTransform = swapchainSupportDetails.capabilities.currentTransform;
+#endif
     swapchainCreateInfo.compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR;
     swapchainCreateInfo.presentMode = SDLToVK_PresentMode[windowData->presentMode];
     swapchainCreateInfo.clipped = VK_TRUE;