graphicsdriver/opengl: Call glFinish before glReadPixels

It looks like glFlush is not enough at least on Travis CI.

Fixes #814
This commit is contained in:
Hajime Hoshi 2019-02-14 01:36:21 +09:00
parent 0546783ad5
commit 04dc1faa9c
2 changed files with 5 additions and 2 deletions

View File

@ -161,7 +161,10 @@ func (c *context) bindFramebufferImpl(f framebufferNative) {
func (c *context) framebufferPixels(f *framebuffer, width, height int) ([]byte, error) { func (c *context) framebufferPixels(f *framebuffer, width, height int) ([]byte, error) {
var pixels []byte var pixels []byte
_ = mainthread.Run(func() error { _ = mainthread.Run(func() error {
gl.Flush() // glFlush is not enough. glFinish can be required before glReadPixels on some environments like
// Travis CI (#814)
// See also: https://forums.khronos.org/showthread.php/62741
gl.Finish()
return nil return nil
}) })
c.bindFramebuffer(f.native) c.bindFramebuffer(f.native)

View File

@ -142,7 +142,7 @@ func (c *context) bindFramebufferImpl(f framebufferNative) {
func (c *context) framebufferPixels(f *framebuffer, width, height int) ([]byte, error) { func (c *context) framebufferPixels(f *framebuffer, width, height int) ([]byte, error) {
gl := c.gl gl := c.gl
gl.Flush() gl.Finish()
c.bindFramebuffer(f.native) c.bindFramebuffer(f.native)