From b901d2acb1df161c6fc39343da4d1661bbe49a29 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Wed, 27 Jul 2016 03:09:56 +0900 Subject: [PATCH] graphics: Avoid ReadPixels when the image is volatile --- imageimpl.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/imageimpl.go b/imageimpl.go index 4a366ef61..4a3baf220 100644 --- a/imageimpl.go +++ b/imageimpl.go @@ -194,6 +194,9 @@ func (i *imageImpl) ensurePixels(context *opengl.Context) error { if i.disposed { return nil } + if i.volatile { + return nil + } if err := i.pixels.ReadPixelsFromVRAMIfStale(context); err != nil { return err } @@ -217,7 +220,7 @@ func (i *imageImpl) resetPixelsIfDependingOn(target *imageImpl, context *opengl. if !i.pixels.DependsOn(target.image) { return nil } - if context == nil { + if context == nil || i.volatile { // context is nil when this is not initialized yet. i.pixels.MakeStale() return nil