mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
Revert "internal/graphicsdriver/metal: Bug fix: Vsync didn't work on macOS"
This reverts commit 1dd13ae06e
.
Reason: This caused FPS drop on macOS 12.0.1
Updates #1885
Closes #1939
This commit is contained in:
parent
d1a5a161d7
commit
1b498a03cc
@ -17,24 +17,11 @@
|
|||||||
|
|
||||||
package metal
|
package metal
|
||||||
|
|
||||||
// #cgo CFLAGS: -x objective-c
|
|
||||||
// #cgo LDFLAGS: -framework Foundation
|
|
||||||
//
|
|
||||||
// #import <Foundation/Foundation.h>
|
|
||||||
//
|
|
||||||
// static int getMacOSMajorVersion() {
|
|
||||||
// NSOperatingSystemVersion version = [[NSProcessInfo processInfo] operatingSystemVersion];
|
|
||||||
// return (int)version.majorVersion;
|
|
||||||
// }
|
|
||||||
import "C"
|
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/hajimehoshi/ebiten/v2/internal/graphicsdriver/metal/mtl"
|
"github.com/hajimehoshi/ebiten/v2/internal/graphicsdriver/metal/mtl"
|
||||||
"github.com/hajimehoshi/ebiten/v2/internal/graphicsdriver/metal/ns"
|
"github.com/hajimehoshi/ebiten/v2/internal/graphicsdriver/metal/ns"
|
||||||
)
|
)
|
||||||
|
|
||||||
var macOSMajorVersion = int(C.getMacOSMajorVersion())
|
|
||||||
|
|
||||||
func (v *view) setWindow(window uintptr) {
|
func (v *view) setWindow(window uintptr) {
|
||||||
// NSView can be updated e.g., fullscreen-state is switched.
|
// NSView can be updated e.g., fullscreen-state is switched.
|
||||||
v.window = window
|
v.window = window
|
||||||
@ -57,12 +44,6 @@ func (v *view) update() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (v *view) usePresentsWithTransaction() bool {
|
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).
|
// Disable presentsWithTransaction on the fullscreen mode (#1745).
|
||||||
return !v.vsyncDisabled
|
return !v.vsyncDisabled
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user