Fix Vulkan orientation during screne rotations
authorGreg Daniel <egdaniel@google.com>
Thu, 6 Oct 2016 17:57:57 +0000 (13:57 -0400)
committerSkia Commit-Bot <skia-commit-bot@chromium.org>
Thu, 6 Oct 2016 18:57:23 +0000 (18:57 +0000)
This will fix the Vulkan orientation when the screen is rotated by having
the compositor do the corrections for us. However, it is suggested in the
Android Vulkan docs that for power reasons it may be better for the app
to get the needed rotation off of the VkAndroidSurface and then manually
adjust for this rotation in the rendering without the compositor doing any
corrections. This is something we can look into a later date as it would
require sending some info back from the VulkanWindowContext back to Skia
about what Matrix should be applied.

BUG=skia:

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=3052

Change-Id: I4d3d620ffcc77e607fce8d06b869c2912a61400c
Reviewed-on: https://skia-review.googlesource.com/3052
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>

tools/viewer/sk_app/VulkanWindowContext.cpp

index 8d7dcee..dc93623 100644 (file)
@@ -220,7 +220,7 @@ bool VulkanWindowContext::createSwapchain(int width, int height,
         swapchainCreateInfo.pQueueFamilyIndices = nullptr;
     }
 
-    swapchainCreateInfo.preTransform = caps.currentTransform;;
+    swapchainCreateInfo.preTransform = VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR;
     swapchainCreateInfo.compositeAlpha = composite_alpha;
     swapchainCreateInfo.presentMode = mode;
     swapchainCreateInfo.clipped = true;