Merge pull request #20011 from hrydgard/mac-dpi-fix

macOS SDL: Set the metal layer resolution properly, remove DPI hacks.
This commit is contained in:
Henrik Rydgård 2025-02-20 14:59:31 -06:00 committed by GitHub
commit dc73e20bd7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 14 deletions

View file

@ -17,6 +17,7 @@ void *makeWindowMetalCompatible(void *window) {
if (![view.layer isKindOfClass:[CAMetalLayer class]])
{
[view setLayer:[CAMetalLayer layer]];
[[view layer] setContentsScale:[window backingScaleFactor]];
}
return view.layer;
#else

View file

@ -185,8 +185,8 @@ static void StopSDLAudioDevice() {
}
static void UpdateScreenDPI(SDL_Window *window) {
int drawable_width, window_width;
SDL_GetWindowSize(window, &window_width, NULL);
int drawable_width, window_width, window_height;
SDL_GetWindowSize(window, &window_width, &window_height);
if (g_Config.iGPUBackend == (int)GPUBackend::OPENGL)
SDL_GL_GetDrawableSize(window, &drawable_width, NULL);
@ -200,13 +200,6 @@ static void UpdateScreenDPI(SDL_Window *window) {
// Round up a little otherwise there would be a gap sometimes
// in fractional scaling
g_DesktopDPI = ((float) drawable_width + 1.0f) / window_width;
// Temporary hack
#if PPSSPP_PLATFORM(MAC) || PPSSPP_PLATFORM(IOS)
if (g_Config.iGPUBackend == (int)GPUBackend::VULKAN) {
g_DesktopDPI = 1.0f;
}
#endif
}
// Simple implementations of System functions
@ -1438,11 +1431,6 @@ int main(int argc, char *argv[]) {
}
#endif
}
#if PPSSPP_PLATFORM(MAC) || PPSSPP_PLATFORM(IOS)
if (g_Config.iGPUBackend == (int)GPUBackend::VULKAN) {
g_ForcedDPI = 1.0f;
}
#endif
UpdateScreenDPI(window);