mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
graphicsdriver/metal: Bug fix: Had to set the vsync state again at resetting
Fixes #1364
This commit is contained in:
parent
01be505f30
commit
fe558545c7
@ -254,7 +254,12 @@ func (g *game) Update(screen *ebiten.Image) error {
|
||||
ebiten.SetFullscreen(fullscreen)
|
||||
ebiten.SetRunnableOnUnfocused(runnableOnUnfocused)
|
||||
ebiten.SetCursorVisible(cursorVisible)
|
||||
ebiten.SetVsyncEnabled(vsyncEnabled)
|
||||
|
||||
// Set vsync enabled only when this is needed.
|
||||
// This makes a bug around vsync initialization more explicit (#1364).
|
||||
if vsyncEnabled != ebiten.IsVsyncEnabled() {
|
||||
ebiten.SetVsyncEnabled(vsyncEnabled)
|
||||
}
|
||||
ebiten.SetMaxTPS(tps)
|
||||
ebiten.SetWindowDecorated(decorated)
|
||||
ebiten.SetWindowPosition(positionX, positionY)
|
||||
|
@ -28,6 +28,7 @@ type view struct {
|
||||
uiview uintptr
|
||||
|
||||
windowChanged bool
|
||||
vsync bool
|
||||
|
||||
device mtl.Device
|
||||
ml ca.MetalLayer
|
||||
@ -48,6 +49,7 @@ func (v *view) setDisplaySyncEnabled(enabled bool) {
|
||||
// recursive function call via Run is forbidden.
|
||||
// Fix this to use d.t.Run to avoid confusion.
|
||||
v.ml.SetDisplaySyncEnabled(enabled)
|
||||
v.vsync = enabled
|
||||
}
|
||||
|
||||
func (v *view) colorPixelFormat() mtl.PixelFormat {
|
||||
@ -70,6 +72,9 @@ func (v *view) reset() error {
|
||||
// MTLPixelFormatBGRA10_XR_sRGB.
|
||||
v.ml.SetPixelFormat(mtl.PixelFormatBGRA8UNorm)
|
||||
v.ml.SetMaximumDrawableCount(3)
|
||||
|
||||
// The vsync state might be reset. Set the state again (#1364).
|
||||
v.ml.SetDisplaySyncEnabled(v.vsync)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user