Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Engine/gapi/vulkan/vswapchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,8 @@ VkResult VSwapchain::createSwapchain(VDevice& device, const SwapChainSupport& sw
}

createInfo.preTransform = swapChainSupport.capabilities.currentTransform;
if(swapChainSupport.capabilities.supportedTransforms & VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR)
createInfo.preTransform = VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should it be just VkSurfaceTransformFlagBitsKHR(0) in all cases?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 isn’t valid here; identity is VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR (1). We can remove the Android guard and prefer identity on all platforms, while retaining the supported-transform check and fallback.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Base on this guide here: https://docs.vulkan.org/samples/latest/samples/performance/surface_rotation/README.html
0 allowed.

Or more exact wording:

Ignore the preTransform field in VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR. This will not match the value returned by vkGetPhysicalDeviceSurfaceCapabilitiesKHR and therefore the Android Compositor will rotate the scene before presenting it to the display

Basically, as long as we letting composer do it's job we good.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed on letting the compositor handle rotation. The linked sample uses VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR, not 0. I can remove the Android guard and use that selection across platforms, keeping the supported-transform check.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can remove the Android guard and use that selection across platforms, keeping the supported-transform check.

Sounds good: VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR by default, if possible and currentTransform otherwise

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated as suggested: prefer VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR when supported, otherwise use currentTransform. Removed the Android guard.

createInfo.compositeAlpha = alphaMode;
createInfo.presentMode = presentMode;
createInfo.clipped = VK_FALSE;
Expand Down
Loading