internal/graphicscommand: switch the queue before flushing

This is a preparation to do something (e.g. handling inputs) during
being blocked by Flush.

Updates #1704
This commit is contained in:
Hajime Hoshi 2023-10-08 16:10:04 +09:00
parent 53525342b1
commit fd1083808c

View File

@ -311,10 +311,11 @@ func (q *commandQueue) flush(graphicsDriver graphicsdriver.Graphics, endFrame bo
// If endFrame is true, the current screen might be used to present. // If endFrame is true, the current screen might be used to present.
func FlushCommands(graphicsDriver graphicsdriver.Graphics, endFrame bool, swapBuffersForGL func()) error { func FlushCommands(graphicsDriver graphicsdriver.Graphics, endFrame bool, swapBuffersForGL func()) error {
flushImageBuffers() flushImageBuffers()
if err := currentCommandQueue().Flush(graphicsDriver, endFrame, swapBuffersForGL); err != nil { q := currentCommandQueue()
switchCommandQueue()
if err := q.Flush(graphicsDriver, endFrame, swapBuffersForGL); err != nil {
return err return err
} }
switchCommandQueue()
return nil return nil
} }