mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
graphicsdriver/metal: Bug fix: SetVsyncEnabled before Run didn't work on macOS
This commit is contained in:
parent
532488ac5c
commit
105909ab6c
@ -234,6 +234,7 @@ type Driver struct {
|
|||||||
dst *Image
|
dst *Image
|
||||||
|
|
||||||
maxImageSize int
|
maxImageSize int
|
||||||
|
vsync bool
|
||||||
}
|
}
|
||||||
|
|
||||||
var theDriver Driver
|
var theDriver Driver
|
||||||
@ -395,7 +396,7 @@ func (d *Driver) Reset() error {
|
|||||||
// MTLPixelFormatBGRA10_XR_sRGB.
|
// MTLPixelFormatBGRA10_XR_sRGB.
|
||||||
d.ml.SetPixelFormat(mtl.PixelFormatBGRA8UNorm)
|
d.ml.SetPixelFormat(mtl.PixelFormatBGRA8UNorm)
|
||||||
d.ml.SetMaximumDrawableCount(3)
|
d.ml.SetMaximumDrawableCount(3)
|
||||||
d.ml.SetDisplaySyncEnabled(true)
|
d.ml.SetDisplaySyncEnabled(d.vsync)
|
||||||
|
|
||||||
replaces := map[string]string{
|
replaces := map[string]string{
|
||||||
"{{.FilterNearest}}": fmt.Sprintf("%d", graphics.FilterNearest),
|
"{{.FilterNearest}}": fmt.Sprintf("%d", graphics.FilterNearest),
|
||||||
@ -570,7 +571,11 @@ func (d *Driver) ResetSource() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (d *Driver) SetVsyncEnabled(enabled bool) {
|
func (d *Driver) SetVsyncEnabled(enabled bool) {
|
||||||
|
// TODO: Now SetVsyncEnabled is called only from the main thread, and mainthread.Run is not available since
|
||||||
|
// recursive function call via Run is forbidden.
|
||||||
|
// Fix this to use mainthread.Run to avoid confusion.
|
||||||
d.ml.SetDisplaySyncEnabled(enabled)
|
d.ml.SetDisplaySyncEnabled(enabled)
|
||||||
|
d.vsync = enabled
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Driver) VDirection() graphicsdriver.VDirection {
|
func (d *Driver) VDirection() graphicsdriver.VDirection {
|
||||||
|
Loading…
Reference in New Issue
Block a user