diff options
author | Laszlo Agocs <laszlo.agocs@digia.com> | 2014-03-19 12:52:03 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-20 14:11:33 +0100 |
commit | 8adca56674bd51a39b278fb08f270624c825b002 (patch) | |
tree | 02d234e612ef1a74758566eb9c403e45c25664ad /tests/auto/opengl | |
parent | 33cac84df30770de2a2c27d4b1288a658db1b638 (diff) |
Resurrect advanced bindTexture() features in QtOpenGL
During the Qt 4 -> 5 migration the setting of the extension flags
in QOpenGLFunctions/Extensions suffered a regression: flags like
GenerateMipmap were never set. This led to the unfortunate sitation
that features that were tied to these flags, like compressed texture
support or mipmap generation, got disabled.
This is now corrected by checking for the extensions like Qt 4 did.
Task-number: QTBUG-37588
Change-Id: I4a7beb1b435af11e05f5304aa04df2ec63b34c18
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
Diffstat (limited to 'tests/auto/opengl')
-rw-r--r-- | tests/auto/opengl/qgl/tst_qgl.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/auto/opengl/qgl/tst_qgl.cpp b/tests/auto/opengl/qgl/tst_qgl.cpp index 718b5263bf..22f284e365 100644 --- a/tests/auto/opengl/qgl/tst_qgl.cpp +++ b/tests/auto/opengl/qgl/tst_qgl.cpp @@ -60,6 +60,7 @@ #include <QtOpenGL/private/qgl_p.h> #include <QtGui/private/qimage_p.h> #include <QtGui/private/qimagepixmapcleanuphooks_p.h> +#include <QtGui/private/qopenglextensions_p.h> #endif class tst_QGL : public QObject @@ -99,6 +100,7 @@ private slots: void threadImages(); void nullRectCrash(); void graphicsViewClipping(); + void extensions(); }; tst_QGL::tst_QGL() @@ -2361,5 +2363,43 @@ void tst_QGL::nullRectCrash() fboPainter.end(); } +void tst_QGL::extensions() +{ + QGLWidget glw; + glw.makeCurrent(); + + QOpenGLContext *ctx = QOpenGLContext::currentContext(); + QVERIFY(ctx); + QOpenGLFunctions *funcs = ctx->functions(); + QVERIFY(funcs); + QSurfaceFormat format = ctx->format(); + +#ifdef QT_BUILD_INTERNAL + QOpenGLExtensions *exts = static_cast<QOpenGLExtensions *>(funcs); + QOpenGLExtensions::OpenGLExtensions allExts = exts->openGLExtensions(); + // Mipmapping is always available in GL2/GLES2+. Verify this. + if (format.majorVersion() >= 2) + QVERIFY(allExts.testFlag(QOpenGLExtensions::GenerateMipmap)); +#endif + + // Now look for some features should always be available in a given version. + QOpenGLFunctions::OpenGLFeatures allFeatures = funcs->openGLFeatures(); + QVERIFY(allFeatures.testFlag(QOpenGLFunctions::Multitexture)); + if (format.majorVersion() >= 2) { + QVERIFY(allFeatures.testFlag(QOpenGLFunctions::Shaders)); + QVERIFY(allFeatures.testFlag(QOpenGLFunctions::Buffers)); + QVERIFY(allFeatures.testFlag(QOpenGLFunctions::Multisample)); + QVERIFY(!ctx->isES() || allFeatures.testFlag(QOpenGLFunctions::Framebuffers)); + QVERIFY(allFeatures.testFlag(QOpenGLFunctions::NPOTTextures) + && allFeatures.testFlag(QOpenGLFunctions::NPOTTextureRepeat)); + if (ctx->isES()) { + QVERIFY(!allFeatures.testFlag(QOpenGLFunctions::FixedFunctionPipeline)); + QVERIFY(allFeatures.testFlag(QOpenGLFunctions::Framebuffers)); + } + } + if (format.majorVersion() >= 3) + QVERIFY(allFeatures.testFlag(QOpenGLFunctions::Framebuffers)); +} + QTEST_MAIN(tst_QGL) #include "tst_qgl.moc" |