aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/coreapi/qsgrenderer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/quick/scenegraph/coreapi/qsgrenderer.cpp')
-rw-r--r--src/quick/scenegraph/coreapi/qsgrenderer.cpp29
1 files changed, 23 insertions, 6 deletions
diff --git a/src/quick/scenegraph/coreapi/qsgrenderer.cpp b/src/quick/scenegraph/coreapi/qsgrenderer.cpp
index ace10661c0..220e6ab212 100644
--- a/src/quick/scenegraph/coreapi/qsgrenderer.cpp
+++ b/src/quick/scenegraph/coreapi/qsgrenderer.cpp
@@ -39,11 +39,15 @@
#include "qsgrenderer_p.h"
#include "qsgnodeupdater_p.h"
-
-#include <qopenglframebufferobject.h>
-
+#ifndef QT_NO_OPENGL
+# include <QtGui/QOpenGLFramebufferObject>
+# include <QtGui/QOpenGLContext>
+# include <QtGui/QOpenGLFunctions>
+#endif
#include <private/qquickprofiler_p.h>
+#include <QtCore/QElapsedTimer>
+
QT_BEGIN_NAMESPACE
static const bool qsg_sanity_check = qEnvironmentVariableIntValue("QSG_SANITY_CHECK");
@@ -63,19 +67,25 @@ int qt_sg_envInt(const char *name, int defaultValue)
void QSGBindable::clear(QSGAbstractRenderer::ClearMode mode) const
{
+#ifndef QT_NO_OPENGL
GLuint bits = 0;
if (mode & QSGAbstractRenderer::ClearColorBuffer) bits |= GL_COLOR_BUFFER_BIT;
if (mode & QSGAbstractRenderer::ClearDepthBuffer) bits |= GL_DEPTH_BUFFER_BIT;
if (mode & QSGAbstractRenderer::ClearStencilBuffer) bits |= GL_STENCIL_BUFFER_BIT;
QOpenGLContext::currentContext()->functions()->glClear(bits);
+#else
+ Q_UNUSED(mode)
+#endif
}
// Reactivate the color buffer after switching to the stencil.
void QSGBindable::reactivate() const
{
+#ifndef QT_NO_OPENGL
QOpenGLContext::currentContext()->functions()->glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
+#endif
}
-
+#ifndef QT_NO_OPENGL
QSGBindableFboId::QSGBindableFboId(GLuint id)
: m_id(id)
{
@@ -86,7 +96,7 @@ void QSGBindableFboId::bind() const
{
QOpenGLContext::currentContext()->functions()->glBindFramebuffer(GL_FRAMEBUFFER, m_id);
}
-
+#endif
/*!
\class QSGRenderer
\brief The renderer class is the abstract baseclass use for rendering the
@@ -169,8 +179,9 @@ bool QSGRenderer::isMirrored() const
return matrix(0, 0) * matrix(1, 1) - matrix(0, 1) * matrix(1, 0) > 0;
}
-void QSGRenderer::renderScene(GLuint fboId)
+void QSGRenderer::renderScene(uint fboId)
{
+#ifndef QT_NO_OPENGL
if (fboId) {
QSGBindableFboId bindable(fboId);
renderScene(bindable);
@@ -182,7 +193,11 @@ void QSGRenderer::renderScene(GLuint fboId)
} bindable;
renderScene(bindable);
}
+#else
+ Q_UNUSED(fboId)
+#endif
}
+
void QSGRenderer::renderScene(const QSGBindable &bindable)
{
if (!rootNode())
@@ -207,6 +222,7 @@ void QSGRenderer::renderScene(const QSGBindable &bindable)
bindTime = frameTimer.nsecsElapsed();
Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRendererFrame);
+#ifndef QT_NO_OPENGL
// Sanity check that attribute registers are disabled
if (qsg_sanity_check) {
GLint count = 0;
@@ -219,6 +235,7 @@ void QSGRenderer::renderScene(const QSGBindable &bindable)
}
}
}
+#endif
render();
if (profileFrames)