Skip to content

Commit

Permalink
[VK] Fix swap-chain orientation.
Browse files Browse the repository at this point in the history
Prefer identity transformation (VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR) and only use "currentTransform" if identity is not supported.
  • Loading branch information
LukasBanana committed Sep 22, 2024
1 parent 7a5f9f9 commit c66d632
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion sources/Renderer/Vulkan/VKSwapChain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,12 @@ void VKSwapChain::CreateSwapChain(const Extent2D& resolution, std::uint32_t vsyn
createInfo.pQueueFamilyIndices = nullptr;
}

createInfo.preTransform = surfaceSupportDetails_.caps.currentTransform;
/* Prefer identity transformation */
if ((surfaceSupportDetails_.caps.supportedTransforms & VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR) != 0)
createInfo.preTransform = VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR;
else
createInfo.preTransform = surfaceSupportDetails_.caps.currentTransform;

createInfo.compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR;
createInfo.presentMode = presentMode;
createInfo.clipped = VK_TRUE;
Expand Down

0 comments on commit c66d632

Please sign in to comment.