Remove QQuickWindow::glslVersion & glslIsCoreProfile
authorJ-P Nurmi <jpnurmi@digia.com>
Sun, 10 Aug 2014 10:22:56 +0000 (12:22 +0200)
committerShawn Rutledge <shawn.rutledge@digia.com>
Wed, 13 Aug 2014 05:59:32 +0000 (07:59 +0200)
Superceded by the OpenGLInfo attached type
=> remove the API before it gets released

Change-Id: I7511fd28eb375eb3cd3cdd4bda6d82c1883e3094
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
src/quick/items/qquickwindow.cpp
src/quick/items/qquickwindow.h
tests/auto/quick/qquickwindow/tst_qquickwindow.cpp

index 1971c0a..a06f41c 100644 (file)
@@ -3623,87 +3623,6 @@ void QQuickWindow::resetOpenGLState()
 }
 
 /*!
-    \brief QQuickWindow::glslVersion
-    \since 5.4
-    \return The OpenGL Shading Language version for this window.
-
-    QML components that need to be usable on different platforms and environments may need
-    to deal with different OpenGL versions if they include ShaderEffect items. The source
-    code for a given shader may not be compatible with an OpenGL context that targets a
-    different OpenGL version or profile, hence it might be necessary to provide multiple
-    versions of the shader. This property helps in deciding which shader source should be
-    chosen.
-
-    The value corresponds to GLSL version declarations, for example an OpenGL 4.2 core
-    profile context will result in the value \e{420 core}, while an OpenGL ES 3.0 context
-    gives \e{300 es}. For OpenGL (ES) 2 the value will be an empty string since the
-    corresponding shading language does not use version declarations.
-
-    \note The value does not necessarily indicate that the shader source must target that
-    specific version. For example, compatibility profiles and ES 3.x all allow using
-    OpenGL 2 style shaders. The most important for reusable components is to check for
-    core profiles since these do not accept shaders with the old syntax.
-
-    \sa setFormat(), glslIsCoreProfile()
- */
-QString QQuickWindow::glslVersion() const
-{
-    QString ver;
-    QOpenGLContext *ctx = openglContext();
-    if (ctx) {
-        const QSurfaceFormat fmt = ctx->format();
-        if (fmt.renderableType() == QSurfaceFormat::OpenGLES
-                && fmt.majorVersion() >= 3) {
-            ver += QLatin1Char(fmt.majorVersion() + '0');
-            ver += QLatin1Char(fmt.minorVersion() + '0');
-            ver += QLatin1String("0 es");
-        } else if (fmt.renderableType() == QSurfaceFormat::OpenGL
-                   && fmt.majorVersion() >= 3) {
-            if (fmt.version() == qMakePair(3, 0)) {
-                ver = QStringLiteral("130");
-            } else if (fmt.version() == qMakePair(3, 1)) {
-                ver = QStringLiteral("140");
-            } else if (fmt.version() == qMakePair(3, 2)) {
-                ver = QStringLiteral("150");
-            } else {
-                ver += QLatin1Char(fmt.majorVersion() + '0');
-                ver += QLatin1Char(fmt.minorVersion() + '0');
-                ver += QLatin1Char('0');
-            }
-            if (fmt.version() >= qMakePair(3, 2)) {
-                if (fmt.profile() == QSurfaceFormat::CoreProfile)
-                    ver += QStringLiteral(" core");
-                else if (fmt.profile() == QSurfaceFormat::CompatibilityProfile)
-                    ver += QStringLiteral(" compatibility");
-            }
-        }
-    }
-    return ver;
-}
-
-/*!
-    \brief QQuickWindow::glslIsCoreProfile
-    \since 5.4
-    \return True if the window is rendering using OpenGL core profile.
-
-    This is convenience function to check if the window's OpenGL context is a core profile
-    context. It is more efficient to perform the check via this function than parsing the
-    string returned from glslVersion().
-
-    Resusable QML components will typically use this function in bindings in order to
-    choose between core and non core profile compatible shader sources.
-
-    To retrieve more information about the shading language, use glslVersion().
-
-    \sa glslVersion(), setFormat()
- */
-bool QQuickWindow::glslIsCoreProfile() const
-{
-    QOpenGLContext *ctx = openglContext();
-    return ctx ? ctx->format().profile() == QSurfaceFormat::CoreProfile : false;
-}
-
-/*!
     \qmlproperty string Window::title
 
     The window's title in the windowing system.
index 7757168..89780e4 100644 (file)
@@ -70,8 +70,6 @@ class Q_QUICK_EXPORT QQuickWindow : public QWindow
     Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
     Q_PROPERTY(QQuickItem* contentItem READ contentItem CONSTANT)
     Q_PROPERTY(QQuickItem* activeFocusItem READ activeFocusItem NOTIFY activeFocusItemChanged REVISION 1)
-    Q_PROPERTY(QString glslVersion READ glslVersion CONSTANT REVISION 2)
-    Q_PROPERTY(bool glslIsCoreProfile READ glslIsCoreProfile CONSTANT REVISION 2)
     Q_CLASSINFO("DefaultProperty", "data")
     Q_DECLARE_PRIVATE(QQuickWindow)
 public:
@@ -150,9 +148,6 @@ public:
 
     QOpenGLContext *openglContext() const;
 
-    QString glslVersion() const;
-    bool glslIsCoreProfile() const;
-
     void scheduleRenderJob(QRunnable *job, RenderStage schedule);
 
     static QQuickWindowAttached *qmlAttachedProperties(QObject *object);
index 3acf8a5..52dd3f1 100644 (file)
@@ -367,7 +367,6 @@ private slots:
     void contentItemSize();
 
     void defaultSurfaceFormat();
-    void glslVersion();
 
     void attachedProperty();
 
@@ -1949,40 +1948,6 @@ void tst_qquickwindow::defaultSurfaceFormat()
     QSurfaceFormat::setDefaultFormat(savedDefaultFormat);
 }
 
-void tst_qquickwindow::glslVersion()
-{
-    QQuickWindow window;
-    window.show();
-    QVERIFY(QTest::qWaitForWindowExposed(&window));
-
-    // Core profile is never requested by default.
-    QVERIFY(!window.glslIsCoreProfile());
-
-    // Get the format from the context, not the window. The actual OpenGL version and
-    // related settings are associated with the context and are only written back to the
-    // context's format.
-    QSurfaceFormat format = window.openglContext()->format();
-
-    if (format.renderableType() == QSurfaceFormat::OpenGL) {
-        if (format.majorVersion() == 2)
-            QCOMPARE(window.glslVersion(), QString());
-        else if (format.majorVersion() == 3)
-            QVERIFY(window.glslVersion().startsWith('3')
-                    || window.glslVersion() == QStringLiteral("130")
-                    || window.glslVersion() == QStringLiteral("140")
-                    || window.glslVersion() == QStringLiteral("150"));
-        else if (format.majorVersion() == 4)
-            QVERIFY(window.glslVersion().startsWith('4'));
-        QVERIFY(!window.glslVersion().contains(QStringLiteral("core")));
-        QVERIFY(!window.glslVersion().contains(QStringLiteral("es")));
-    } else if (format.renderableType() == QSurfaceFormat::OpenGLES) {
-        if (format.majorVersion() == 2)
-            QCOMPARE(window.glslVersion(), QString());
-        else
-            QVERIFY(window.glslVersion().contains(QStringLiteral("es")));
-    }
-}
-
 void tst_qquickwindow::attachedProperty()
 {
     QQuickView view(testFileUrl("windowattached.qml"));