summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2016-07-04 12:43:40 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2016-07-05 11:20:28 +0000
commite4b2c470810341710a6c299ac3c7f86fe39c6d06 (patch)
treee7a60a4ae2e31e6fbe9b099d067cc39223e8028e
parentdbad7402b2886a556bcce5b50adfedc8b68de7a9 (diff)
Fix simplerenderer with dev
Change-Id: I1815cfc31e46b7f5f22272d9389fba9b0154d1ab Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
-rw-r--r--customcontext/context.cpp13
-rw-r--r--customcontext/context.h15
-rw-r--r--customcontext/pluginmain.h3
-rw-r--r--customcontext/renderer/qsgbasicclipmanager_p.h1
-rw-r--r--customcontext/renderer/qsgbasicshadermanager_p.h22
5 files changed, 52 insertions, 2 deletions
diff --git a/customcontext/context.cpp b/customcontext/context.cpp
index 4cf1030..b472a6e 100644
--- a/customcontext/context.cpp
+++ b/customcontext/context.cpp
@@ -94,7 +94,10 @@
#include <private/qsgdefaultrectanglenode_p.h>
#endif
-#if QT_VERSION >= 0x050200
+#if QT_VERSION >= 0x050800
+#define CONTEXT_CLASS RenderContext
+#define CONTEXT_CLASS_BASE QSGDefaultRenderContext
+#elif QT_VERSION >= 0x050200
#define CONTEXT_CLASS RenderContext
#define CONTEXT_CLASS_BASE QSGRenderContext
#else
@@ -113,7 +116,11 @@ namespace CustomContext
#if QT_VERSION >= 0x050200
RenderContext::RenderContext(QSGContext *ctx)
+#if QT_VERSION >= 0x050800
+ : QSGDefaultRenderContext(ctx)
+#else
: QSGRenderContext(ctx)
+#endif
{
#ifdef CUSTOMCONTEXT_DITHER
m_dither = qgetenv("CUSTOMCONTEXT_NO_DITHER").isEmpty();
@@ -161,7 +168,11 @@ QSGMaterialShader *RenderContext::prepareMaterial(QSGMaterial *material)
#endif //QT_VERSION >= 0x050200
Context::Context(QObject *parent)
+#if QT_VERSION >= 0x050800
+ : QSGDefaultContext(parent)
+#else
: QSGContext(parent)
+#endif
, m_sampleCount(0)
, m_useMultisampling(false)
#ifdef CUSTOMCONTEXT_HYBRISTEXTURE
diff --git a/customcontext/context.h b/customcontext/context.h
index 913f82b..53b26e0 100644
--- a/customcontext/context.h
+++ b/customcontext/context.h
@@ -43,9 +43,14 @@
#ifndef CONTEXT_H
#define CONTEXT_H
-#include <private/qsgcontext_p.h>
#include <QtCore/QElapsedTimer>
#include <QtGui/QOpenGLShaderProgram>
+#if QT_VERSION >= 0x050800
+#include <private/qsgdefaultcontext_p.h>
+#include <private/qsgdefaultrendercontext_p.h>
+#else
+#include <private/qsgcontext_p.h>
+#endif
#ifdef CUSTOMCONTEXT_DITHER
#include "renderhooks/ordereddither2x2.h"
@@ -68,7 +73,11 @@ namespace CustomContext
{
#if QT_VERSION >= 0x050200
+#if QT_VERSION >= 0x050800
+class RenderContext : public QSGDefaultRenderContext
+#else
class RenderContext : public QSGRenderContext
+#endif
{
public:
RenderContext(QSGContext *ctx);
@@ -110,7 +119,11 @@ public:
};
#endif
+#if QT_VERSION >= 0x050800
+class Context : public QSGDefaultContext
+#else
class Context : public QSGContext
+#endif
{
Q_OBJECT
public:
diff --git a/customcontext/pluginmain.h b/customcontext/pluginmain.h
index 8557785..da2e244 100644
--- a/customcontext/pluginmain.h
+++ b/customcontext/pluginmain.h
@@ -61,6 +61,9 @@ public:
QStringList keys() const;
QSGContext *create(const QString &key) const;
QQuickTextureFactory *createTextureFactoryFromImage(const QImage &image);
+#if QT_VERSION >= 0x050800
+ Flags flags(const QString &) const { return 0; }
+#endif
static CustomContext::Context *instance;
};
diff --git a/customcontext/renderer/qsgbasicclipmanager_p.h b/customcontext/renderer/qsgbasicclipmanager_p.h
index e9f28bc..c5333aa 100644
--- a/customcontext/renderer/qsgbasicclipmanager_p.h
+++ b/customcontext/renderer/qsgbasicclipmanager_p.h
@@ -38,6 +38,7 @@
#include <private/qsgshadersourcebuilder_p.h>
#include <QOpenGLShaderProgram>
+#include <QOpenGLFunctions>
class QSGBasicClipManager : public QObject
{
diff --git a/customcontext/renderer/qsgbasicshadermanager_p.h b/customcontext/renderer/qsgbasicshadermanager_p.h
index 59bdec1..dc73634 100644
--- a/customcontext/renderer/qsgbasicshadermanager_p.h
+++ b/customcontext/renderer/qsgbasicshadermanager_p.h
@@ -35,17 +35,29 @@
#define QSGBASICSHADERMANAGER_P_H
#include <qsgmaterial.h>
+#include <QtGui/qopenglfunctions.h>
+#if QT_VERSION >= 0x050800
+#include <private/qsgdefaultcontext_p.h>
+#include <private/qsgdefaultrendercontext_p.h>
+#else
#include <private/qsgcontext_p.h>
+#endif
#include <private/qsgrenderer_p.h>
+class QSGDefaultRenderContext;
+
class QSGBasicShaderManager : public QObject
{
Q_OBJECT
public:
QSGBasicShaderManager(QSGRenderContext *context)
: QObject(context)
+#if QT_VERSION >= 0x050800
+ , m_context(static_cast<QSGDefaultRenderContext *>(context))
+#else
, m_context(context)
+#endif
, m_currentShader(0)
, m_currentMaterial(0)
, m_previousMaterial(0)
@@ -75,8 +87,13 @@ public:
return shader;
shader = static_cast<QSGMaterialShader *>(material->createShader());
+#if QT_VERSION >= 0x050800
+ m_context->compileShader(shader, const_cast<QSGMaterial *>(material));
+ m_context->initializeShader(shader);
+#else
m_context->compile(shader, const_cast<QSGMaterial *>(material));
m_context->initialize(shader);
+#endif
m_shaders[type] = shader;
@@ -159,7 +176,12 @@ public Q_SLOTS:
private:
QHash<QSGMaterialType *, QSGMaterialShader *> m_shaders;
+
+#if QT_VERSION >= 0x050800
+ QSGDefaultRenderContext *m_context;
+#else
QSGRenderContext *m_context;
+#endif
QSGMaterialShader *m_currentShader;
const QSGMaterial *m_currentMaterial;