mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 02:38:53 +01:00
internal/graphicsdriver/metal: bug fix: use 2 as a drawable count for Arm Mac
Closes #2883
This commit is contained in:
parent
2ec5c788ab
commit
055db234a1
@ -83,8 +83,7 @@ func (v *view) initialize(device mtl.Device) error {
|
||||
// nextDrawable took more than one second if the window has other controls like NSTextView (#1029).
|
||||
v.ml.SetPresentsWithTransaction(false)
|
||||
|
||||
// Always use 3. There are some situations that the FPS becomes half, or the FPS becomes too low (#2880).
|
||||
v.ml.SetMaximumDrawableCount(3)
|
||||
v.ml.SetMaximumDrawableCount(v.maximumDrawableCount())
|
||||
|
||||
return nil
|
||||
}
|
||||
|
@ -64,3 +64,8 @@ const (
|
||||
storageMode = mtl.StorageModeShared
|
||||
resourceStorageMode = mtl.ResourceStorageModeShared
|
||||
)
|
||||
|
||||
func (v *view) maximumDrawableCount() int {
|
||||
// TODO: Is 2 available for iOS?
|
||||
return 3
|
||||
}
|
||||
|
@ -17,6 +17,8 @@
|
||||
package metal
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
|
||||
"github.com/ebitengine/purego/objc"
|
||||
|
||||
"github.com/hajimehoshi/ebiten/v2/internal/cocoa"
|
||||
@ -49,3 +51,13 @@ const (
|
||||
storageMode = mtl.StorageModeManaged
|
||||
resourceStorageMode = mtl.ResourceStorageModeManaged
|
||||
)
|
||||
|
||||
func (v *view) maximumDrawableCount() int {
|
||||
// Use 2 for Arm Mac (#2883).
|
||||
if runtime.GOARCH == "arm64" {
|
||||
return 2
|
||||
}
|
||||
|
||||
// Use 3 for Intel Mac and iOS. With 2, There are some situations that the FPS becomes half, or the FPS becomes too low (#2880).
|
||||
return 3
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user