diff options
author | Paul Lemire <paul.lemire@kdab.com> | 2020-06-09 15:08:28 +0200 |
---|---|---|
committer | Mike Krus <mike.krus@kdab.com> | 2020-06-12 11:24:30 +0100 |
commit | d604120720850533cb95d69ce37dfadf00fd03ba (patch) | |
tree | 884dfd7d8d3c88f0d58225ce0e57b28f68c26d4e | |
parent | 3f98bd6a1929c32ab70531af6d82b83481d36a14 (diff) |
Update dependencies
- QOpenGLEXtensions now private API in GUI
- Removed support for tessellation in GL 3
- Use QMouseEvent position
- Removed use of QDesktopWidget
- Adapt to change in QQuickWindow API
Change-Id: I79df8780b9d02c6d2a3620529f5f41daec7120fe
Reviewed-by: Mike Krus <mike.krus@kdab.com>
21 files changed, 90 insertions, 189 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index ac23033e1..f5afb5ce6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ project(Qt3D # special case ) find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS BuildInternals Core Gui - OPTIONAL_COMPONENTS Concurrent Widgets Qml Quick Gamepad OpenGL OpenGLExtensions ShaderTools + OPTIONAL_COMPONENTS Concurrent Widgets Qml Quick Gamepad OpenGL ShaderTools ) if(NOT TARGET Qt::Gui) diff --git a/dependencies.yaml b/dependencies.yaml index a25339fbc..bf45952b4 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -1,13 +1,13 @@ dependencies: ../qtbase: - ref: 1b33ee95e5c6e5e27f732fd273920861fdae486a + ref: ad532ce118b7052be3b69999cef2eb610e66fa88 required: true ../qtdeclarative: - ref: 3d1b34e5bfd56d8035fa53ffb14726e6120f3ff0 - required: false + ref: 11a09e212877988d37416842ad73d9aa357ba51f + required: true ../qtshadertools: - ref: e28dca4c5d7be8e8b1be01caa42caed5b6b3ef9c - required: false + ref: 9ed3dc95316792d6331ede9facc03d294d878ccc + required: true # ../qtgamepad: # ref: fb20a2012e650917e294d1614ec17d3b01404b25 # required: false diff --git a/examples/qt3d/scene3d/main.cpp b/examples/qt3d/scene3d/main.cpp index 3df6816c6..67eaadb4d 100644 --- a/examples/qt3d/scene3d/main.cpp +++ b/examples/qt3d/scene3d/main.cpp @@ -75,7 +75,6 @@ int main(int argc, char **argv) view.resize(1024, 768); view.setResizeMode(QQuickView::SizeRootObjectToView); - view.setPersistentOpenGLContext(true); view.setPersistentSceneGraph(true); view.setSource(QUrl("qrc:/main.qml")); view.show(); diff --git a/src/input/backend/mousedevice.cpp b/src/input/backend/mousedevice.cpp index 5c4ebf6ab..79c7fb2fa 100644 --- a/src/input/backend/mousedevice.cpp +++ b/src/input/backend/mousedevice.cpp @@ -161,11 +161,11 @@ void MouseDevice::updateMouseEvents(const QList<QT_PREPEND_NAMESPACE(QMouseEvent m_mouseState.rightPressed = e.buttons() & (Qt::RightButton); const bool pressed = m_mouseState.leftPressed || m_mouseState.centerPressed || m_mouseState.rightPressed; if (m_updateAxesContinuously || (m_wasPressed && pressed)) { - m_mouseState.xAxis += m_sensitivity * (e.screenPos().x() - m_previousPos.x()); - m_mouseState.yAxis += m_sensitivity * (m_previousPos.y() - e.screenPos().y()); + m_mouseState.xAxis += m_sensitivity * float(e.globalPosition().x() - m_previousPos.x()); + m_mouseState.yAxis += m_sensitivity * float(m_previousPos.y() - e.globalPosition().y()); } m_wasPressed = pressed; - m_previousPos = e.screenPos(); + m_previousPos = e.globalPosition(); } } } diff --git a/src/input/frontend/qmouseevent.h b/src/input/frontend/qmouseevent.h index ae44d9365..a663c2e44 100644 --- a/src/input/frontend/qmouseevent.h +++ b/src/input/frontend/qmouseevent.h @@ -84,8 +84,8 @@ public: explicit QMouseEvent(const QT_PREPEND_NAMESPACE(QMouseEvent) &e); ~QMouseEvent(); - inline int x() const { return m_event.x(); } - inline int y() const { return m_event.y(); } + inline int x() const { return int(m_event.position().x()); } + inline int y() const { return int(m_event.position().y()); } inline bool wasHeld() const { #if QT_CONFIG(gestures) return static_cast<Qt::GestureType>(m_event.type()) == Qt::TapAndHoldGesture; diff --git a/src/plugins/renderers/opengl/CMakeLists.txt b/src/plugins/renderers/opengl/CMakeLists.txt index ae55b2b7d..1cc22f434 100644 --- a/src/plugins/renderers/opengl/CMakeLists.txt +++ b/src/plugins/renderers/opengl/CMakeLists.txt @@ -60,8 +60,6 @@ if(QT_FEATURE_private_tests) ) target_link_libraries(OpenGLRendererLib - PRIVATE - Qt::OpenGLExtensions PUBLIC Qt::3DCore Qt::3DCorePrivate @@ -115,8 +113,6 @@ qt_internal_add_plugin(OpenGLRendererPlugin managers renderer textures - LIBRARIES - Qt::OpenGLExtensions PUBLIC_LIBRARIES Qt::3DCore Qt::3DCorePrivate diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl2.cpp b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl2.cpp index 45704076b..01a84fd88 100644 --- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl2.cpp +++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl2.cpp @@ -40,8 +40,8 @@ #include "graphicshelpergl2_p.h" #if !QT_CONFIG(opengles2) #include <QOpenGLFunctions_2_0> +#include <QOpenGLExtraFunctions> #include <private/attachmentpack_p.h> -#include <QtOpenGLExtensions/QOpenGLExtensions> #include <qgraphicsutils_p.h> #include <logging_p.h> @@ -53,7 +53,6 @@ namespace OpenGL { GraphicsHelperGL2::GraphicsHelperGL2() : m_funcs(nullptr) - , m_fboFuncs(nullptr) { } @@ -66,12 +65,8 @@ void GraphicsHelperGL2::initializeHelper(QOpenGLContext *context, const bool ok = m_funcs->initializeOpenGLFunctions(); Q_ASSERT(ok); Q_UNUSED(ok); - if (context->hasExtension(QByteArrayLiteral("GL_ARB_framebuffer_object"))) { - m_fboFuncs = new QOpenGLExtension_ARB_framebuffer_object(); - const bool extensionOk = m_fboFuncs->initializeOpenGLFunctions(); - Q_ASSERT(extensionOk); - Q_UNUSED(extensionOk); - } + m_extraFunctions = context->extraFunctions(); + Q_ASSERT(m_extraFunctions); } void GraphicsHelperGL2::drawElementsInstancedBaseVertexBaseInstance(GLenum primitiveType, @@ -371,28 +366,19 @@ void GraphicsHelperGL2::setAlphaCoverageEnabled(bool enabled) GLuint GraphicsHelperGL2::createFrameBufferObject() { - if (m_fboFuncs != nullptr) { - GLuint id; - m_fboFuncs->glGenFramebuffers(1, &id); - return id; - } - qWarning() << "FBO not supported by your OpenGL hardware"; - return 0; + GLuint id; + m_extraFunctions->glGenFramebuffers(1, &id); + return id; } void GraphicsHelperGL2::releaseFrameBufferObject(GLuint frameBufferId) { - if (m_fboFuncs != nullptr) - m_fboFuncs->glDeleteFramebuffers(1, &frameBufferId); - else - qWarning() << "FBO not supported by your OpenGL hardware"; + m_extraFunctions->glDeleteFramebuffers(1, &frameBufferId); } bool GraphicsHelperGL2::checkFrameBufferComplete() { - if (m_fboFuncs != nullptr) - return (m_fboFuncs->glCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE); - return false; + return m_extraFunctions->glCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE; } bool GraphicsHelperGL2::frameBufferNeedsRenderBuffer(const Attachment &attachment) @@ -403,38 +389,32 @@ bool GraphicsHelperGL2::frameBufferNeedsRenderBuffer(const Attachment &attachmen void GraphicsHelperGL2::bindFrameBufferAttachment(QOpenGLTexture *texture, const Attachment &attachment) { - if (m_fboFuncs != nullptr) { - GLenum attr = GL_DEPTH_STENCIL_ATTACHMENT; - - if (attachment.m_point <= QRenderTargetOutput::Color15) - attr = GL_COLOR_ATTACHMENT0 + attachment.m_point; - else if (attachment.m_point == QRenderTargetOutput::Depth) - attr = GL_DEPTH_ATTACHMENT; - else if (attachment.m_point == QRenderTargetOutput::Stencil) - attr = GL_STENCIL_ATTACHMENT; - else - qCritical() << "DepthStencil Attachment not supported on OpenGL 2.0"; - - const QOpenGLTexture::Target target = texture->target(); - - if (target == QOpenGLTexture::TargetCubeMap && attachment.m_face == QAbstractTexture::AllFaces) { - qWarning() << "OpenGL 2.0 doesn't handle attaching all the faces of a cube map texture at once to an FBO"; - return; - } - - texture->bind(); - if (target == QOpenGLTexture::Target3D) - m_fboFuncs->glFramebufferTexture3D(GL_DRAW_FRAMEBUFFER, attr, target, texture->textureId(), attachment.m_mipLevel, attachment.m_layer); - else if (target == QOpenGLTexture::TargetCubeMap) - m_fboFuncs->glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, attr, attachment.m_face, texture->textureId(), attachment.m_mipLevel); - else if (target == QOpenGLTexture::Target1D) - m_fboFuncs->glFramebufferTexture1D(GL_DRAW_FRAMEBUFFER, attr, target, texture->textureId(), attachment.m_mipLevel); - else if (target == QOpenGLTexture::Target2D || target == QOpenGLTexture::TargetRectangle) - m_fboFuncs->glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, attr, target, texture->textureId(), attachment.m_mipLevel); - else - qCritical() << "Texture format not supported for Attachment on OpenGL 2.0"; - texture->release(); + GLenum attr = GL_DEPTH_STENCIL_ATTACHMENT; + + if (attachment.m_point <= QRenderTargetOutput::Color15) + attr = GL_COLOR_ATTACHMENT0 + attachment.m_point; + else if (attachment.m_point == QRenderTargetOutput::Depth) + attr = GL_DEPTH_ATTACHMENT; + else if (attachment.m_point == QRenderTargetOutput::Stencil) + attr = GL_STENCIL_ATTACHMENT; + else + qCritical() << "DepthStencil Attachment not supported on OpenGL 2.0"; + + const QOpenGLTexture::Target target = texture->target(); + + if (target == QOpenGLTexture::TargetCubeMap && attachment.m_face == QAbstractTexture::AllFaces) { + qWarning() << "OpenGL 2.0 doesn't handle attaching all the faces of a cube map texture at once to an FBO"; + return; } + + texture->bind(); + if (target == QOpenGLTexture::TargetCubeMap) + m_extraFunctions->glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, attr, attachment.m_face, texture->textureId(), attachment.m_mipLevel); + else if (target == QOpenGLTexture::Target2D || target == QOpenGLTexture::TargetRectangle) + m_extraFunctions->glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, attr, target, texture->textureId(), attachment.m_mipLevel); + else + qCritical() << "Texture format not supported for Attachment on OpenGL 2.0"; + texture->release(); } void GraphicsHelperGL2::bindFrameBufferAttachment(RenderBuffer *renderBuffer, const Attachment &attachment) @@ -448,7 +428,6 @@ bool GraphicsHelperGL2::supportsFeature(GraphicsHelperInterface::Feature feature { switch (feature) { case MRT: - return (m_fboFuncs != nullptr); case TextureDimensionRetrieval: case MapBuffer: return true; @@ -463,7 +442,7 @@ void GraphicsHelperGL2::drawBuffers(GLsizei n, const int *bufs) for (int i = 0; i < n; i++) drawBufs[i] = GL_COLOR_ATTACHMENT0 + bufs[i]; - m_funcs->glDrawBuffers(n, drawBufs.constData()); + m_extraFunctions->glDrawBuffers(n, drawBufs.constData()); } void GraphicsHelperGL2::bindFragDataLocation(GLuint, const QHash<QString, int> &) @@ -473,21 +452,17 @@ void GraphicsHelperGL2::bindFragDataLocation(GLuint, const QHash<QString, int> & void GraphicsHelperGL2::bindFrameBufferObject(GLuint frameBufferId, FBOBindMode mode) { - if (m_fboFuncs != nullptr) { - switch (mode) { - case FBODraw: - m_fboFuncs->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, frameBufferId); - return; - case FBORead: - m_fboFuncs->glBindFramebuffer(GL_READ_FRAMEBUFFER, frameBufferId); - return; - case FBOReadAndDraw: - default: - m_fboFuncs->glBindFramebuffer(GL_FRAMEBUFFER, frameBufferId); - return; - } - } else { - qWarning() << "FBO not supported by your OpenGL hardware"; + switch (mode) { + case FBODraw: + m_extraFunctions->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, frameBufferId); + return; + case FBORead: + m_extraFunctions->glBindFramebuffer(GL_READ_FRAMEBUFFER, frameBufferId); + return; + case FBOReadAndDraw: + default: + m_extraFunctions->glBindFramebuffer(GL_FRAMEBUFFER, frameBufferId); + return; } } @@ -509,7 +484,7 @@ void GraphicsHelperGL2::bindImageTexture(GLuint imageUnit, GLuint texture, GLuint GraphicsHelperGL2::boundFrameBufferObject() { GLint id = 0; - m_funcs->glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &id); + m_extraFunctions->glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &id); return id; } diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl2_p.h b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl2_p.h index cb38ea481..f6ab6c409 100644 --- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl2_p.h +++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl2_p.h @@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE class QOpenGLFunctions_2_0; -class QOpenGLExtension_ARB_framebuffer_object; +class QOpenGLExtraFunctions; namespace Qt3DRender { namespace Render { @@ -171,7 +171,7 @@ public: private: QOpenGLFunctions_2_0 *m_funcs; - QOpenGLExtension_ARB_framebuffer_object *m_fboFuncs; + QOpenGLExtraFunctions *m_extraFunctions; }; } // namespace OpenGL diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_2.cpp b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_2.cpp index 021c668b2..7cbcaabb4 100644 --- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_2.cpp +++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_2.cpp @@ -42,7 +42,6 @@ #if !QT_CONFIG(opengles2) #include <QOpenGLFunctions_3_2_Core> #include <QOpenGLFunctions_3_3_Core> -#include <QtOpenGLExtensions/qopenglextensions.h> #include <private/attachmentpack_p.h> #include <logging_p.h> #include <qgraphicsutils_p.h> @@ -74,7 +73,6 @@ namespace OpenGL { GraphicsHelperGL3_2::GraphicsHelperGL3_2() : m_funcs(nullptr) - , m_tessFuncs() { } @@ -89,11 +87,6 @@ void GraphicsHelperGL3_2::initializeHelper(QOpenGLContext *context, const bool ok = m_funcs->initializeOpenGLFunctions(); Q_ASSERT(ok); Q_UNUSED(ok); - - if (context->hasExtension(QByteArrayLiteral("GL_ARB_tessellation_shader"))) { - m_tessFuncs.reset(new QOpenGLExtension_ARB_tessellation_shader); - m_tessFuncs->initializeOpenGLFunctions(); - } } void GraphicsHelperGL3_2::drawElementsInstancedBaseVertexBaseInstance(GLenum primitiveType, @@ -172,17 +165,8 @@ void GraphicsHelperGL3_2::drawArraysIndirect(GLenum , void *) void GraphicsHelperGL3_2::setVerticesPerPatch(GLint verticesPerPatch) { -#if defined(QT_OPENGL_4) - if (!m_tessFuncs) { - qWarning() << "Tessellation not supported with OpenGL 3 without GL_ARB_tessellation_shader"; - return; - } - - m_tessFuncs->glPatchParameteri(GL_PATCH_VERTICES, verticesPerPatch); -#else Q_UNUSED(verticesPerPatch); qWarning() << "Tessellation not supported"; -#endif } void GraphicsHelperGL3_2::useProgram(GLuint programId) @@ -540,8 +524,6 @@ bool GraphicsHelperGL3_2::supportsFeature(GraphicsHelperInterface::Feature featu case BlitFramebuffer: case Fences: return true; - case Tessellation: - return !m_tessFuncs.isNull(); default: return false; } diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_2_p.h b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_2_p.h index 3e363337d..ea8c11d0b 100644 --- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_2_p.h +++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_2_p.h @@ -59,7 +59,6 @@ QT_BEGIN_NAMESPACE class QOpenGLFunctions_3_2_Core; -class QOpenGLExtension_ARB_tessellation_shader; namespace Qt3DRender { namespace Render { @@ -173,7 +172,6 @@ public: private: QOpenGLFunctions_3_2_Core *m_funcs; - QScopedPointer<QOpenGLExtension_ARB_tessellation_shader> m_tessFuncs; }; } // namespace OpenGL diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_3.cpp b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_3.cpp index 200d9c3eb..c52029acc 100644 --- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_3.cpp +++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_3.cpp @@ -41,7 +41,6 @@ #if !QT_CONFIG(opengles2) #include <QOpenGLFunctions_3_3_Core> -#include <QtOpenGLExtensions/qopenglextensions.h> #include <private/attachmentpack_p.h> #include <logging_p.h> #include <qgraphicsutils_p.h> @@ -73,7 +72,6 @@ namespace OpenGL { GraphicsHelperGL3_3::GraphicsHelperGL3_3() : m_funcs(nullptr) - , m_tessFuncs() { } @@ -88,11 +86,6 @@ void GraphicsHelperGL3_3::initializeHelper(QOpenGLContext *context, const bool ok = m_funcs->initializeOpenGLFunctions(); Q_ASSERT(ok); Q_UNUSED(ok); - - if (context->hasExtension(QByteArrayLiteral("GL_ARB_tessellation_shader"))) { - m_tessFuncs.reset(new QOpenGLExtension_ARB_tessellation_shader); - m_tessFuncs->initializeOpenGLFunctions(); - } } void GraphicsHelperGL3_3::drawElementsInstancedBaseVertexBaseInstance(GLenum primitiveType, @@ -171,17 +164,8 @@ void GraphicsHelperGL3_3::drawArraysIndirect(GLenum , void *) void GraphicsHelperGL3_3::setVerticesPerPatch(GLint verticesPerPatch) { -#if defined(QT_OPENGL_4) - if (!m_tessFuncs) { - qWarning() << "Tessellation not supported with OpenGL 3 without GL_ARB_tessellation_shader"; - return; - } - - m_tessFuncs->glPatchParameteri(GL_PATCH_VERTICES, verticesPerPatch); -#else Q_UNUSED(verticesPerPatch); qWarning() << "Tessellation not supported"; -#endif } void GraphicsHelperGL3_3::useProgram(GLuint programId) @@ -521,8 +505,6 @@ bool GraphicsHelperGL3_3::supportsFeature(GraphicsHelperInterface::Feature featu case BlitFramebuffer: case Fences: return true; - case Tessellation: - return !m_tessFuncs.isNull(); default: return false; } diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_3_p.h b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_3_p.h index 68eebe987..31f2b5383 100644 --- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_3_p.h +++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_3_p.h @@ -59,7 +59,6 @@ QT_BEGIN_NAMESPACE class QOpenGLFunctions_3_3_Core; -class QOpenGLExtension_ARB_tessellation_shader; namespace Qt3DRender { namespace Render { @@ -173,7 +172,6 @@ public: private: QOpenGLFunctions_3_3_Core *m_funcs; - QScopedPointer<QOpenGLExtension_ARB_tessellation_shader> m_tessFuncs; }; } // namespace OpenGL diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl4.cpp b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl4.cpp index 0a36e6a24..5bd1e03e4 100644 --- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl4.cpp +++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl4.cpp @@ -41,7 +41,6 @@ #if !QT_CONFIG(opengles2) #include <QOpenGLFunctions_4_3_Core> -#include <QtOpenGLExtensions/qopenglextensions.h> #include <private/attachmentpack_p.h> #include <qgraphicsutils_p.h> #include <logging_p.h> diff --git a/src/plugins/renderers/opengl/opengl.pri b/src/plugins/renderers/opengl/opengl.pri index 657eb8556..e484383fc 100644 --- a/src/plugins/renderers/opengl/opengl.pri +++ b/src/plugins/renderers/opengl/opengl.pri @@ -1,5 +1,4 @@ QT += core-private gui-private 3dcore 3dcore-private 3drender 3drender-private opengl-private -QT_PRIVATE = openglextensions # Qt3D is free of Q_FOREACH - make sure it stays that way: DEFINES += QT_NO_FOREACH diff --git a/src/quick3d/quick3dscene2d/items/scene2d.cpp b/src/quick3d/quick3dscene2d/items/scene2d.cpp index c4a59c5df..812edc79a 100644 --- a/src/quick3d/quick3dscene2d/items/scene2d.cpp +++ b/src/quick3d/quick3dscene2d/items/scene2d.cpp @@ -244,7 +244,7 @@ void Scene2D::initializeRender() m_context->create(); m_context->makeCurrent(m_sharedObject->m_surface); - m_sharedObject->m_renderControl->initialize(m_context); + m_sharedObject->m_renderControl->initialize(); m_context->doneCurrent(); QCoreApplication::postEvent(m_sharedObject->m_renderManager, diff --git a/tests/auto/render/opengl/graphicshelpergl2/graphicshelpergl2.pro b/tests/auto/render/opengl/graphicshelpergl2/graphicshelpergl2.pro index eb8ba7f04..e9ce754e6 100644 --- a/tests/auto/render/opengl/graphicshelpergl2/graphicshelpergl2.pro +++ b/tests/auto/render/opengl/graphicshelpergl2/graphicshelpergl2.pro @@ -2,7 +2,7 @@ TEMPLATE = app TARGET = tst_graphicshelpergl2 -QT += 3dcore 3dcore-private 3drender 3drender-private testlib openglextensions +QT += 3dcore 3dcore-private 3drender 3drender-private testlib CONFIG += testcase diff --git a/tests/auto/render/opengl/graphicshelpergl2/tst_graphicshelpergl2.cpp b/tests/auto/render/opengl/graphicshelpergl2/tst_graphicshelpergl2.cpp index f733697f7..0f9fdb96c 100644 --- a/tests/auto/render/opengl/graphicshelpergl2/tst_graphicshelpergl2.cpp +++ b/tests/auto/render/opengl/graphicshelpergl2/tst_graphicshelpergl2.cpp @@ -31,11 +31,11 @@ #include <Qt3DRender/private/uniform_p.h> #include <graphicshelpergl2_p.h> #include <Qt3DRender/private/attachmentpack_p.h> -#include <QtOpenGLExtensions/QOpenGLExtensions> #include <QOpenGLContext> #include <QOpenGLVersionFunctionsFactory> #include <QOpenGLBuffer> #include <QOpenGLFunctions_2_0> +#include <QOpenGLExtraFunctions> #include <QOpenGLShaderProgram> #include <QOpenGLVertexArrayObject> #include <QSurfaceFormat> @@ -155,10 +155,7 @@ private Q_SLOTS: } if ((m_func = QOpenGLVersionFunctionsFactory::get<QOpenGLFunctions_2_0>()) != nullptr) { - if (m_glContext.hasExtension(QByteArrayLiteral("GL_ARB_framebuffer_object"))) { - m_fboFuncs = new QOpenGLExtension_ARB_framebuffer_object(); - m_fboFuncs->initializeOpenGLFunctions(); - } + m_extraFunctions = m_glContext.extraFunctions(); m_glHelper.initializeHelper(&m_glContext, m_func); m_initializationSuccessful = true; } @@ -196,12 +193,9 @@ private Q_SLOTS: if (!m_initializationSuccessful) QSKIP("Initialization failed, OpenGL 2.0 functions not supported"); - if (!m_fboFuncs) - QSKIP("FBO not supported by OpenGL 2.0"); - // GIVEN GLuint fboId; - m_fboFuncs->glGenFramebuffers(1, &fboId); + m_extraFunctions->glGenFramebuffers(1, &fboId); Attachment attachment; attachment.m_point = QRenderTargetOutput::Color0; @@ -210,7 +204,7 @@ private Q_SLOTS: QVERIFY(fboId != 0); // WHEN - m_fboFuncs->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fboId); + m_extraFunctions->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fboId); QOpenGLTexture texture(QOpenGLTexture::Target2D); texture.setSize(512, 512); @@ -227,33 +221,31 @@ private Q_SLOTS: m_glHelper.bindFrameBufferAttachment(&texture, attachment); // THEN - GLenum status = m_fboFuncs->glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER); + GLenum status = m_extraFunctions->glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER); QVERIFY(status == GL_FRAMEBUFFER_COMPLETE); error = m_func->glGetError(); QVERIFY(error == 0); GLint textureAttachmentId = 0; - m_fboFuncs->glGetFramebufferAttachmentParameteriv(GL_DRAW_FRAMEBUFFER, + m_extraFunctions->glGetFramebufferAttachmentParameteriv(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, &textureAttachmentId); QCOMPARE(GLuint(textureAttachmentId), texture.textureId()); // Restore state - m_fboFuncs->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); - m_fboFuncs->glDeleteFramebuffers(1, &fboId); + m_extraFunctions->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); + m_extraFunctions->glDeleteFramebuffers(1, &fboId); } void bindFrameBufferObject() { if (!m_initializationSuccessful) QSKIP("Initialization failed, OpenGL 2.0 functions not supported"); - if (!m_fboFuncs) - QSKIP("FBO not supported by OpenGL 2.0"); // GIVEN GLuint fboId; - m_fboFuncs->glGenFramebuffers(1, &fboId); + m_extraFunctions->glGenFramebuffers(1, &fboId); // THEN QVERIFY(fboId != 0); @@ -289,7 +281,7 @@ private Q_SLOTS: QVERIFY(GLuint(boundindFBOId) == fboId); // Cleanup - m_fboFuncs->glDeleteFramebuffers(1, &fboId); + m_extraFunctions->glDeleteFramebuffers(1, &fboId); } void bindShaderStorageBlock() @@ -342,15 +334,13 @@ private Q_SLOTS: { if (!m_initializationSuccessful) QSKIP("Initialization failed, OpenGL 2.0 functions not supported"); - if (!m_fboFuncs) - QSKIP("FBO not supported by OpenGL 2.0"); // GIVEN GLuint fboId; - m_fboFuncs->glGenFramebuffers(1, &fboId); + m_extraFunctions->glGenFramebuffers(1, &fboId); // WHEN - m_fboFuncs->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fboId); + m_extraFunctions->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fboId); // THEN GLint boundBuffer = 0; @@ -361,25 +351,23 @@ private Q_SLOTS: QCOMPARE(m_glHelper.boundFrameBufferObject(), fboId); // Reset state - m_fboFuncs->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); - m_fboFuncs->glDeleteFramebuffers(1, &fboId); + m_extraFunctions->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); + m_extraFunctions->glDeleteFramebuffers(1, &fboId); } void checkFrameBufferComplete() { if (!m_initializationSuccessful) QSKIP("Initialization failed, OpenGL 2.0 functions not supported"); - if (!m_fboFuncs) - QSKIP("FBO not supported by OpenGL 2.0"); // GIVEN GLuint fboId; - m_fboFuncs->glGenFramebuffers(1, &fboId); + m_extraFunctions->glGenFramebuffers(1, &fboId); Attachment attachment; attachment.m_point = QRenderTargetOutput::Color0; - m_fboFuncs->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fboId); + m_extraFunctions->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fboId); QOpenGLTexture texture(QOpenGLTexture::Target2D); texture.setSize(512, 512); @@ -391,14 +379,14 @@ private Q_SLOTS: m_glHelper.bindFrameBufferAttachment(&texture, attachment); // THEN - GLenum status = m_fboFuncs->glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER); + GLenum status = m_extraFunctions->glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER); QVERIFY(status == GL_FRAMEBUFFER_COMPLETE); QVERIFY(m_glHelper.checkFrameBufferComplete()); // Restore - m_fboFuncs->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); - m_fboFuncs->glDeleteFramebuffers(1, &fboId); + m_extraFunctions->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); + m_extraFunctions->glDeleteFramebuffers(1, &fboId); } void clearBufferf() @@ -412,8 +400,6 @@ private Q_SLOTS: { if (!m_initializationSuccessful) QSKIP("Initialization failed, OpenGL 2.0 functions not supported"); - if (!m_fboFuncs) - QSKIP("FBO not supported by OpenGL 2.0"); // WHEN const GLuint fboId = m_glHelper.createFrameBufferObject(); @@ -422,7 +408,7 @@ private Q_SLOTS: QVERIFY(fboId != 0); // Restore - m_fboFuncs->glDeleteFramebuffers(1, &fboId); + m_extraFunctions->glDeleteFramebuffers(1, &fboId); } void depthMask() @@ -514,18 +500,15 @@ private Q_SLOTS: if (!m_initializationSuccessful) QSKIP("Initialization failed, OpenGL 2.0 functions not supported"); - if (!m_fboFuncs) - QSKIP("FBO not supported by OpenGL 2.0"); - // GIVEN GLuint fboId; - m_fboFuncs->glGenFramebuffers(1, &fboId); + m_extraFunctions->glGenFramebuffers(1, &fboId); // THEN QVERIFY(fboId != 0); // WHEN - m_fboFuncs->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fboId); + m_extraFunctions->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fboId); QOpenGLTexture *textures[4]; // Create 4 attachments @@ -549,7 +532,7 @@ private Q_SLOTS: m_glHelper.bindFrameBufferAttachment(texture, attachment); } // THEN - GLenum status = m_fboFuncs->glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER); + GLenum status = m_extraFunctions->glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER); QVERIFY(status == GL_FRAMEBUFFER_COMPLETE); // WHEN @@ -578,8 +561,8 @@ private Q_SLOTS: QCOMPARE(enumValue, GL_COLOR_ATTACHMENT0 + newBufferEnum); // Restore - m_fboFuncs->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); - m_fboFuncs->glDeleteFramebuffers(1, &fboId); + m_extraFunctions->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); + m_extraFunctions->glDeleteFramebuffers(1, &fboId); for (int i = 0; i < 4; ++i) delete textures[i]; } @@ -827,11 +810,9 @@ private Q_SLOTS: { if (!m_initializationSuccessful) QSKIP("Initialization failed, OpenGL 2.0 functions not supported"); - if (!m_fboFuncs) - QSKIP("FBO not supported by OpenGL 2.0"); - // GIVEN + // GIVEN GLuint fboId; - m_fboFuncs->glGenFramebuffers(1, &fboId); + m_extraFunctions->glGenFramebuffers(1, &fboId); // THEN QVERIFY(fboId != 0); @@ -840,7 +821,7 @@ private Q_SLOTS: m_glHelper.releaseFrameBufferObject(fboId); // THEN - QVERIFY(!m_fboFuncs->glIsFramebuffer(fboId)); + QVERIFY(!m_extraFunctions->glIsFramebuffer(fboId)); } void setMSAAEnabled() @@ -916,7 +897,6 @@ private Q_SLOTS: void supportsFeature() { - SUPPORTS_FEATURE(GraphicsHelperInterface::MRT, (m_fboFuncs != nullptr)); SUPPORTS_FEATURE(GraphicsHelperInterface::UniformBufferObject, false); SUPPORTS_FEATURE(GraphicsHelperInterface::BindableFragmentOutputs, false); SUPPORTS_FEATURE(GraphicsHelperInterface::PrimitiveRestart, false); @@ -1582,7 +1562,7 @@ private: QOpenGLContext m_glContext; GraphicsHelperGL2 m_glHelper; QOpenGLFunctions_2_0 *m_func = nullptr; - QOpenGLExtension_ARB_framebuffer_object *m_fboFuncs = nullptr; + QOpenGLExtraFunctions *m_extraFunctions; bool m_initializationSuccessful = false; }; diff --git a/tests/benchmarks/render/jobs/CMakeLists.txt b/tests/benchmarks/render/jobs/CMakeLists.txt index 7f143b845..e9a956327 100644 --- a/tests/benchmarks/render/jobs/CMakeLists.txt +++ b/tests/benchmarks/render/jobs/CMakeLists.txt @@ -61,8 +61,6 @@ qt_add_benchmark(tst_bench_jobs ../../../../src/plugins/renderers/opengl/managers ../../../../src/plugins/renderers/opengl/renderer ../../../../src/plugins/renderers/opengl/textures - LIBRARIES - Qt::OpenGLExtensions PUBLIC_LIBRARIES Qt::3DCore Qt::3DCorePrivate diff --git a/tests/benchmarks/render/materialparametergathering/CMakeLists.txt b/tests/benchmarks/render/materialparametergathering/CMakeLists.txt index 1e4b7f107..a979ff392 100644 --- a/tests/benchmarks/render/materialparametergathering/CMakeLists.txt +++ b/tests/benchmarks/render/materialparametergathering/CMakeLists.txt @@ -62,8 +62,6 @@ qt_add_test(tst_bench_materialparametergathering ../../../../src/plugins/renderers/opengl/renderer ../../../../src/plugins/renderers/opengl/textures ../../../auto/render/commons - LIBRARIES - Qt::OpenGLExtensions PUBLIC_LIBRARIES Qt::3DCore Qt::3DCorePrivate diff --git a/tests/benchmarks/render/opengl/shaderparameterpack/CMakeLists.txt b/tests/benchmarks/render/opengl/shaderparameterpack/CMakeLists.txt index d1ad1bc1e..c1d144271 100644 --- a/tests/benchmarks/render/opengl/shaderparameterpack/CMakeLists.txt +++ b/tests/benchmarks/render/opengl/shaderparameterpack/CMakeLists.txt @@ -62,8 +62,6 @@ qt_add_test(tst_bench_shaderparameterpack ../../../../../src/plugins/renderers/opengl/renderer ../../../../../src/plugins/renderers/opengl/textures ../../../../auto/render/commons - LIBRARIES - Qt::OpenGLExtensions PUBLIC_LIBRARIES Qt::3DCore Qt::3DCorePrivate diff --git a/tests/manual/quickwidget-switch/main.cpp b/tests/manual/quickwidget-switch/main.cpp index ebadc458d..f3e9d0fc0 100644 --- a/tests/manual/quickwidget-switch/main.cpp +++ b/tests/manual/quickwidget-switch/main.cpp @@ -48,7 +48,6 @@ ** ****************************************************************************/ -#include <QDesktopWidget> #include <QScreen> #include <QApplication> #include <QMainWindow> |