From 49ea15e0498ba894647a8667148b4ab5dffcb343 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Tue, 15 Sep 2009 17:36:51 +1000 Subject: Don't round-trip to GL server for glGetError() in release mode. Reviewed-by: Samuel Reviewed-by: Tom Cooksey --- src/opengl/qglframebufferobject.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp index 4b8a67e..e4cef5f 100644 --- a/src/opengl/qglframebufferobject.cpp +++ b/src/opengl/qglframebufferobject.cpp @@ -66,6 +66,11 @@ extern QImage qt_gl_read_framebuffer(const QSize&, bool, bool); #define QGL_FUNC_CONTEXT QGLContextGroup *ctx = d_ptr->ctx; +#ifndef QT_NO_DEBUG +#define QT_RESET_GLERROR() \ +{ \ + while (glGetError() != GL_NO_ERROR) {} \ +} #define QT_CHECK_GLERROR() \ { \ GLenum err = glGetError(); \ @@ -74,6 +79,10 @@ extern QImage qt_gl_read_framebuffer(const QSize&, bool, bool); __FILE__, __LINE__, (int)err); \ } \ } +#else +#define QT_RESET_GLERROR() {} +#define QT_CHECK_GLERROR() {} +#endif /*! \class QGLFramebufferObjectFormat @@ -407,7 +416,7 @@ void QGLFramebufferObjectPrivate::init(QGLFramebufferObject *q, const QSize &sz, target = texture_target; // texture dimensions - while (glGetError() != GL_NO_ERROR) {} // reset error state + QT_RESET_GLERROR(); // reset error state glGenFramebuffers(1, &fbo); glBindFramebuffer(GL_FRAMEBUFFER_EXT, fbo); -- cgit v0.12