mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-15 10:40:01 +01:00
Merge pull request #22734 from hrydgard/vulkan-stale-extent-workaround
Android Vulkan: Bring back the stale surface extent workaround
This commit is contained in:
3 files changed
+27
No files matched your search
@@ -1556,6 +1556,21 @@ bool VulkanContext::InitSwapchain(VkPresentModeKHR desiredPresentMode) {
|
||||
}
|
||||
}
|
||||
|
||||
#if PPSSPP_PLATFORM(ANDROID)
|
||||
// After an in-place rotation, the surface can report the new transform together with the previous
|
||||
// orientation's extent. A Redmi 9A (PowerVR, Android 11) keeps doing it after surfaceChanged has given us the
|
||||
// new size, so the swapchain stays wrong until the next rotation. The latest window size from surfaceChanged
|
||||
// is current (g_display can lag behind it, until the render thread applies the resize), so if the extent is
|
||||
// exactly that transposed, it's stale.
|
||||
const VkExtent2D windowSize = cbGetDrawSize_ ? cbGetDrawSize_() : VkExtent2D{};
|
||||
if (windowSize.width > 0 && windowSize.height > 0 && windowSize.width != windowSize.height &&
|
||||
currentExtent.width == windowSize.height && currentExtent.height == windowSize.width) {
|
||||
WARN_LOG(Log::G3D, "Surface extent %dx%d is the window transposed, probably stale after a rotation. Using %dx%d.",
|
||||
currentExtent.width, currentExtent.height, windowSize.width, windowSize.height);
|
||||
std::swap(currentExtent.width, currentExtent.height);
|
||||
}
|
||||
#endif
|
||||
|
||||
swapChainExtent_.width = clamp(currentExtent.width, surfCapabilities_.minImageExtent.width, surfCapabilities_.maxImageExtent.width);
|
||||
swapChainExtent_.height = clamp(currentExtent.height, surfCapabilities_.minImageExtent.height, surfCapabilities_.maxImageExtent.height);
|
||||
|
||||
|
||||
Reference in new issue
Block a user