Commit 82817c9a by Ian Elliott Committed by Commit Bot

Reimplement WindowSurfaceVkAndroid::getCurrentWindowSize()

Use vkGetPhysicalDeviceSurfaceCapabilitiesKHR() instead of ANativeWindow_getWidth() & ANativeWindow_getHeight(). The former gives the proper size of the window, where the latter gives the size of the device's display (which is the default size of a window). Bug: b/168327817 Change-Id: I524116b7b07bf2ec7637fe2874806c5eb8318171 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2464920Reviewed-by: 's avatarTim Van Patten <timvp@google.com> Reviewed-by: 's avatarCourtney Goeltzenleuchter <courtneygo@google.com> Commit-Queue: Ian Elliott <ianelliott@google.com>
parent 4c9f892f
...@@ -37,11 +37,12 @@ angle::Result WindowSurfaceVkAndroid::createSurfaceVk(vk::Context *context, gl:: ...@@ -37,11 +37,12 @@ angle::Result WindowSurfaceVkAndroid::createSurfaceVk(vk::Context *context, gl::
angle::Result WindowSurfaceVkAndroid::getCurrentWindowSize(vk::Context *context, angle::Result WindowSurfaceVkAndroid::getCurrentWindowSize(vk::Context *context,
gl::Extents *extentsOut) gl::Extents *extentsOut)
{ {
int32_t width = ANativeWindow_getWidth(mNativeWindowType); RendererVk *renderer = context->getRenderer();
int32_t height = ANativeWindow_getHeight(mNativeWindowType); const VkPhysicalDevice &physicalDevice = renderer->getPhysicalDevice();
ANGLE_VK_CHECK(context, width > 0 && height > 0, VK_ERROR_INITIALIZATION_FAILED); VkSurfaceCapabilitiesKHR surfaceCaps;
ANGLE_VK_TRY(context,
*extentsOut = gl::Extents(width, height, 1); vkGetPhysicalDeviceSurfaceCapabilitiesKHR(physicalDevice, mSurface, &surfaceCaps));
*extentsOut = gl::Extents(surfaceCaps.currentExtent.width, surfaceCaps.currentExtent.height, 1);
return angle::Result::Continue; return angle::Result::Continue;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment