mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 10:48:53 +01:00
internal/graphicsdriver/metal: Refactoring
This commit is contained in:
parent
e98e371bb4
commit
11b9a4b161
@ -70,16 +70,8 @@ func (v *view) setFullscreen(fullscreen bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (v *view) updatePresentsWithTransaction() {
|
func (v *view) updatePresentsWithTransaction() {
|
||||||
pwt := v.usePresentsWithTransaction()
|
v.ml.SetPresentsWithTransaction(v.usePresentsWithTransaction())
|
||||||
v.ml.SetPresentsWithTransaction(pwt)
|
v.ml.SetMaximumDrawableCount(v.maximumDrawableCount())
|
||||||
|
|
||||||
// When presentsWithTransaction is YES and triple buffering is enabled, nextDrawing returns immediately once every two times.
|
|
||||||
// This makes FPS doubled. To avoid this, disable the triple buffering.
|
|
||||||
if pwt {
|
|
||||||
v.ml.SetMaximumDrawableCount(2)
|
|
||||||
} else {
|
|
||||||
v.ml.SetMaximumDrawableCount(3)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *view) colorPixelFormat() mtl.PixelFormat {
|
func (v *view) colorPixelFormat() mtl.PixelFormat {
|
||||||
|
@ -62,6 +62,10 @@ func (v *view) usePresentsWithTransaction() bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (v *view) maximumDrawableCount() int {
|
||||||
|
return 3
|
||||||
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
storageMode = mtl.StorageModeShared
|
storageMode = mtl.StorageModeShared
|
||||||
resourceStorageMode = mtl.ResourceStorageModeShared
|
resourceStorageMode = mtl.ResourceStorageModeShared
|
||||||
|
@ -48,6 +48,15 @@ func (v *view) usePresentsWithTransaction() bool {
|
|||||||
return !v.vsyncDisabled && !v.fullscreen
|
return !v.vsyncDisabled && !v.fullscreen
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (v *view) maximumDrawableCount() int {
|
||||||
|
// When presentsWithTransaction is YES and triple buffering is enabled, nextDrawing returns immediately once every two times.
|
||||||
|
// This makes FPS doubled. To avoid this, disable the triple buffering.
|
||||||
|
if v.usePresentsWithTransaction() {
|
||||||
|
return 2
|
||||||
|
}
|
||||||
|
return 3
|
||||||
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
storageMode = mtl.StorageModeManaged
|
storageMode = mtl.StorageModeManaged
|
||||||
resourceStorageMode = mtl.ResourceStorageModeManaged
|
resourceStorageMode = mtl.ResourceStorageModeManaged
|
||||||
|
Loading…
Reference in New Issue
Block a user