metal and moltenvk: fix highdpi.
authorAlex Szpakowski <slime73@gmail.com>
Tue, 02 Jan 2018 21:44:28 -0400
changeset 118094b858abfb24d
parent 11808 510c0e047122
child 11810 30acd4dcfdb6
metal and moltenvk: fix highdpi.
src/render/metal/SDL_render_metal.m
src/video/cocoa/SDL_cocoametalview.m
     1.1 --- a/src/render/metal/SDL_render_metal.m	Tue Jan 02 19:06:14 2018 -0400
     1.2 +++ b/src/render/metal/SDL_render_metal.m	Tue Jan 02 21:44:28 2018 -0400
     1.3 @@ -563,9 +563,6 @@
     1.4  METAL_GetOutputSize(SDL_Renderer * renderer, int *w, int *h)
     1.5  { @autoreleasepool {
     1.6      METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata;
     1.7 -    // !!! FIXME: We shouldn't need ActivateRenderer, but drawableSize is 0
     1.8 -    // in the first frame without it.
     1.9 -    METAL_ActivateRenderer(renderer);
    1.10      if (w) {
    1.11          *w = (int)data.mtllayer.drawableSize.width;
    1.12      }
     2.1 --- a/src/video/cocoa/SDL_cocoametalview.m	Tue Jan 02 19:06:14 2018 -0400
     2.2 +++ b/src/video/cocoa/SDL_cocoametalview.m	Tue Jan 02 21:44:28 2018 -0400
     2.3 @@ -61,11 +61,12 @@
     2.4                     useHighDPI:(bool)useHighDPI
     2.5  {
     2.6  	if ((self = [super initWithFrame:frame])) {
     2.7 -    
     2.8 +        self.wantsLayer = YES;
     2.9 +
    2.10          /* Allow resize. */
    2.11          self.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
    2.12          _tag = METALVIEW_TAG;
    2.13 -      
    2.14 +
    2.15          _useHighDPI = useHighDPI;
    2.16          [self updateDrawableSize];
    2.17  	}
    2.18 @@ -100,8 +101,6 @@
    2.19      SDL_cocoametalview *metalview
    2.20          = [[SDL_cocoametalview alloc] initWithFrame:view.frame
    2.21                         useHighDPI:(window->flags & SDL_WINDOW_ALLOW_HIGHDPI)];
    2.22 -    // Instantiate the CAMetalLayer
    2.23 -    metalview.wantsLayer = YES;
    2.24      [view addSubview:metalview];
    2.25      return metalview;
    2.26  }