internal/ui: bug fix: EndFrame was not called when layoutGame returned 0s

This commit is contained in:
Hajime Hoshi 2023-10-24 02:31:05 +09:00
parent b94c3fa9bb
commit 2eca476054

View File

@ -105,6 +105,18 @@ func (c *context) updateFrameImpl(graphicsDriver graphicsdriver.Graphics, update
return err
}
defer func() {
if err1 := atlas.EndFrame(); err1 != nil && err == nil {
err = err1
return
}
if err1 := atlas.SwapBuffers(graphicsDriver, swapBuffersForGL); err1 != nil && err == nil {
err = err1
return
}
}()
// Flush deferred functions, like reading pixels from GPU.
if err := c.flushDeferredFuncs(ui); err != nil {
return err
@ -158,14 +170,6 @@ func (c *context) updateFrameImpl(graphicsDriver graphicsdriver.Graphics, update
return err
}
if err := atlas.EndFrame(); err != nil {
return err
}
if err := atlas.SwapBuffers(graphicsDriver, swapBuffersForGL); err != nil {
return err
}
return nil
}