internal/graphicsdriver/metal: Disable presentsWithTransaction on iOS

Closes #1799
This commit is contained in:
Hajime Hoshi 2021-09-07 00:02:55 +09:00
parent 777e8f2759
commit 65943d4bad
3 changed files with 11 additions and 3 deletions

View File

@ -70,9 +70,7 @@ func (v *view) setFullscreen(fullscreen bool) {
} }
func (v *view) updatePresentsWithTransaction() { func (v *view) updatePresentsWithTransaction() {
// Disable presentsWithTransaction on the fullscreen mode (#1745). pwt := v.usePresentsWithTransaction()
pwt := !v.vsyncDisabled && !v.fullscreen
v.ml.SetPresentsWithTransaction(pwt) v.ml.SetPresentsWithTransaction(pwt)
// When presentsWithTransaction is YES and triple buffering is enabled, nextDrawing returns immediately once every two times. // When presentsWithTransaction is YES and triple buffering is enabled, nextDrawing returns immediately once every two times.

View File

@ -57,6 +57,11 @@ func (v *view) update() {
C.setFrame(v.ml.Layer(), unsafe.Pointer(v.uiview)) C.setFrame(v.ml.Layer(), unsafe.Pointer(v.uiview))
} }
func (v *view) usePresentsWithTransaction() bool {
// Do not use presentsWithTransaction on iOS (#1799).
return false
}
const ( const (
storageMode = mtl.StorageModeShared storageMode = mtl.StorageModeShared
resourceStorageMode = mtl.ResourceStorageModeShared resourceStorageMode = mtl.ResourceStorageModeShared

View File

@ -43,6 +43,11 @@ func (v *view) update() {
v.windowChanged = false v.windowChanged = false
} }
func (v *view) usePresentsWithTransaction() bool {
// Disable presentsWithTransaction on the fullscreen mode (#1745).
return !v.vsyncDisabled && !v.fullscreen
}
const ( const (
storageMode = mtl.StorageModeManaged storageMode = mtl.StorageModeManaged
resourceStorageMode = mtl.ResourceStorageModeManaged resourceStorageMode = mtl.ResourceStorageModeManaged