summaryrefslogtreecommitdiff
path: root/src/video_core
diff options
context:
space:
mode:
Diffstat (limited to 'src/video_core')
-rw-r--r--src/video_core/renderer_vulkan/vk_blit_screen.cpp47
-rw-r--r--src/video_core/renderer_vulkan/vk_swapchain.cpp5
2 files changed, 5 insertions, 47 deletions
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 @@
37#include "video_core/vulkan_common/vulkan_memory_allocator.h" 37#include "video_core/vulkan_common/vulkan_memory_allocator.h"
38#include "video_core/vulkan_common/vulkan_wrapper.h" 38#include "video_core/vulkan_common/vulkan_wrapper.h"
39 39
40#ifdef ANDROID
41extern u32 GetAndroidScreenRotation();
42#endif
43
44namespace Vulkan { 40namespace Vulkan {
45 41
46namespace { 42namespace {
@@ -78,47 +74,6 @@ struct ScreenRectVertex {
78 } 74 }
79}; 75};
80 76
81#ifdef ANDROID
82
83std::array<f32, 4 * 4> MakeOrthographicMatrix(f32 width, f32 height) {
84 constexpr u32 ROTATION_0 = 0;
85 constexpr u32 ROTATION_90 = 1;
86 constexpr u32 ROTATION_180 = 2;
87 constexpr u32 ROTATION_270 = 3;
88
89 // clang-format off
90 switch (GetAndroidScreenRotation()) {
91 case ROTATION_0:
92 // Desktop
93 return { 2.f / width, 0.f, 0.f, 0.f,
94 0.f, 2.f / height, 0.f, 0.f,
95 0.f, 0.f, 1.f, 0.f,
96 -1.f, -1.f, 0.f, 1.f};
97 case ROTATION_180:
98 // Reverse desktop
99 return {-2.f / width, 0.f, 0.f, 0.f,
100 0.f, -2.f / height, 0.f, 0.f,
101 0.f, 0.f, 1.f, 0.f,
102 1.f, 1.f, 0.f, 1.f};
103 case ROTATION_270:
104 // Reverse landscape
105 return { 0.f, -2.f / width, 0.f, 0.f,
106 2.f / height, 0.f, 0.f, 0.f,
107 0.f, 0.f, 1.f, 0.f,
108 -1.f, 1.f, 0.f, 1.f};
109 case ROTATION_90:
110 default:
111 // Landscape
112 return { 0.f, 2.f / width, 0.f, 0.f,
113 -2.f / height, 0.f, 0.f, 0.f,
114 0.f, 0.f, 1.f, 0.f,
115 1.f, -1.f, 0.f, 1.f};
116 }
117 // clang-format on
118}
119
120#else
121
122std::array<f32, 4 * 4> MakeOrthographicMatrix(f32 width, f32 height) { 77std::array<f32, 4 * 4> MakeOrthographicMatrix(f32 width, f32 height) {
123 // clang-format off 78 // clang-format off
124 return { 2.f / width, 0.f, 0.f, 0.f, 79 return { 2.f / width, 0.f, 0.f, 0.f,
@@ -128,8 +83,6 @@ std::array<f32, 4 * 4> MakeOrthographicMatrix(f32 width, f32 height) {
128 // clang-format on 83 // clang-format on
129} 84}
130 85
131#endif
132
133u32 GetBytesPerPixel(const Tegra::FramebufferConfig& framebuffer) { 86u32 GetBytesPerPixel(const Tegra::FramebufferConfig& framebuffer) {
134 using namespace VideoCore::Surface; 87 using namespace VideoCore::Surface;
135 return BytesPerBlock(PixelFormatFromGPUPixelFormat(framebuffer.pixel_format)); 88 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
231 .imageSharingMode = VK_SHARING_MODE_EXCLUSIVE, 231 .imageSharingMode = VK_SHARING_MODE_EXCLUSIVE,
232 .queueFamilyIndexCount = 0, 232 .queueFamilyIndexCount = 0,
233 .pQueueFamilyIndices = nullptr, 233 .pQueueFamilyIndices = nullptr,
234#ifdef ANDROID
235 // On Android, do not allow surface rotation to deviate from the frontend.
236 .preTransform = VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR,
237#else
234 .preTransform = capabilities.currentTransform, 238 .preTransform = capabilities.currentTransform,
239#endif
235 .compositeAlpha = alpha_flags, 240 .compositeAlpha = alpha_flags,
236 .presentMode = present_mode, 241 .presentMode = present_mode,
237 .clipped = VK_FALSE, 242 .clipped = VK_FALSE,