From 7f5719faddbc75c573613028948ec594c461e34b Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sat, 14 Apr 2018 17:59:10 +0900 Subject: [PATCH] graphics: Call glFlush after glTexSubImage2D for MacBook Pro --- internal/graphics/command.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/internal/graphics/command.go b/internal/graphics/command.go index bc77c74f9..77d448f88 100644 --- a/internal/graphics/command.go +++ b/internal/graphics/command.go @@ -149,7 +149,17 @@ func (q *commandQueue) Flush() error { } numc := len(g) indexOffsetInBytes := 0 + var lastC command for _, c := range g { + // On MacBook Pro (2013 Late?), glTexSubImage2D might not be finished + // before the next different comand. Call glFlush explicitly. + if _, ok := lastC.(*replacePixelsCommand); ok { + if _, ok := c.(*replacePixelsCommand); !ok { + opengl.GetContext().Flush() + } + } + lastC = c + if err := c.Exec(indexOffsetInBytes); err != nil { return err }