From ea716eb5cc7fd568897da586c1b3aa5c3a5052ba Mon Sep 17 00:00:00 2001 From: bunnei Date: Sat, 10 Jun 2023 15:13:06 -0700 Subject: android: Fix screen orientation & blurriness. --- src/video_core/renderer_vulkan/vk_blit_screen.cpp | 47 ----------------------- src/video_core/renderer_vulkan/vk_swapchain.cpp | 5 +++ 2 files changed, 5 insertions(+), 47 deletions(-) (limited to 'src/video_core') diff --git a/src/video_core/renderer_vulkan/vk_blit_screen.cpp b/src/video_core/renderer_vulkan/vk_blit_screen.cpp index aa8e54bdc..acb143fc7 100644 --- a/src/video_core/renderer_vulkan/vk_blit_screen.cpp +++ b/src/video_core/renderer_vulkan/vk_blit_screen.cpp @@ -37,10 +37,6 @@ #include "video_core/vulkan_common/vulkan_memory_allocator.h" #include "video_core/vulkan_common/vulkan_wrapper.h" -#ifdef ANDROID -extern u32 GetAndroidScreenRotation(); -#endif - namespace Vulkan { namespace { @@ -78,47 +74,6 @@ struct ScreenRectVertex { } }; -#ifdef ANDROID - -std::array MakeOrthographicMatrix(f32 width, f32 height) { - constexpr u32 ROTATION_0 = 0; - constexpr u32 ROTATION_90 = 1; - constexpr u32 ROTATION_180 = 2; - constexpr u32 ROTATION_270 = 3; - - // clang-format off - switch (GetAndroidScreenRotation()) { - case ROTATION_0: - // Desktop - return { 2.f / width, 0.f, 0.f, 0.f, - 0.f, 2.f / height, 0.f, 0.f, - 0.f, 0.f, 1.f, 0.f, - -1.f, -1.f, 0.f, 1.f}; - case ROTATION_180: - // Reverse desktop - return {-2.f / width, 0.f, 0.f, 0.f, - 0.f, -2.f / height, 0.f, 0.f, - 0.f, 0.f, 1.f, 0.f, - 1.f, 1.f, 0.f, 1.f}; - case ROTATION_270: - // Reverse landscape - return { 0.f, -2.f / width, 0.f, 0.f, - 2.f / height, 0.f, 0.f, 0.f, - 0.f, 0.f, 1.f, 0.f, - -1.f, 1.f, 0.f, 1.f}; - case ROTATION_90: - default: - // Landscape - return { 0.f, 2.f / width, 0.f, 0.f, - -2.f / height, 0.f, 0.f, 0.f, - 0.f, 0.f, 1.f, 0.f, - 1.f, -1.f, 0.f, 1.f}; - } - // clang-format on -} - -#else - std::array MakeOrthographicMatrix(f32 width, f32 height) { // clang-format off return { 2.f / width, 0.f, 0.f, 0.f, @@ -128,8 +83,6 @@ std::array MakeOrthographicMatrix(f32 width, f32 height) { // clang-format on } -#endif - u32 GetBytesPerPixel(const Tegra::FramebufferConfig& framebuffer) { using namespace VideoCore::Surface; return BytesPerBlock(PixelFormatFromGPUPixelFormat(framebuffer.pixel_format)); diff --git a/src/video_core/renderer_vulkan/vk_swapchain.cpp b/src/video_core/renderer_vulkan/vk_swapchain.cpp index afcf34fba..d3cddac69 100644 --- a/src/video_core/renderer_vulkan/vk_swapchain.cpp +++ b/src/video_core/renderer_vulkan/vk_swapchain.cpp @@ -231,7 +231,12 @@ void Swapchain::CreateSwapchain(const VkSurfaceCapabilitiesKHR& capabilities, bo .imageSharingMode = VK_SHARING_MODE_EXCLUSIVE, .queueFamilyIndexCount = 0, .pQueueFamilyIndices = nullptr, +#ifdef ANDROID + // On Android, do not allow surface rotation to deviate from the frontend. + .preTransform = VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR, +#else .preTransform = capabilities.currentTransform, +#endif .compositeAlpha = alpha_flags, .presentMode = present_mode, .clipped = VK_FALSE, -- cgit v1.2.3