From 774480ba234c788d2973cf6a3ccd1cd4c3fcc673 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sat, 26 Jan 2019 00:02:02 +1000 Subject: [PATCH] Vulkan: Set contents scale of Metal layer to screen factor This gives us a native resolution framebuffer. --- Source/Core/VideoBackends/Vulkan/main.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Source/Core/VideoBackends/Vulkan/main.cpp b/Source/Core/VideoBackends/Vulkan/main.cpp index af3a7b56d8..53c04c4e37 100644 --- a/Source/Core/VideoBackends/Vulkan/main.cpp +++ b/Source/Core/VideoBackends/Vulkan/main.cpp @@ -303,6 +303,18 @@ void VideoBackend::PrepareWindow(const WindowSystemInfo& wsi) // [view setLayer:layer] reinterpret_cast(objc_msgSend)(view, sel_getUid("setLayer:"), layer); + + // NSScreen* screen = [NSScreen mainScreen] + id screen = reinterpret_cast(objc_msgSend)(objc_getClass("NSScreen"), + sel_getUid("mainScreen")); + + // CGFloat factor = [screen backingScaleFactor] + double factor = + reinterpret_cast(objc_msgSend)(screen, sel_getUid("backingScaleFactor")); + + // layer.contentsScale = factor + reinterpret_cast(objc_msgSend)(layer, sel_getUid("setContentsScale:"), + factor); #endif } } // namespace Vulkan