From dc87eb6768d5b3e3f6e9f32ffe246ad84a3af904 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Fri, 2 Feb 2024 16:06:36 -0800 Subject: [PATCH] [Impeller] Fix blown stack due to always out of date window dimensions on high-dpi devices. (flutter/engine#50307) This regression was introduced in https://github.com/flutter/engine/commit/0682efb50f35fd240a9ba7bc64b6f621ddbdd767 which made it so that the updated surface size would be provided to the swapchain impl out-of-band instead of being inferred from the surface properties (to avoid a lag between the reports of the two). However, the playgrounds used the window size to report the updated size. This is fine where the window scale is 1. But fails on high-dpi devices. The patch replaces the call to get the window size with an equivalent call to get the framebuffer size. The failure was a blown stack due to a new swapchain impl being created over and over again because the size was always out of date. Fixes https://github.com/flutter/flutter/issues/142833 --- .../impeller/playground/backend/vulkan/playground_impl_vk.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/src/flutter/impeller/playground/backend/vulkan/playground_impl_vk.cc b/engine/src/flutter/impeller/playground/backend/vulkan/playground_impl_vk.cc index c6e4511ecd..225b86c826 100644 --- a/engine/src/flutter/impeller/playground/backend/vulkan/playground_impl_vk.cc +++ b/engine/src/flutter/impeller/playground/backend/vulkan/playground_impl_vk.cc @@ -158,8 +158,8 @@ std::unique_ptr PlaygroundImplVK::AcquireSurfaceFrame( int width = 0; int height = 0; - ::glfwGetWindowSize(reinterpret_cast(handle_.get()), &width, - &height); + ::glfwGetFramebufferSize(reinterpret_cast(handle_.get()), &width, + &height); size_ = ISize{width, height}; surface_context_vk->UpdateSurfaceSize(ISize{width, height});