metal: contrary to documentation, we need to set the drawableSize explicitly.
authorRyan C. Gordon <icculus@icculus.org>
Sun, 27 May 2018 20:30:03 -0400
changeset 120029116d02d3feb
parent 12001 84c2582329b0
child 12003 c606531db77b
metal: contrary to documentation, we need to set the drawableSize explicitly.

Fixes Bugzilla #4149.
src/video/cocoa/SDL_cocoametalview.m
src/video/uikit/SDL_uikitmetalview.m
     1.1 --- a/src/video/cocoa/SDL_cocoametalview.m	Thu May 24 07:30:24 2018 -0700
     1.2 +++ b/src/video/cocoa/SDL_cocoametalview.m	Sun May 27 20:30:03 2018 -0400
     1.3 @@ -66,11 +66,10 @@
     1.4          /* Allow resize. */
     1.5          self.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
     1.6  
     1.7 -        /* Set the desired scale. The default drawableSize of a CAMetalLayer
     1.8 -         * is its bounds x its scale so nothing further needs to be done.
     1.9 -         */
    1.10 +        /* Set the desired scale. */
    1.11 +        ((CAMetalLayer *) self.layer).drawableSize = NSSizeToCGSize([self bounds].size);
    1.12          self.layer.contentsScale = scale;
    1.13 -	}
    1.14 +    }
    1.15    
    1.16  	return self;
    1.17  }
     2.1 --- a/src/video/uikit/SDL_uikitmetalview.m	Thu May 24 07:30:24 2018 -0700
     2.2 +++ b/src/video/uikit/SDL_uikitmetalview.m	Sun May 27 20:30:03 2018 -0400
     2.3 @@ -49,8 +49,8 @@
     2.4  {
     2.5      if ((self = [super initWithFrame:frame])) {
     2.6          self.tag = METALVIEW_TAG;
     2.7 -        /* Set the desired scale. The default drawableSize of a CAMetalLayer
     2.8 -         * is its bounds x its scale so nothing further needs to be done. */
     2.9 +        /* Set the desired scale. */
    2.10 +        ((CAMetalLayer *) self.layer).drawableSize = self.bounds.size;
    2.11          self.layer.contentsScale = scale;
    2.12      }
    2.13