diff options
author | Lars Knoll <lars.knoll@qt.io> | 2016-08-17 10:56:30 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2016-10-10 14:12:07 +0000 |
commit | 0f63a7d09605ca2ca8571edd4a27b3a035fd06a5 (patch) | |
tree | 385719b6ec99d170b0a337d245876987a5c3afd3 /src | |
parent | d64503bbdc62bb1839ddfe3e5f5813e406eafaaa (diff) |
Make shader effects configurable
Change-Id: I4e7fd5e9781dec7ee6ed8807ca1a51c937f6f9f3
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src')
24 files changed, 147 insertions, 34 deletions
diff --git a/src/quick/configure.json b/src/quick/configure.json index 5d76ef1e48..eb7119e6b2 100644 --- a/src/quick/configure.json +++ b/src/quick/configure.json @@ -14,6 +14,7 @@ "quick-listview": "boolean", "quick-path": "boolean", "quick-pathview": "boolean", + "quick-shadereffect": "boolean", "quick-sprite": "boolean" } }, @@ -79,6 +80,13 @@ "privateFeature" ] }, + "quick-shadereffect": { + "label": "ShaderEffect item", + "purpose": "Provides Shader effects in Qt Quick", + "output": [ + "privateFeature" + ] + }, "quick-sprite": { "label": "Sprite item", "purpose": "Provides the Qt Quick Sprite Item", @@ -99,6 +107,7 @@ "quick-listview", "quick-path", "quick-pathview", + "quick-shadereffect", "quick-sprite" ] } diff --git a/src/quick/designer/qquickdesignersupport.cpp b/src/quick/designer/qquickdesignersupport.cpp index 44be12bb78..3ff5a3ce96 100644 --- a/src/quick/designer/qquickdesignersupport.cpp +++ b/src/quick/designer/qquickdesignersupport.cpp @@ -40,7 +40,9 @@ #include "qquickdesignersupport_p.h" #include <private/qquickitem_p.h> +#if QT_CONFIG(quick_shadereffect) #include <QtQuick/private/qquickshadereffectsource_p.h> +#endif #include <QtQuick/private/qquickrectangle_p.h> #include <QtQml/private/qabstractanimationjob_p.h> #include <private/qqmlengine_p.h> @@ -51,6 +53,7 @@ #include <private/qqmlvme_p.h> #include <private/qqmlcomponentattached_p.h> #include <private/qqmldata_p.h> +#include <private/qsgadaptationlayer_p.h> #include "qquickdesignerwindowmanager_p.h" diff --git a/src/quick/items/items.pri b/src/quick/items/items.pri index c74770093f..297babb742 100644 --- a/src/quick/items/items.pri +++ b/src/quick/items/items.pri @@ -66,10 +66,6 @@ HEADERS += \ $$PWD/qquickscreen_p.h \ $$PWD/qquickwindowattached_p.h \ $$PWD/qquickwindowmodule_p.h \ - $$PWD/qquickshadereffectsource_p.h \ - $$PWD/qquickshadereffectmesh_p.h \ - $$PWD/qquickshadereffect_p.h \ - $$PWD/qquickgenericshadereffect_p.h \ $$PWD/qquickrendercontrol.h \ $$PWD/qquickrendercontrol_p.h \ $$PWD/qquickgraphicsinfo_p.h \ @@ -118,10 +114,6 @@ SOURCES += \ $$PWD/qquickwindowmodule.cpp \ $$PWD/qquickscreen.cpp \ $$PWD/qquickwindowattached.cpp \ - $$PWD/qquickshadereffectsource.cpp \ - $$PWD/qquickshadereffectmesh.cpp \ - $$PWD/qquickshadereffect.cpp \ - $$PWD/qquickgenericshadereffect.cpp \ $$PWD/qquickrendercontrol.cpp \ $$PWD/qquickgraphicsinfo.cpp \ $$PWD/qquickitemgrabresult.cpp @@ -156,6 +148,38 @@ qtConfig(quick-flipable) { $$PWD/qquickflipable.cpp } +qtConfig(quick-shadereffect) { + HEADERS += \ + $$PWD/qquickshadereffectsource_p.h \ + $$PWD/qquickshadereffectmesh_p.h \ + $$PWD/qquickshadereffect_p.h \ + $$PWD/qquickgenericshadereffect_p.h + SOURCES += \ + $$PWD/qquickshadereffectsource.cpp \ + $$PWD/qquickshadereffectmesh.cpp \ + $$PWD/qquickshadereffect.cpp \ + $$PWD/qquickgenericshadereffect.cpp + + qtConfig(opengl) { + SOURCES += \ + $$PWD/qquickopenglshadereffect.cpp \ + $$PWD/qquickopenglshadereffectnode.cpp + HEADERS += \ + $$PWD/qquickopenglshadereffect_p.h \ + $$PWD/qquickopenglshadereffectnode_p.h + + OTHER_FILES += \ + $$PWD/shaders/shadereffect.vert \ + $$PWD/shaders/shadereffect.frag \ + $$PWD/shaders/shadereffectfallback.vert \ + $$PWD/shaders/shadereffectfallback.frag \ + $$PWD/shaders/shadereffect_core.vert \ + $$PWD/shaders/shadereffect_core.frag \ + $$PWD/shaders/shadereffectfallback_core.vert \ + $$PWD/shaders/shadereffectfallback_core.frag + } +} + qtConfig(quick-sprite) { HEADERS += \ $$PWD/qquickspriteengine_p.h \ @@ -175,25 +199,11 @@ qtConfig(quick-sprite) { qtConfig(opengl(es1|es2)?) { SOURCES += \ $$PWD/qquickopenglinfo.cpp \ - $$PWD/qquickopenglshadereffect.cpp \ - $$PWD/qquickopenglshadereffectnode.cpp \ $$PWD/qquickframebufferobject.cpp HEADERS += \ $$PWD/qquickopenglinfo_p.h \ - $$PWD/qquickopenglshadereffect_p.h \ - $$PWD/qquickopenglshadereffectnode_p.h \ $$PWD/qquickframebufferobject.h - - OTHER_FILES += \ - $$PWD/shaders/shadereffect.vert \ - $$PWD/shaders/shadereffect.frag \ - $$PWD/shaders/shadereffectfallback.vert \ - $$PWD/shaders/shadereffectfallback.frag \ - $$PWD/shaders/shadereffect_core.vert \ - $$PWD/shaders/shadereffect_core.frag \ - $$PWD/shaders/shadereffectfallback_core.vert \ - $$PWD/shaders/shadereffectfallback_core.frag } RESOURCES += \ diff --git a/src/quick/items/qquickborderimage.cpp b/src/quick/items/qquickborderimage.cpp index 2fb151b36f..67b99bfbc6 100644 --- a/src/quick/items/qquickborderimage.cpp +++ b/src/quick/items/qquickborderimage.cpp @@ -51,6 +51,7 @@ #include <QtGui/qguiapplication.h> #include <private/qqmlglobal_p.h> +#include <private/qsgadaptationlayer_p.h> QT_BEGIN_NAMESPACE diff --git a/src/quick/items/qquickframebufferobject.cpp b/src/quick/items/qquickframebufferobject.cpp index 857cd44b15..18a6a58467 100644 --- a/src/quick/items/qquickframebufferobject.cpp +++ b/src/quick/items/qquickframebufferobject.cpp @@ -42,6 +42,8 @@ #include <QtGui/QOpenGLFramebufferObject> #include <QtGui/QOpenGLFunctions> #include <private/qquickitem_p.h> +#include <private/qsgadaptationlayer_p.h> +#include <qsgtextureprovider.h> #include <QSGSimpleTextureNode> #include <QSGRendererInterface> diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index eaf26a5c9a..63d95f6032 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -2344,7 +2344,9 @@ QQuickItem::~QQuickItem() if (d->extra.isAllocated()) { delete d->extra->contents; d->extra->contents = 0; +#if QT_CONFIG(quick_shadereffect) delete d->extra->layer; d->extra->layer = 0; +#endif } delete d->_anchors; d->_anchors = 0; @@ -4774,8 +4776,10 @@ void QQuickItem::classBegin() d->_stateGroup->classBegin(); if (d->_anchors) d->_anchors->classBegin(); +#if QT_CONFIG(quick_shadereffect) if (d->extra.isAllocated() && d->extra->layer) d->extra->layer->classBegin(); +#endif } /*! @@ -4795,8 +4799,10 @@ void QQuickItem::componentComplete() } if (d->extra.isAllocated()) { +#if QT_CONFIG(quick_shadereffect) if (d->extra->layer) d->extra->layer->componentComplete(); +#endif if (d->extra->keyHandler) d->extra->keyHandler->componentComplete(); @@ -4852,8 +4858,10 @@ QPointF QQuickItemPrivate::computeTransformOrigin() const void QQuickItemPrivate::transformChanged() { +#if QT_CONFIG(quick_shadereffect) if (extra.isAllocated() && extra->layer) extra->layer->updateMatrix(); +#endif } void QQuickItemPrivate::deliverKeyEvent(QKeyEvent *e) @@ -5235,8 +5243,10 @@ void QQuickItem::setZ(qreal v) emit zChanged(); +#if QT_CONFIG(quick_shadereffect) if (d->extra.isAllocated() && d->extra->layer) d->extra->layer->updateZ(); +#endif } /*! @@ -7647,9 +7657,13 @@ QDebug operator<<(QDebug debug, QQuickItem *item) bool QQuickItem::isTextureProvider() const { +#if QT_CONFIG(quick_shadereffect) Q_D(const QQuickItem); return d->extra.isAllocated() && d->extra->layer && d->extra->layer->effectSource() ? d->extra->layer->effectSource()->isTextureProvider() : false; +#else + return false; +#endif } /*! @@ -7663,9 +7677,13 @@ bool QQuickItem::isTextureProvider() const QSGTextureProvider *QQuickItem::textureProvider() const { +#if QT_CONFIG(quick_shadereffect) Q_D(const QQuickItem); return d->extra.isAllocated() && d->extra->layer && d->extra->layer->effectSource() ? d->extra->layer->effectSource()->textureProvider() : 0; +#else + return 0; +#endif } /*! @@ -7674,14 +7692,19 @@ QSGTextureProvider *QQuickItem::textureProvider() const */ QQuickItemLayer *QQuickItemPrivate::layer() const { +#if QT_CONFIG(quick_shadereffect) if (!extra.isAllocated() || !extra->layer) { extra.value().layer = new QQuickItemLayer(const_cast<QQuickItem *>(q_func())); if (!componentComplete) extra->layer->classBegin(); } return extra->layer; +#else + return 0; +#endif } +#if QT_CONFIG(quick_shadereffect) QQuickItemLayer::QQuickItemLayer(QQuickItem *item) : m_item(item) , m_enabled(false) @@ -8169,12 +8192,16 @@ void QQuickItemLayer::updateMatrix() ld->extra.value().origin = QQuickItemPrivate::get(m_item)->origin(); ld->dirty(QQuickItemPrivate::Transform); } +#endif // quick_shadereffect QQuickItemPrivate::ExtraData::ExtraData() : z(0), scale(1), rotation(0), opacity(1), contents(0), screenAttached(0), layoutDirectionAttached(0), enterKeyAttached(0), - keyHandler(0), layer(0), + keyHandler(0), +#if QT_CONFIG(quick_shadereffect) + layer(0), +#endif effectRefCount(0), hideRefCount(0), opacityNode(0), clipNode(0), rootNode(0), acceptedMouseButtons(0), origin(QQuickItem::Center), diff --git a/src/quick/items/qquickitem_p.h b/src/quick/items/qquickitem_p.h index d1511285a9..3bb4b2835c 100644 --- a/src/quick/items/qquickitem_p.h +++ b/src/quick/items/qquickitem_p.h @@ -76,7 +76,9 @@ #include <QtCore/qdebug.h> #include <QtCore/qelapsedtimer.h> +#if QT_CONFIG(quick_shadereffect) #include <QtQuick/private/qquickshadereffectsource_p.h> +#endif QT_BEGIN_NAMESPACE @@ -135,6 +137,7 @@ public: QList<QQuickItem *> items; }; +#if QT_CONFIG(quick_shadereffect) class QQuickItemLayer : public QObject, public QQuickItemChangeListener { @@ -236,6 +239,8 @@ private: QQuickShaderEffectSource::TextureMirroring m_textureMirroring; }; +#endif + class Q_QUICK_PRIVATE_EXPORT QQuickItemPrivate : public QObjectPrivate { Q_DECLARE_PUBLIC(QQuickItem) @@ -338,7 +343,9 @@ public: QQuickLayoutMirroringAttached* layoutDirectionAttached; QQuickEnterKeyAttached *enterKeyAttached; QQuickItemKeyFilter *keyHandler; +#if QT_CONFIG(quick_shadereffect) mutable QQuickItemLayer *layer; +#endif #ifndef QT_NO_CURSOR QCursor cursor; #endif @@ -925,7 +932,9 @@ Q_DECLARE_TYPEINFO(QQuickItemPrivate::ChangeListener, Q_PRIMITIVE_TYPE); QT_END_NAMESPACE +#if QT_CONFIG(quick_shadereffect) QML_DECLARE_TYPE(QQuickItemLayer) +#endif QML_DECLARE_TYPE(QQuickKeysAttached) QML_DECLARE_TYPEINFO(QQuickKeysAttached, QML_HAS_ATTACHED_PROPERTIES) QML_DECLARE_TYPE(QQuickKeyNavigationAttached) diff --git a/src/quick/items/qquickitemgrabresult.cpp b/src/quick/items/qquickitemgrabresult.cpp index 0db5323863..1b0e1f07f6 100644 --- a/src/quick/items/qquickitemgrabresult.cpp +++ b/src/quick/items/qquickitemgrabresult.cpp @@ -37,17 +37,21 @@ ** ****************************************************************************/ +#include <private/qtquickglobal_p.h> #include "qquickitemgrabresult.h" #include "qquickwindow.h" #include "qquickitem.h" +#if QT_CONFIG(quick_shadereffect) #include "qquickshadereffectsource_p.h" +#endif #include <QtQml/QQmlEngine> #include <private/qquickpixmapcache_p.h> #include <private/qquickitem_p.h> #include <private/qsgcontext_p.h> +#include <private/qsgadaptationlayer_p.h> QT_BEGIN_NAMESPACE diff --git a/src/quick/items/qquickitemsmodule.cpp b/src/quick/items/qquickitemsmodule.cpp index ce9ddcd633..227da5cae3 100644 --- a/src/quick/items/qquickitemsmodule.cpp +++ b/src/quick/items/qquickitemsmodule.cpp @@ -79,7 +79,6 @@ #include "qquicktranslate_p.h" #include "qquickstateoperations_p.h" #include "qquickitemanimation_p.h" -#include <QtQuick/private/qquickshadereffectsource_p.h> //#include <private/qquickpincharea_p.h> #if QT_CONFIG(quick_canvas) #include <QtQuick/private/qquickcanvasitem_p.h> @@ -95,8 +94,11 @@ # include "qquickopenglinfo_p.h" #endif #include "qquickgraphicsinfo_p.h" +#if QT_CONFIG(quick_shadereffect) +#include <QtQuick/private/qquickshadereffectsource_p.h> #include "qquickshadereffect_p.h" #include "qquickshadereffectmesh_p.h" +#endif #include "qquickdrag_p.h" #include "qquickdroparea_p.h" #include "qquickmultipointtoucharea_p.h" @@ -204,7 +206,9 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor) qmlRegisterType<QQuickTextInput,2>(uri,2,2,"TextInput"); qmlRegisterType<QQuickTextInput,3>(uri,2,4,"TextInput"); qmlRegisterType<QQuickItemGrabResult>(); +#if QT_CONFIG(quick_shadereffect) qmlRegisterType<QQuickItemLayer>(); +#endif qmlRegisterType<QQuickAnchors>(); qmlRegisterType<QQuickKeyEvent>(); qmlRegisterType<QQuickMouseEvent>(); @@ -233,10 +237,12 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor) qmlRegisterType<QQuickPinch>(uri,major,minor,"Pinch"); qmlRegisterType<QQuickPinchEvent>(); +#if QT_CONFIG(quick_shadereffect) qmlRegisterType<QQuickShaderEffectSource>("QtQuick", 2, 0, "ShaderEffectSource"); qmlRegisterUncreatableType<QQuickShaderEffectMesh>("QtQuick", 2, 0, "ShaderEffectMesh", QQuickShaderEffectMesh::tr("Cannot create instance of abstract class ShaderEffectMesh.")); qmlRegisterType<QQuickGridMesh>("QtQuick", 2, 0, "GridMesh"); qmlRegisterType<QQuickShaderEffect>("QtQuick", 2, 0, "ShaderEffect"); +#endif qmlRegisterUncreatableType<QQuickPaintedItem>("QtQuick", 2, 0, "PaintedItem", QQuickPaintedItem::tr("Cannot create instance of abstract class PaintedItem")); @@ -297,7 +303,9 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor) qmlRegisterType<QQuickListView, 2>(uri, 2, 4, "ListView"); #endif qmlRegisterType<QQuickMouseArea, 1>(uri, 2, 4, "MouseArea"); +#if QT_CONFIG(quick_shadereffect) qmlRegisterType<QQuickShaderEffect, 1>(uri, 2, 4, "ShaderEffect"); +#endif #ifndef QT_NO_OPENGL qmlRegisterUncreatableType<QQuickOpenGLInfo>(uri, 2, 4,"OpenGLInfo", QQuickOpenGLInfo::tr("OpenGLInfo is only available via attached properties")); @@ -317,7 +325,9 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor) qmlRegisterType<QQuickFlow, 6>(uri, 2, 6, "Flow"); qmlRegisterUncreatableType<QQuickEnterKeyAttached, 6>(uri, 2, 6, "EnterKey", QQuickEnterKeyAttached::tr("EnterKey is only available via attached properties")); +#if QT_CONFIG(quick_shadereffect) qmlRegisterType<QQuickShaderEffectSource, 1>(uri, 2, 6, "ShaderEffectSource"); +#endif #if QT_CONFIG(quick_listview) qmlRegisterType<QQuickListView, 7>(uri, 2, 7, "ListView"); @@ -332,7 +342,9 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor) qmlRegisterUncreatableType<QQuickMouseEvent, 7>(uri, 2, 7, nullptr, QQuickMouseEvent::tr("MouseEvent is only available within handlers in MouseArea")); qmlRegisterUncreatableType<QQuickGraphicsInfo>(uri, 2, 8,"GraphicsInfo", QQuickGraphicsInfo::tr("GraphicsInfo is only available via attached properties")); +#if QT_CONFIG(quick_shadereffect) qmlRegisterType<QQuickBorderImageMesh>("QtQuick", 2, 8, "BorderImageMesh"); +#endif } static void initResources() diff --git a/src/quick/items/qquickmousearea.cpp b/src/quick/items/qquickmousearea.cpp index 0118d882af..b377390535 100644 --- a/src/quick/items/qquickmousearea.cpp +++ b/src/quick/items/qquickmousearea.cpp @@ -43,6 +43,7 @@ #include "qquickdrag_p.h" #include <private/qqmldata_p.h> +#include <private/qsgadaptationlayer_p.h> #include <QtGui/private/qguiapplication_p.h> #include <QtGui/qevent.h> diff --git a/src/quick/items/qquickopenglshadereffect_p.h b/src/quick/items/qquickopenglshadereffect_p.h index ed56a76409..64e79a9343 100644 --- a/src/quick/items/qquickopenglshadereffect_p.h +++ b/src/quick/items/qquickopenglshadereffect_p.h @@ -51,6 +51,10 @@ // We mean it. // +#include <private/qtquickglobal_p.h> + +QT_REQUIRE_CONFIG(quick_shadereffect); + #include <QtQuick/qquickitem.h> #include <QtQuick/qsgmaterial.h> diff --git a/src/quick/items/qquickopenglshadereffectnode_p.h b/src/quick/items/qquickopenglshadereffectnode_p.h index 5abe3ae3d0..aea28e6612 100644 --- a/src/quick/items/qquickopenglshadereffectnode_p.h +++ b/src/quick/items/qquickopenglshadereffectnode_p.h @@ -51,6 +51,10 @@ // We mean it. // +#include <private/qtquickglobal_p.h> + +QT_REQUIRE_CONFIG(quick_shadereffect); + #include <QtQuick/qsgnode.h> #include <QtQuick/qsgmaterial.h> #include <QtQuick/qsgtextureprovider.h> diff --git a/src/quick/items/qquickpainteditem.cpp b/src/quick/items/qquickpainteditem.cpp index d21eb93dbf..1ef8de753d 100644 --- a/src/quick/items/qquickpainteditem.cpp +++ b/src/quick/items/qquickpainteditem.cpp @@ -43,6 +43,7 @@ #include <QtQuick/private/qsgdefaultpainternode_p.h> #include <QtQuick/private/qsgcontext_p.h> #include <private/qsgadaptationlayer_p.h> +#include <qsgtextureprovider.h> #include <qmath.h> diff --git a/src/quick/items/qquickrendercontrol.cpp b/src/quick/items/qquickrendercontrol.cpp index 8b69447002..74aa2da9e0 100644 --- a/src/quick/items/qquickrendercontrol.cpp +++ b/src/quick/items/qquickrendercontrol.cpp @@ -47,8 +47,10 @@ #ifndef QT_NO_OPENGL # include <QtGui/QOpenGLContext> # include <QtQuick/private/qsgdefaultrendercontext_p.h> +#if QT_CONFIG(quick_shadereffect) # include <QtQuick/private/qquickopenglshadereffectnode_p.h> #endif +#endif #include <QtGui/private/qguiapplication_p.h> #include <qpa/qplatformintegration.h> @@ -190,7 +192,7 @@ void QQuickRenderControlPrivate::windowDestroyed() delete QQuickWindowPrivate::get(window)->animationController; QQuickWindowPrivate::get(window)->animationController = 0; -#ifndef QT_NO_OPENGL +#if QT_CONFIG(quick_shadereffect) && QT_CONFIG(opengl) QQuickOpenGLShaderEffectMaterial::cleanupMaterialCache(); #endif diff --git a/src/quick/items/qquickshadereffect_p.h b/src/quick/items/qquickshadereffect_p.h index 17b009039a..2b7ff4cf6e 100644 --- a/src/quick/items/qquickshadereffect_p.h +++ b/src/quick/items/qquickshadereffect_p.h @@ -51,6 +51,10 @@ // We mean it. // +#include <private/qtquickglobal_p.h> + +QT_REQUIRE_CONFIG(quick_shadereffect); + #include <QtQuick/qquickitem.h> #include <private/qtquickglobal_p.h> diff --git a/src/quick/items/qquickshadereffectmesh_p.h b/src/quick/items/qquickshadereffectmesh_p.h index c5f1d19866..cbf33b795f 100644 --- a/src/quick/items/qquickshadereffectmesh_p.h +++ b/src/quick/items/qquickshadereffectmesh_p.h @@ -37,6 +37,10 @@ ** ****************************************************************************/ +#include <private/qtquickglobal_p.h> + +QT_REQUIRE_CONFIG(quick_shadereffect); + #include "qqmlparserstatus.h" #include <QtQuick/qtquickglobal.h> diff --git a/src/quick/items/qquickshadereffectsource_p.h b/src/quick/items/qquickshadereffectsource_p.h index ee18bf195a..5e7e354feb 100644 --- a/src/quick/items/qquickshadereffectsource_p.h +++ b/src/quick/items/qquickshadereffectsource_p.h @@ -51,6 +51,10 @@ // We mean it. // +#include <QtQuick/private/qtquickglobal_p.h> + +QT_REQUIRE_CONFIG(quick_shadereffect); + #include "qquickitem.h" #include <QtQuick/qsgtextureprovider.h> #include <private/qsgadaptationlayer_p.h> diff --git a/src/quick/scenegraph/qsgrenderloop.cpp b/src/quick/scenegraph/qsgrenderloop.cpp index e99e8dfe2e..df7bbe6ceb 100644 --- a/src/quick/scenegraph/qsgrenderloop.cpp +++ b/src/quick/scenegraph/qsgrenderloop.cpp @@ -61,8 +61,10 @@ #ifndef QT_NO_OPENGL # include <QtGui/QOpenGLContext> # include <private/qsgdefaultrendercontext_p.h> +#if QT_CONFIG(quick_shadereffect) # include <private/qquickopenglshadereffectnode_p.h> #endif +#endif #ifdef Q_OS_WIN # include <QtCore/qt_windows.h> @@ -326,7 +328,7 @@ void QSGGuiThreadRenderLoop::windowDestroyed(QQuickWindow *window) if (Q_UNLIKELY(!current)) qCDebug(QSG_LOG_RENDERLOOP) << "cleanup without an OpenGL context"; -#ifndef QT_NO_OPENGL +#if QT_CONFIG(quick_shadereffect) && QT_CONFIG(opengl) QQuickOpenGLShaderEffectMaterial::cleanupMaterialCache(); #endif diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp index 6b9c67b2bd..693012154e 100644 --- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp +++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp @@ -63,7 +63,9 @@ #include <private/qqmldebugserviceinterfaces_p.h> #include <private/qqmldebugconnector_p.h> +#if QT_CONFIG(quick_shadereffect) #include <private/qquickopenglshadereffectnode_p.h> +#endif #include <private/qsgdefaultrendercontext_p.h> /* @@ -487,7 +489,9 @@ void QSGRenderThread::invalidateOpenGL(QQuickWindow *window, bool inDestructor, QQuickWindowPrivate *dd = QQuickWindowPrivate::get(window); +#if QT_CONFIG(quick_shadereffect) QQuickOpenGLShaderEffectMaterial::cleanupMaterialCache(); +#endif // The canvas nodes must be cleaned up regardless if we are in the destructor.. if (wipeSG) { diff --git a/src/quick/scenegraph/qsgwindowsrenderloop.cpp b/src/quick/scenegraph/qsgwindowsrenderloop.cpp index 743e524a36..941a7b3f3c 100644 --- a/src/quick/scenegraph/qsgwindowsrenderloop.cpp +++ b/src/quick/scenegraph/qsgwindowsrenderloop.cpp @@ -55,7 +55,7 @@ #include <private/qquickprofiler_p.h> #include <private/qquickanimatorcontroller_p.h> -#ifndef QT_NO_OPENGL +#if QT_CONFIG(quick_shadereffect) && QT_CONFIG(opengl) #include <private/qquickopenglshadereffectnode_p.h> #endif @@ -245,7 +245,7 @@ void QSGWindowsRenderLoop::windowDestroyed(QQuickWindow *window) if (Q_UNLIKELY(!current)) qCDebug(QSG_LOG_RENDERLOOP) << "cleanup without an OpenGL context"; -#ifndef QT_NO_OPENGL +#if QT_CONFIG(quick_shadereffect) && QT_CONFIG(opengl) QQuickOpenGLShaderEffectMaterial::cleanupMaterialCache(); #endif diff --git a/src/quick/util/qquickanimator.cpp b/src/quick/util/qquickanimator.cpp index 100b7bd402..5d2af0f940 100644 --- a/src/quick/util/qquickanimator.cpp +++ b/src/quick/util/qquickanimator.cpp @@ -502,7 +502,8 @@ QQuickRotationAnimator::RotationDirection QQuickRotationAnimator::direction() co Q_D(const QQuickRotationAnimator); return d->direction; } -#ifndef QT_NO_OPENGL + +#if QT_CONFIG(quick_shadereffect) && QT_CONFIG(opengl) /*! \qmltype UniformAnimator \instantiates QQuickUniformAnimator diff --git a/src/quick/util/qquickanimator_p.h b/src/quick/util/qquickanimator_p.h index f1e2d4e1d9..0fc900c5ac 100644 --- a/src/quick/util/qquickanimator_p.h +++ b/src/quick/util/qquickanimator_p.h @@ -169,7 +169,8 @@ protected: QQuickAnimatorJob *createJob() const; QString propertyName() const { return QStringLiteral("rotation"); } }; -#ifndef QT_NO_OPENGL + +#if QT_CONFIG(quick_shadereffect) && QT_CONFIG(opengl) class QQuickUniformAnimatorPrivate; class Q_QUICK_PRIVATE_EXPORT QQuickUniformAnimator : public QQuickAnimator { @@ -200,7 +201,7 @@ QML_DECLARE_TYPE(QQuickYAnimator) QML_DECLARE_TYPE(QQuickScaleAnimator) QML_DECLARE_TYPE(QQuickRotationAnimator) QML_DECLARE_TYPE(QQuickOpacityAnimator) -#ifndef QT_NO_OPENGL +#if QT_CONFIG(quick_shadereffect) && QT_CONFIG(opengl) QML_DECLARE_TYPE(QQuickUniformAnimator) #endif #endif // QQUICKANIMATOR_P_H diff --git a/src/quick/util/qquickanimatorjob.cpp b/src/quick/util/qquickanimatorjob.cpp index a0c787dae5..1176cf1ff7 100644 --- a/src/quick/util/qquickanimatorjob.cpp +++ b/src/quick/util/qquickanimatorjob.cpp @@ -43,7 +43,7 @@ #include "qquickanimator_p_p.h" #include <private/qquickwindow_p.h> #include <private/qquickitem_p.h> -#ifndef QT_NO_OPENGL +#if QT_CONFIG(quick_shadereffect) && QT_CONFIG(opengl) # include <private/qquickopenglshadereffectnode_p.h> # include <private/qquickopenglshadereffect_p.h> #endif @@ -329,11 +329,13 @@ void QQuickTransformAnimatorJob::Helper::sync() | QQuickItemPrivate::Size; QQuickItemPrivate *d = QQuickItemPrivate::get(item); +#if QT_CONFIG(quick_shadereffect) if (d->extra.isAllocated() && d->extra->layer && d->extra->layer->enabled()) { d = QQuickItemPrivate::get(d->extra->layer->m_effectSource); } +#endif quint32 dirty = mask & d->dirtyAttributes; @@ -423,11 +425,13 @@ void QQuickOpacityAnimatorJob::initialize(QQuickAnimatorController *controller) { QQuickAnimatorJob::initialize(controller); QQuickItemPrivate *d = QQuickItemPrivate::get(m_target); +#if QT_CONFIG(quick_shadereffect) if (d->extra.isAllocated() && d->extra->layer && d->extra->layer->enabled()) { d = QQuickItemPrivate::get(d->extra->layer->m_effectSource); } +#endif m_opacityNode = d->opacityNode(); if (!m_opacityNode) { @@ -543,7 +547,7 @@ void QQuickRotationAnimatorJob::writeBack() m_target->setRotation(value()); } -#ifndef QT_NO_OPENGL +#if QT_CONFIG(quick_shadereffect) && QT_CONFIG(opengl) QQuickUniformAnimatorJob::QQuickUniformAnimatorJob() : m_node(0) , m_uniformIndex(-1) diff --git a/src/quick/util/qquickutilmodule.cpp b/src/quick/util/qquickutilmodule.cpp index 66994e22ba..7e2973a78b 100644 --- a/src/quick/util/qquickutilmodule.cpp +++ b/src/quick/util/qquickutilmodule.cpp @@ -107,7 +107,7 @@ void QQuickUtilModule::defineModule() qmlRegisterType<QQuickScaleAnimator>("QtQuick", 2, 2, "ScaleAnimator"); qmlRegisterType<QQuickRotationAnimator>("QtQuick", 2, 2, "RotationAnimator"); qmlRegisterType<QQuickOpacityAnimator>("QtQuick", 2, 2, "OpacityAnimator"); -#ifndef QT_NO_OPENGL +#if QT_CONFIG(quick_shadereffect) && QT_CONFIG(opengl) qmlRegisterType<QQuickUniformAnimator>("QtQuick", 2, 2, "UniformAnimator"); #endif qmlRegisterType<QQuickStateOperation>(); |