diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-09-29 01:00:09 +0200 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-09-29 01:00:10 +0200 |
commit | 0e1866017fd389629629b150ce252820592506cd (patch) | |
tree | 681142ae0e610ef7af2a43ca2d62c3ea5ed5f91a /src/gui/opengl/qopenglbuffer.cpp | |
parent | 9567a34bc0d9be87d3b0d6cbcb841837ca1d5659 (diff) | |
parent | 9a8175a13124e156948914854d2fda7436065b08 (diff) |
Merge remote-tracking branch 'origin/5.12' into dev
Change-Id: I6083c3e61b7dbe188f83676f7e7bb268e5ccf2f3
Diffstat (limited to 'src/gui/opengl/qopenglbuffer.cpp')
-rw-r--r-- | src/gui/opengl/qopenglbuffer.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/gui/opengl/qopenglbuffer.cpp b/src/gui/opengl/qopenglbuffer.cpp index 69c2baa8d9..000494244d 100644 --- a/src/gui/opengl/qopenglbuffer.cpp +++ b/src/gui/opengl/qopenglbuffer.cpp @@ -43,6 +43,10 @@ #include "qopenglbuffer.h" #include <private/qopenglextensions_p.h> +#ifndef GL_CONTEXT_LOST +#define GL_CONTEXT_LOST 0x0507 +#endif + QT_BEGIN_NAMESPACE /*! @@ -346,7 +350,14 @@ bool QOpenGLBuffer::read(int offset, void *data, int count) Q_D(QOpenGLBuffer); if (!d->funcs->hasOpenGLFeature(QOpenGLFunctions::Buffers) || !d->guard->id()) return false; - while (d->funcs->glGetError() != GL_NO_ERROR) ; // Clear error state. + + while (true) { // Clear error state. + GLenum error = d->funcs->glGetError(); + if (error == GL_NO_ERROR) + break; + if (error == GL_CONTEXT_LOST) + return false; + }; d->funcs->glGetBufferSubData(d->type, offset, count, data); return d->funcs->glGetError() == GL_NO_ERROR; #else |