From b691e73342418d78521e9d7139056c344243951b Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sat, 14 Apr 2018 23:16:26 +0900 Subject: [PATCH] Revert "graphics: Experimental fix: call glFlush always after glTexSubImage2D" This reverts commit d2da77eb96190c7c08f90081c03f1db6ea19fc4c. Reason: This doesn't solve the issue on MacBook Late 2013. --- internal/graphics/command.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/internal/graphics/command.go b/internal/graphics/command.go index 0f173047a..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 } @@ -285,10 +295,6 @@ func (c *replacePixelsCommand) Exec(indexOffsetInBytes int) error { opengl.GetContext().Flush() opengl.GetContext().BindTexture(c.dst.texture.native) opengl.GetContext().TexSubImage2D(c.pixels, c.x, c.y, c.width, c.height) - - // On MacBook Pro (2013 Late?), glTexSubImage2D might not be finished - // before the next different comand. Call glFlush explicitly. - opengl.GetContext().Flush() return nil }