iOS: Fix CAMetalLayer nativeScale confusion (#17225)

This commit is contained in:
Eric Warmenhoven 2024-12-02 10:52:38 -05:00 committed by GitHub
parent 6475791e07
commit 4d335c4855
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 3 deletions

View File

@ -131,8 +131,7 @@ static void cocoa_vk_gfx_ctx_get_video_size(void *data,
unsigned* width, unsigned* height)
{
float screenscale = cocoa_screen_get_native_scale();
MTKView *g_view = apple_platform.renderView;
CGRect size = g_view.bounds;
CGRect size = [apple_platform.renderView bounds];
*width = CGRectGetWidth(size) * screenscale;
*height = CGRectGetHeight(size) * screenscale;
}

View File

@ -527,7 +527,7 @@ enum
- (void)setupMetalLayer {
self.metalLayer.device = MTLCreateSystemDefaultDevice();
self.metalLayer.contentsScale = [UIScreen mainScreen].scale;
self.metalLayer.contentsScale = [UIScreen mainScreen].nativeScale;
self.metalLayer.opaque = YES;
}