metal and moltenvk: fix highdpi.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
diff --git a/src/render/metal/SDL_render_metal.m b/src/render/metal/SDL_render_metal.m
index 39c8934..61b018a 100644
--- a/src/render/metal/SDL_render_metal.m
+++ b/src/render/metal/SDL_render_metal.m
@@ -563,9 +563,6 @@ static int
METAL_GetOutputSize(SDL_Renderer * renderer, int *w, int *h)
{ @autoreleasepool {
METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata;
- // !!! FIXME: We shouldn't need ActivateRenderer, but drawableSize is 0
- // in the first frame without it.
- METAL_ActivateRenderer(renderer);
if (w) {
*w = (int)data.mtllayer.drawableSize.width;
}
diff --git a/src/video/cocoa/SDL_cocoametalview.m b/src/video/cocoa/SDL_cocoametalview.m
index 8078803..b430cea 100644
--- a/src/video/cocoa/SDL_cocoametalview.m
+++ b/src/video/cocoa/SDL_cocoametalview.m
@@ -61,11 +61,12 @@
useHighDPI:(bool)useHighDPI
{
if ((self = [super initWithFrame:frame])) {
-
+ self.wantsLayer = YES;
+
/* Allow resize. */
self.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
_tag = METALVIEW_TAG;
-
+
_useHighDPI = useHighDPI;
[self updateDrawableSize];
}
@@ -100,8 +101,6 @@ Cocoa_Mtl_AddMetalView(SDL_Window* window)
SDL_cocoametalview *metalview
= [[SDL_cocoametalview alloc] initWithFrame:view.frame
useHighDPI:(window->flags & SDL_WINDOW_ALLOW_HIGHDPI)];
- // Instantiate the CAMetalLayer
- metalview.wantsLayer = YES;
[view addSubview:metalview];
return metalview;
}