From d42182befc9a5e449cb6a8ea4002b6026b9aa500 Mon Sep 17 00:00:00 2001 From: Swung0x48 Date: Mon, 23 Feb 2026 23:12:22 +0800 Subject: [PATCH] [Fix] (MG_Backend/DirectVulkan): swap swapchain width/height on 90/270 rotation --- .../MG_Backend/DirectVulkan/Renderer/SwapchainObject.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/MobileGL/MG_Backend/DirectVulkan/Renderer/SwapchainObject.cpp b/MobileGL/MG_Backend/DirectVulkan/Renderer/SwapchainObject.cpp index c62df4eb..da293e70 100644 --- a/MobileGL/MG_Backend/DirectVulkan/Renderer/SwapchainObject.cpp +++ b/MobileGL/MG_Backend/DirectVulkan/Renderer/SwapchainObject.cpp @@ -127,6 +127,11 @@ namespace MobileGL::MG_Backend::DirectVulkan { createInfo.imageFormat = pickedSurfaceFormat.format; createInfo.imageColorSpace = pickedSurfaceFormat.colorSpace; createInfo.imageExtent = swapchainCaps.currentExtent; + if (swapchainCaps.currentTransform == VK_SURFACE_TRANSFORM_ROTATE_90_BIT_KHR || + swapchainCaps.currentTransform == VK_SURFACE_TRANSFORM_ROTATE_270_BIT_KHR) { + std::swap(createInfo.imageExtent.width, createInfo.imageExtent.height); + } + createInfo.imageArrayLayers = 1; const VkImageUsageFlags requiredImageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT;