From 3d3870982c9ab19fa2cf9cf2334a45df26304a9a Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Sun, 27 May 2018 20:30:03 -0400 Subject: [PATCH] metal: contrary to documentation, we need to set the drawableSize explicitly. Fixes Bugzilla #4149. --- src/video/cocoa/SDL_cocoametalview.m | 7 +++---- src/video/uikit/SDL_uikitmetalview.m | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/video/cocoa/SDL_cocoametalview.m b/src/video/cocoa/SDL_cocoametalview.m index e9c08a007..f28b74362 100644 --- a/src/video/cocoa/SDL_cocoametalview.m +++ b/src/video/cocoa/SDL_cocoametalview.m @@ -66,11 +66,10 @@ /* Allow resize. */ self.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable; - /* Set the desired scale. The default drawableSize of a CAMetalLayer - * is its bounds x its scale so nothing further needs to be done. - */ + /* Set the desired scale. */ + ((CAMetalLayer *) self.layer).drawableSize = NSSizeToCGSize([self bounds].size); self.layer.contentsScale = scale; - } + } return self; } diff --git a/src/video/uikit/SDL_uikitmetalview.m b/src/video/uikit/SDL_uikitmetalview.m index 63adf7cd8..fd94300d0 100644 --- a/src/video/uikit/SDL_uikitmetalview.m +++ b/src/video/uikit/SDL_uikitmetalview.m @@ -49,8 +49,8 @@ { if ((self = [super initWithFrame:frame])) { self.tag = METALVIEW_TAG; - /* Set the desired scale. The default drawableSize of a CAMetalLayer - * is its bounds x its scale so nothing further needs to be done. */ + /* Set the desired scale. */ + ((CAMetalLayer *) self.layer).drawableSize = self.bounds.size; self.layer.contentsScale = scale; }