mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-26 02:42:02 +01:00
uidriver/glfw: Avoid (*thread).Call when possible at (*UserInterface).loop
Updates #1367
This commit is contained in:
parent
cbb70d045c
commit
33fd7c935a
@ -874,10 +874,16 @@ func (u *UserInterface) loop() error {
|
|||||||
if err := u.context.Update(); err != nil {
|
if err := u.context.Update(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
_ = u.t.Call(func() error {
|
|
||||||
u.swapBuffers()
|
// swapBuffers also checks IsGL, so this condition is redundant.
|
||||||
return nil
|
// However, (*thread).Call is not good for performance due to channels.
|
||||||
})
|
// Let's avoid this whenever possible (#1367).
|
||||||
|
if u.Graphics().IsGL() {
|
||||||
|
_ = u.t.Call(func() error {
|
||||||
|
u.swapBuffers()
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
if unfocused {
|
if unfocused {
|
||||||
t2 = time.Now()
|
t2 = time.Now()
|
||||||
|
Loading…
Reference in New Issue
Block a user