From 1b498a03cc0b4cdccbac6645d5f13cd19422d738 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sun, 9 Jan 2022 01:02:53 +0900 Subject: [PATCH] Revert "internal/graphicsdriver/metal: Bug fix: Vsync didn't work on macOS" This reverts commit 1dd13ae06e2f181d728e4733895fc69a1e59a086. Reason: This caused FPS drop on macOS 12.0.1 Updates #1885 Closes #1939 --- internal/graphicsdriver/metal/view_macos.go | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/internal/graphicsdriver/metal/view_macos.go b/internal/graphicsdriver/metal/view_macos.go index 7620be8dc..5b63ded1f 100644 --- a/internal/graphicsdriver/metal/view_macos.go +++ b/internal/graphicsdriver/metal/view_macos.go @@ -17,24 +17,11 @@ package metal -// #cgo CFLAGS: -x objective-c -// #cgo LDFLAGS: -framework Foundation -// -// #import -// -// static int getMacOSMajorVersion() { -// NSOperatingSystemVersion version = [[NSProcessInfo processInfo] operatingSystemVersion]; -// return (int)version.majorVersion; -// } -import "C" - import ( "github.com/hajimehoshi/ebiten/v2/internal/graphicsdriver/metal/mtl" "github.com/hajimehoshi/ebiten/v2/internal/graphicsdriver/metal/ns" ) -var macOSMajorVersion = int(C.getMacOSMajorVersion()) - func (v *view) setWindow(window uintptr) { // NSView can be updated e.g., fullscreen-state is switched. v.window = window @@ -57,12 +44,6 @@ func (v *view) update() { } func (v *view) usePresentsWithTransaction() bool { - // On macOS 12 (or later), do not use presentsWithTransaction, or vsync doesn't work (#1885). - // This works only for Metal. Unfortunately, there is not a good solution for OpenGL. - if macOSMajorVersion >= 12 { - return false - } - // Disable presentsWithTransaction on the fullscreen mode (#1745). return !v.vsyncDisabled }