Skip to content
Permalink
Browse files

Vulkan: Set contents scale of Metal layer to screen factor

This gives us a native resolution framebuffer.
  • Loading branch information...
stenzek committed Jan 25, 2019
1 parent ee0fa54 commit 774480ba234c788d2973cf6a3ccd1cd4c3fcc673
Showing with 12 additions and 0 deletions.
  1. +12 −0 Source/Core/VideoBackends/Vulkan/main.cpp
@@ -303,6 +303,18 @@ void VideoBackend::PrepareWindow(const WindowSystemInfo& wsi)

// [view setLayer:layer]
reinterpret_cast<void (*)(id, SEL, id)>(objc_msgSend)(view, sel_getUid("setLayer:"), layer);

// NSScreen* screen = [NSScreen mainScreen]
id screen = reinterpret_cast<id (*)(Class, SEL)>(objc_msgSend)(objc_getClass("NSScreen"),
sel_getUid("mainScreen"));

// CGFloat factor = [screen backingScaleFactor]
double factor =
reinterpret_cast<double (*)(id, SEL)>(objc_msgSend)(screen, sel_getUid("backingScaleFactor"));

// layer.contentsScale = factor
reinterpret_cast<void (*)(id, SEL, double)>(objc_msgSend)(layer, sel_getUid("setContentsScale:"),
factor);
#endif
}
} // namespace Vulkan

0 comments on commit 774480b

Please sign in to comment.
You can’t perform that action at this time.