summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qopenglcontext_p.h
diff options
context:
space:
mode:
authorSérgio Martins <sergio.martins@kdab.com>2016-08-05 10:51:49 +0100
committerSérgio Martins <sergio.martins@kdab.com>2016-08-11 08:28:36 +0000
commit0681e603803634f89f72b37b216b91cab2e085d1 (patch)
tree8506eea608b9dfe56ad2ddbbe0709c7c270082e8 /src/gui/kernel/qopenglcontext_p.h
parentfbc9edb5e7bf1417959e9c9fb5f70979ff176483 (diff)
Cache the current QOpenGLFramebufferObject
This doesn't cover FBOs bound directly with glBindFramebuffer(), but it's perfect to create a fast path for code we know uses QOGLFBO, thus avoiding expensive glGetIntegerv() driver calls. The use case is to use this in QSG24BitTextMaskShader::activate(), where we need to check if the current FBO is sRGB capable. Change-Id: I434eeeb7e6a3d16be9327315536ad7280245085d Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/gui/kernel/qopenglcontext_p.h')
-rw-r--r--src/gui/kernel/qopenglcontext_p.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/gui/kernel/qopenglcontext_p.h b/src/gui/kernel/qopenglcontext_p.h
index 4a746bf12b..7c8c698a7d 100644
--- a/src/gui/kernel/qopenglcontext_p.h
+++ b/src/gui/kernel/qopenglcontext_p.h
@@ -61,6 +61,7 @@ QT_BEGIN_NAMESPACE
class QOpenGLFunctions;
class QOpenGLContext;
+class QOpenGLFramebufferObject;
class QOpenGLMultiGroupSharedResource;
class Q_GUI_EXPORT QOpenGLSharedResource
@@ -204,6 +205,7 @@ public:
, workaround_missingPrecisionQualifiers(false)
, active_engine(0)
, qgl_current_fbo_invalid(false)
+ , qgl_current_fbo(Q_NULLPTR)
, defaultFboRedirect(0)
{
requestedFormat = QSurfaceFormat::defaultFormat();
@@ -242,6 +244,11 @@ public:
bool qgl_current_fbo_invalid;
+ // Set and unset in QOpenGLFramebufferObject::bind()/unbind().
+ // (Only meaningful for QOGLFBO since an FBO might be bound by other means)
+ // Saves us from querying the driver for the current FBO in most paths.
+ QOpenGLFramebufferObject *qgl_current_fbo;
+
QVariant nativeHandle;
GLuint defaultFboRedirect;