diff options
53 files changed, 171 insertions, 191 deletions
diff --git a/.cmake.conf b/.cmake.conf index edaf93dfc..6d1e4c122 100644 --- a/.cmake.conf +++ b/.cmake.conf @@ -1,4 +1,4 @@ -set(QT_REPO_MODULE_VERSION "6.8.0") +set(QT_REPO_MODULE_VERSION "6.9.0") set(QT_REPO_MODULE_PRERELEASE_VERSION_SEGMENT "alpha1") set(QT_REPO_PUBLIC_NAMESPACE_REGEX "^::Qt3D.*") diff --git a/coin/module_config.yaml b/coin/module_config.yaml index 16d158c6b..e04ab573e 100644 --- a/coin/module_config.yaml +++ b/coin/module_config.yaml @@ -6,7 +6,18 @@ accept_configuration: instructions: Build: - - !include "{{qt/qtbase}}/coin_module_build_template_v2.yaml" - + - type: Group + instructions: + - !include "{{qt/qtbase}}/coin_module_build_template_v2.yaml" + disable_if: + condition: property + property: configureArgs + contains_value: "-no-opengl" Test: - - !include "{{qt/qtbase}}/coin_module_test_template_v3.yaml" + - type: Group + instructions: + - !include "{{qt/qtbase}}/coin_module_test_template_v3.yaml" + disable_if: + condition: property + property: configureArgs + contains_value: "-no-opengl" diff --git a/dependencies.yaml b/dependencies.yaml index 1d0878b64..990d012ae 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -1,13 +1,13 @@ dependencies: ../qtbase: - ref: 0cd5eb895cc96126a495eb3d2d258be47eed193a + ref: 691f6b5b0c9dc69f8d019abc53747e7a6bbf6ef8 required: true ../qtdeclarative: - ref: c63bb2bad5b4e741ed8a1e16d8f1f916c9baf61d + ref: 2bc2d014e800ce6386446d8e22c826717e31a381 required: false ../qtmultimedia: - ref: ceafdc0436e5ab3fccf64f0eb688bd0e0656fa7f + ref: a2fb3ff754d44fccc68b1472b519cfee358fbb13 required: false ../qtshadertools: - ref: c11b69d81c83cb0d78e5de07b71b4eb1e8ae8a11 + ref: d119ba53667c16576c9fa894eb029833c4102835 required: false diff --git a/src/3rdparty/assimp/qt_attribution.json b/src/3rdparty/assimp/qt_attribution.json index 544ea4f48..c5f378fc8 100644 --- a/src/3rdparty/assimp/qt_attribution.json +++ b/src/3rdparty/assimp/qt_attribution.json @@ -5,8 +5,8 @@ "Description": "assimp (Open Asset Import Library) is a portable open source library to import various well-known 3D model formats in a uniform manner.", "QtUsage": "Used for importing assets for use with Qt Quick 3D", "Homepage": "http://www.assimp.org/", - "Version": "5.4.0", - "DownloadLocation": "https://github.com/assimp/assimp/releases/tag/v5.4.0", + "Version": "5.4.1", + "DownloadLocation": "https://github.com/assimp/assimp/releases/tag/v5.4.1", "License": "BSD 3-clause \"New\" or \"Revised\" Licensee", "LicenseId": "BSD-3-Clause", "LicenseFile": "LICENSE", diff --git a/src/3rdparty/assimp/revision.h b/src/3rdparty/assimp/revision.h index 47b3794ba..cf7d50fce 100644 --- a/src/3rdparty/assimp/revision.h +++ b/src/3rdparty/assimp/revision.h @@ -1,12 +1,12 @@ #ifndef ASSIMP_REVISION_H_INC #define ASSIMP_REVISION_H_INC -#define GitVersion 0x8b9ed34e +#define GitVersion 0x10df90ec #define GitBranch "HEAD" #define VER_MAJOR 5 #define VER_MINOR 4 -#define VER_PATCH 0 +#define VER_PATCH 1 #define VER_BUILD 0 #define STR_HELP(x) #x @@ -16,7 +16,7 @@ #if (GitVersion == 0) #define VER_FILEVERSION_STR STR(VER_MAJOR) "." STR(VER_MINOR) "." STR(VER_PATCH) "." STR(VER_BUILD) #else -#define VER_FILEVERSION_STR STR(VER_MAJOR) "." STR(VER_MINOR) "." STR(VER_PATCH) "." STR(VER_BUILD) " (Commit 5a38cd0a)" +#define VER_FILEVERSION_STR STR(VER_MAJOR) "." STR(VER_MINOR) "." STR(VER_PATCH) "." STR(VER_BUILD) " (Commit 10df90ec)" #endif #ifdef NDEBUG diff --git a/src/3rdparty/assimp/src b/src/3rdparty/assimp/src -Subproject 5967dee48b0b8ed32a41579559570e380462a1d +Subproject b4e1eedbf7db8ddd793ed45f8e81eccb6b40599 diff --git a/src/3rdparty/imgui/qt_attribution.json b/src/3rdparty/imgui/qt_attribution.json index 2ba24ecba..cb68c8f55 100644 --- a/src/3rdparty/imgui/qt_attribution.json +++ b/src/3rdparty/imgui/qt_attribution.json @@ -28,7 +28,7 @@ "Copyright": "Copyright (c) 2004, 2005 Tristan Grimmer" }, { - "Id": "imgui-proggyclean", + "Id": "imgui-stb", "Name": "Dear ImGui - stb", "QDocModule": "qt3d", "Description": "Single-file public domain (or MIT licensed) libraries for C/C++", diff --git a/src/core/doc/src/qt3danimation-module.qdoc b/src/core/doc/src/qt3danimation-module.qdoc index 85f9150c7..ffdf51c12 100644 --- a/src/core/doc/src/qt3danimation-module.qdoc +++ b/src/core/doc/src/qt3danimation-module.qdoc @@ -6,6 +6,8 @@ \module Qt3DAnimation \title Qt 3D Animation C++ Classes \preliminary + \modulestate Deprecated + \deprecated [6.8] \keyword Qt 3D Animation \brief The Qt 3D Animation modules provides a set of prebuilt elements to help @@ -195,6 +197,8 @@ \qmlmodule Qt3D.Animation 2.\QtMinorVersion \title Qt 3D Qt3DAnimation QML Types \preliminary + \modulestate Deprecated + \deprecated [6.8] \ingroup qmlmodules \ingroup qt3d-qmlmodules-preliminary diff --git a/src/core/doc/src/qt3dcore-module.qdoc b/src/core/doc/src/qt3dcore-module.qdoc index 22f457c3d..2af8691f2 100644 --- a/src/core/doc/src/qt3dcore-module.qdoc +++ b/src/core/doc/src/qt3dcore-module.qdoc @@ -7,6 +7,8 @@ \keyword Qt 3D Core \brief The Qt 3D module contains functionality to support near-realtime simulation systems. \since 5.7 + \modulestate Deprecated + \deprecated [6.8] \ingroup modules \ingroup qt3d-modules @@ -33,6 +35,8 @@ \ingroup qmlmodules \ingroup qt3d-qmlmodules \since 5.7 + \modulestate Deprecated + \deprecated [6.8] \brief Provides core Qt 3D QML types. diff --git a/src/core/doc/src/qt3dextras-module.qdoc b/src/core/doc/src/qt3dextras-module.qdoc index f6e05e0c0..f89e99374 100644 --- a/src/core/doc/src/qt3dextras-module.qdoc +++ b/src/core/doc/src/qt3dextras-module.qdoc @@ -6,6 +6,8 @@ \title Qt 3D Extras C++ Classes \keyword Qt 3D Extras \preliminary + \modulestate Deprecated + \deprecated [6.8] \brief The Qt 3D Extras module provides a set of prebuilt elements to help you get started with Qt 3D. @@ -83,6 +85,8 @@ \qmlmodule Qt3D.Extras 2.\QtMinorVersion \title Qt 3D Extras QML Types \preliminary + \modulestate Deprecated + \deprecated [6.8] \ingroup qmlmodules \ingroup qt3d-qmlmodules-preliminary diff --git a/src/core/doc/src/qt3dinput-module.qdoc b/src/core/doc/src/qt3dinput-module.qdoc index a0aaaf36a..add397726 100644 --- a/src/core/doc/src/qt3dinput-module.qdoc +++ b/src/core/doc/src/qt3dinput-module.qdoc @@ -7,6 +7,8 @@ \brief The Qt 3D Input module provides classes for handling user input in applications using Qt3D. \since 5.7 + \modulestate Deprecated + \deprecated [6.8] \ingroup modules \ingroup qt3d-modules @@ -38,6 +40,8 @@ \qmlmodule Qt3D.Input 2.\QtMinorVersion \title Qt 3D Input QML Types \since 5.7 + \modulestate Deprecated + \deprecated [6.8] \ingroup qmlmodules \ingroup qt3d-qmlmodules diff --git a/src/core/doc/src/qt3dlogic-module.qdoc b/src/core/doc/src/qt3dlogic-module.qdoc index 2b2557ca3..65134fb2c 100644 --- a/src/core/doc/src/qt3dlogic-module.qdoc +++ b/src/core/doc/src/qt3dlogic-module.qdoc @@ -6,6 +6,8 @@ \title Qt 3D Logic C++ Classes \keyword Qt 3D Logic \since 5.7 + \modulestate Deprecated + \deprecated [6.8] \brief The Qt 3D Logic module enables synchronizing frames with the Qt 3D backend. @@ -40,6 +42,8 @@ \qmlmodule Qt3D.Logic 2.\QtMinorVersion \title Qt 3D Logic QML Types \since 5.7 + \modulestate Deprecated + \deprecated [6.8] \ingroup qmlmodules \ingroup qt3d-qmlmodules diff --git a/src/core/doc/src/qt3drender-module.qdoc b/src/core/doc/src/qt3drender-module.qdoc index 5bf66db3a..b64ef3d3e 100644 --- a/src/core/doc/src/qt3drender-module.qdoc +++ b/src/core/doc/src/qt3drender-module.qdoc @@ -7,6 +7,8 @@ \brief The Qt 3D Render module contains functionality to support 2D and 3D rendering using Qt 3D. \since 5.7 + \modulestate Deprecated + \deprecated [6.8] \ingroup modules \ingroup qt3d-modules @@ -89,6 +91,8 @@ \qmlmodule Qt3D.Render 2.\QtMinorVersion \title Qt 3D Render QML Types \since 5.7 + \modulestate Deprecated + \deprecated [6.8] \ingroup qmlmodules \ingroup qt3d-qmlmodules diff --git a/src/core/doc/src/qt3dscene2d-module.qdoc b/src/core/doc/src/qt3dscene2d-module.qdoc index 75a49f949..dc73aa9b6 100644 --- a/src/core/doc/src/qt3dscene2d-module.qdoc +++ b/src/core/doc/src/qt3dscene2d-module.qdoc @@ -6,6 +6,8 @@ \title Qt 3D Scene2D C++ Classes \keyword Qt 3D Scene2D \preliminary + \modulestate Deprecated + \deprecated [6.8] \brief The Qt 3D Scene2D module provides a way to render Quick2 qml content to a Qt 3D texture. @@ -51,6 +53,8 @@ \title Qt 3D Scene2D QML Types \ingroup qmlmodules \ingroup qt3d-qmlmodules-preliminary + \modulestate Deprecated + \deprecated [6.8] \brief Provides Qt 3D QML types for the scene2d module. diff --git a/src/core/doc/src/qt3dscene3d-module.qdoc b/src/core/doc/src/qt3dscene3d-module.qdoc index d825a9ea4..f9906be66 100644 --- a/src/core/doc/src/qt3dscene3d-module.qdoc +++ b/src/core/doc/src/qt3dscene3d-module.qdoc @@ -7,6 +7,8 @@ \title Qt 3D Scene3D QML Types \ingroup qmlmodules \ingroup qt3d-qmlmodules-preliminary + \modulestate Deprecated + \deprecated [6.8] \brief Provides Qt 3D QML types for the Scene3D module. diff --git a/src/extras/defaults/qabstractcameracontroller.cpp b/src/extras/defaults/qabstractcameracontroller.cpp index f3eb03f00..fdf81aac1 100644 --- a/src/extras/defaults/qabstractcameracontroller.cpp +++ b/src/extras/defaults/qabstractcameracontroller.cpp @@ -223,9 +223,6 @@ void QAbstractCameraControllerPrivate::applyInputAccelerations() mouse, and other devices. QAbstractCameraController is an abstract class and cannot itself be instantiated. It provides a standard interface for camera controllers. - - Derived classes need only implement the frameActionTriggered() - method to move the camera. */ /*! diff --git a/src/extras/shaders/rhi/distancefieldtext.frag b/src/extras/shaders/rhi/distancefieldtext.frag index ec42f5056..4a71d3381 100644 --- a/src/extras/shaders/rhi/distancefieldtext.frag +++ b/src/extras/shaders/rhi/distancefieldtext.frag @@ -8,7 +8,7 @@ layout(location = 0) out vec4 fragColor; layout(std140, binding = 2) uniform qt3d_custom_uniforms { float minAlpha; float maxAlpha; - float textureSize; + float textureWidth; vec4 color; }; layout(binding = 3) uniform sampler2D distanceFieldTexture; @@ -19,7 +19,7 @@ void main() // (that is, how many pixels are drawn for each texel) vec2 texelDeltaX = abs(dFdx(texCoord)); vec2 texelDeltaY = abs(dFdy(texCoord)); - float avgTexelDelta = textureSize * 0.5 * (texelDeltaX.x + texelDeltaX.y + texelDeltaY.x + texelDeltaY.y); + float avgTexelDelta = textureWidth * 0.5 * (texelDeltaX.x + texelDeltaX.y + texelDeltaY.x + texelDeltaY.y); float texScale = 1.0 / avgTexelDelta; // scaled to interval [0.0, 0.15] diff --git a/src/extras/text/qtext2dentity.cpp b/src/extras/text/qtext2dentity.cpp index f118ff1fe..8b096205f 100644 --- a/src/extras/text/qtext2dentity.cpp +++ b/src/extras/text/qtext2dentity.cpp @@ -465,7 +465,7 @@ void QText2DEntity::setHeight(float height) } /*! - \property QText2DEntity::alignment + \property Qt3DExtras::QText2DEntity::alignment Returns the alignment of the text item that is displayed in the Qt Quick scene. diff --git a/src/extras/text/qtext2dmaterial.cpp b/src/extras/text/qtext2dmaterial.cpp index bbb594667..57ef9227d 100644 --- a/src/extras/text/qtext2dmaterial.cpp +++ b/src/extras/text/qtext2dmaterial.cpp @@ -28,7 +28,7 @@ QText2DMaterialPrivate::QText2DMaterialPrivate() , m_effect(new Qt3DRender::QEffect()) , m_distanceFieldTexture(nullptr) , m_textureParameter(new Qt3DRender::QParameter(QStringLiteral("distanceFieldTexture"), QVariant(0))) - , m_textureSizeParameter(new Qt3DRender::QParameter(QStringLiteral("textureSize"), QVariant(256.f))) + , m_textureSizeParameter(new Qt3DRender::QParameter(QStringLiteral("textureWidth"), QVariant(256.f))) , m_colorParameter(new Qt3DRender::QParameter(QStringLiteral("color"), QVariant(QColor(255, 255, 255, 255)))) , m_gl3Technique(new Qt3DRender::QTechnique()) , m_gl2Technique(new Qt3DRender::QTechnique()) diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicscontext.cpp b/src/plugins/renderers/opengl/graphicshelpers/graphicscontext.cpp index b62cad811..62c5d7d30 100644 --- a/src/plugins/renderers/opengl/graphicshelpers/graphicscontext.cpp +++ b/src/plugins/renderers/opengl/graphicshelpers/graphicscontext.cpp @@ -300,22 +300,6 @@ void GraphicsContext::loadShader(Shader *shaderNode, shaderNode->requestCacheRebuild(); } -void GraphicsContext::activateDrawBuffers(const AttachmentPack &attachments) -{ - const std::vector<int> &activeDrawBuffers = attachments.getGlDrawBuffers(); - - if (m_glHelper->checkFrameBufferComplete()) { - if (activeDrawBuffers.size() > 1) {// We need MRT - if (m_glHelper->supportsFeature(GraphicsHelperInterface::MRT)) { - // Set up MRT, glDrawBuffers... - m_glHelper->drawBuffers(GLsizei(activeDrawBuffers.size()), activeDrawBuffers.data()); - } - } - } else { - qWarning() << "FBO incomplete"; - } -} - void GraphicsContext::rasterMode(GLenum faceMode, GLenum rasterMode) { m_glHelper->rasterMode(faceMode, rasterMode); @@ -726,7 +710,7 @@ void GraphicsContext::drawBuffer(GLenum mode) m_glHelper->drawBuffer(mode); } -void GraphicsContext::drawBuffers(GLsizei n, const int *bufs) +void GraphicsContext::drawBuffers(GLsizei n, const GLenum *bufs) { m_glHelper->drawBuffers(n, bufs); } diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicscontext_p.h b/src/plugins/renderers/opengl/graphicshelpers/graphicscontext_p.h index cdff6fa48..f2eeb479d 100644 --- a/src/plugins/renderers/opengl/graphicshelpers/graphicscontext_p.h +++ b/src/plugins/renderers/opengl/graphicshelpers/graphicscontext_p.h @@ -134,14 +134,13 @@ public: void pointSize(bool programmable, GLfloat value); void readBuffer(GLenum mode); void drawBuffer(GLenum mode); - void drawBuffers(GLsizei n, const int *bufs); + void drawBuffers(GLsizei n, const GLenum *bufs); void setMSAAEnabled(bool enabled); void setAlphaCoverageEnabled(bool enabled); void setClipPlane(int clipPlane, const QVector3D &normal, float distance); void setSeamlessCubemap(bool enable); void setVerticesPerPatch(GLint verticesPerPatch); void memoryBarrier(QMemoryBarrier::Operations barriers); - void activateDrawBuffers(const AttachmentPack &attachments); void rasterMode(GLenum faceMode, GLenum rasterMode); // Helper methods diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes2.cpp b/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes2.cpp index accc1e757..bd6c6a8f7 100644 --- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes2.cpp +++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes2.cpp @@ -513,7 +513,7 @@ bool GraphicsHelperES2::supportsFeature(GraphicsHelperInterface::Feature feature } } -void GraphicsHelperES2::drawBuffers(GLsizei, const int *) +void GraphicsHelperES2::drawBuffers(GLsizei, const GLenum *) { static bool showWarning = true; if (!showWarning) diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes2_p.h b/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes2_p.h index 5c51cb013..fb237a4ab 100644 --- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes2_p.h +++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes2_p.h @@ -66,7 +66,7 @@ public: void drawArraysIndirect(GLenum mode,void *indirect) override; void drawArraysInstanced(GLenum primitiveType, GLint first, GLsizei count, GLsizei instances) override; void drawArraysInstancedBaseInstance(GLenum primitiveType, GLint first, GLsizei count, GLsizei instances, GLsizei baseInstance) override; - void drawBuffers(GLsizei n, const int *bufs) override; + void drawBuffers(GLsizei n, const GLenum *bufs) override; void drawElements(GLenum primitiveType, GLsizei primitiveCount, GLint indexType, void *indices, GLint baseVertex = 0) override; void drawElementsIndirect(GLenum mode, GLenum type, void *indirect) override; void drawElementsInstancedBaseVertexBaseInstance(GLenum primitiveType, GLsizei primitiveCount, GLint indexType, void *indices, GLsizei instances, GLint baseVertex = 0, GLint baseInstance = 0) override; diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3.cpp b/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3.cpp index 75876686c..486810143 100644 --- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3.cpp +++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3.cpp @@ -310,13 +310,9 @@ bool GraphicsHelperES3::supportsFeature(GraphicsHelperInterface::Feature feature } } -void GraphicsHelperES3::drawBuffers(GLsizei n, const int *bufs) +void GraphicsHelperES3::drawBuffers(GLsizei n, const GLenum *bufs) { - QVarLengthArray<GLenum, 16> drawBufs(n); - - for (int i = 0; i < n; i++) - drawBufs[i] = GL_COLOR_ATTACHMENT0 + bufs[i]; - m_extraFuncs->glDrawBuffers(n, drawBufs.constData()); + m_extraFuncs->glDrawBuffers(n, bufs); } UniformType GraphicsHelperES3::uniformTypeFromGLType(GLenum glType) diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3_p.h b/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3_p.h index 8fc12ca6d..f294decaf 100644 --- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3_p.h +++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3_p.h @@ -38,7 +38,7 @@ public: void bindUniformBlock(GLuint programId, GLuint uniformBlockIndex, GLuint uniformBlockBinding) override; void blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) override; void buildUniformBuffer(const QVariant &v, const ShaderUniform &description, QByteArray &buffer) override; - void drawBuffers(GLsizei n, const int *bufs) override; + void drawBuffers(GLsizei n, const GLenum *bufs) override; void drawArraysInstanced(GLenum primitiveType, GLint first, GLsizei count, GLsizei instances) override; void drawArraysInstancedBaseInstance(GLenum primitiveType, GLint first, GLsizei count, GLsizei instances, GLsizei baseInstance) override; void drawElementsInstancedBaseVertexBaseInstance(GLenum primitiveType, GLsizei primitiveCount, GLint indexType, void *indices, GLsizei instances, GLint baseVertex = 0, GLint baseInstance = 0) override; diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl2.cpp b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl2.cpp index 0f7195fbd..db3074cf1 100644 --- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl2.cpp +++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl2.cpp @@ -399,13 +399,9 @@ bool GraphicsHelperGL2::supportsFeature(GraphicsHelperInterface::Feature feature } } -void GraphicsHelperGL2::drawBuffers(GLsizei n, const int *bufs) +void GraphicsHelperGL2::drawBuffers(GLsizei n, const GLenum *bufs) { - QVarLengthArray<GLenum, 16> drawBufs(n); - - for (int i = 0; i < n; i++) - drawBufs[i] = GL_COLOR_ATTACHMENT0 + bufs[i]; - m_extraFunctions->glDrawBuffers(n, drawBufs.constData()); + m_extraFunctions->glDrawBuffers(n, bufs); } void GraphicsHelperGL2::bindFragDataLocation(GLuint, const QHash<QString, int> &) diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl2_p.h b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl2_p.h index 6ec59eef2..49a84cf8a 100644 --- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl2_p.h +++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl2_p.h @@ -66,7 +66,7 @@ public: void drawArraysIndirect(GLenum mode,void *indirect) override; void drawArraysInstanced(GLenum primitiveType, GLint first, GLsizei count, GLsizei instances) override; void drawArraysInstancedBaseInstance(GLenum primitiveType, GLint first, GLsizei count, GLsizei instances, GLsizei baseInstance) override; - void drawBuffers(GLsizei n, const int *bufs) override; + void drawBuffers(GLsizei n, const GLenum *bufs) override; void drawElements(GLenum primitiveType, GLsizei primitiveCount, GLint indexType, void *indices, GLint baseVertex = 0) override; void drawElementsIndirect(GLenum mode, GLenum type, void *indirect) override; void drawElementsInstancedBaseVertexBaseInstance(GLenum primitiveType, GLsizei primitiveCount, GLint indexType, void *indices, GLsizei instances, GLint baseVertex = 0, GLint baseInstance = 0) override; diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_2.cpp b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_2.cpp index 82b9c7542..d0fb10d12 100644 --- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_2.cpp +++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_2.cpp @@ -493,14 +493,9 @@ bool GraphicsHelperGL3_2::supportsFeature(GraphicsHelperInterface::Feature featu } } -void GraphicsHelperGL3_2::drawBuffers(GLsizei n, const int *bufs) +void GraphicsHelperGL3_2::drawBuffers(GLsizei n, const GLenum *bufs) { - // Use QVarLengthArray here - QVarLengthArray<GLenum, 16> drawBufs(n); - - for (int i = 0; i < n; i++) - drawBufs[i] = GL_COLOR_ATTACHMENT0 + bufs[i]; - m_funcs->glDrawBuffers(n, drawBufs.constData()); + m_funcs->glDrawBuffers(n, bufs); } void GraphicsHelperGL3_2::bindFragDataLocation(GLuint shader, const QHash<QString, int> &outputs) diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_2_p.h b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_2_p.h index 6adaf97e2..92cd17f2d 100644 --- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_2_p.h +++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_2_p.h @@ -67,7 +67,7 @@ public: void drawArraysIndirect(GLenum mode,void *indirect) override; void drawArraysInstanced(GLenum primitiveType, GLint first, GLsizei count, GLsizei instances) override; void drawArraysInstancedBaseInstance(GLenum primitiveType, GLint first, GLsizei count, GLsizei instances, GLsizei baseInstance) override; - void drawBuffers(GLsizei n, const int *bufs) override; + void drawBuffers(GLsizei n, const GLenum *bufs) override; void drawElements(GLenum primitiveType, GLsizei primitiveCount, GLint indexType, void *indices, GLint baseVertex = 0) override; void drawElementsIndirect(GLenum mode, GLenum type, void *indirect) override; void drawElementsInstancedBaseVertexBaseInstance(GLenum primitiveType, GLsizei primitiveCount, GLint indexType, void *indices, GLsizei instances, GLint baseVertex = 0, GLint baseInstance = 0) override; diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_3.cpp b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_3.cpp index c2802fae0..b46e3f500 100644 --- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_3.cpp +++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_3.cpp @@ -474,14 +474,9 @@ bool GraphicsHelperGL3_3::supportsFeature(GraphicsHelperInterface::Feature featu } } -void GraphicsHelperGL3_3::drawBuffers(GLsizei n, const int *bufs) +void GraphicsHelperGL3_3::drawBuffers(GLsizei n, const GLenum *bufs) { - // Use QVarLengthArray here - QVarLengthArray<GLenum, 16> drawBufs(n); - - for (int i = 0; i < n; i++) - drawBufs[i] = GL_COLOR_ATTACHMENT0 + bufs[i]; - m_funcs->glDrawBuffers(n, drawBufs.constData()); + m_funcs->glDrawBuffers(n, bufs); } void GraphicsHelperGL3_3::bindFragDataLocation(GLuint shader, const QHash<QString, int> &outputs) diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_3_p.h b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_3_p.h index ba4f6c76e..041c51aae 100644 --- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_3_p.h +++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_3_p.h @@ -67,7 +67,7 @@ public: void drawArraysIndirect(GLenum mode,void *indirect) override; void drawArraysInstanced(GLenum primitiveType, GLint first, GLsizei count, GLsizei instances) override; void drawArraysInstancedBaseInstance(GLenum primitiveType, GLint first, GLsizei count, GLsizei instances, GLsizei baseInstance) override; - void drawBuffers(GLsizei n, const int *bufs) override; + void drawBuffers(GLsizei n, const GLenum *bufs) override; void drawElements(GLenum primitiveType, GLsizei primitiveCount, GLint indexType, void *indices, GLint baseVertex = 0) override; void drawElementsIndirect(GLenum mode, GLenum type, void *indirect) override; void drawElementsInstancedBaseVertexBaseInstance(GLenum primitiveType, GLsizei primitiveCount, GLint indexType, void *indices, GLsizei instances, GLint baseVertex = 0, GLint baseInstance = 0) override; diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl4.cpp b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl4.cpp index c2dff740c..6a559db50 100644 --- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl4.cpp +++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl4.cpp @@ -843,14 +843,9 @@ bool GraphicsHelperGL4::supportsFeature(GraphicsHelperInterface::Feature feature } } -void GraphicsHelperGL4::drawBuffers(GLsizei n, const int *bufs) +void GraphicsHelperGL4::drawBuffers(GLsizei n, const GLenum *bufs) { - // Use QVarLengthArray here - QVarLengthArray<GLenum, 16> drawBufs(n); - - for (int i = 0; i < n; i++) - drawBufs[i] = GL_COLOR_ATTACHMENT0 + bufs[i]; - m_funcs->glDrawBuffers(n, drawBufs.constData()); + m_funcs->glDrawBuffers(n, bufs); } void GraphicsHelperGL4::bindFragDataLocation(GLuint shader, const QHash<QString, int> &outputs) diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl4_p.h b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl4_p.h index a0ca9faa4..69c0adae0 100644 --- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl4_p.h +++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl4_p.h @@ -66,7 +66,7 @@ public: void drawArraysIndirect(GLenum mode,void *indirect) override; void drawArraysInstanced(GLenum primitiveType, GLint first, GLsizei count, GLsizei instances) override; void drawArraysInstancedBaseInstance(GLenum primitiveType, GLint first, GLsizei count, GLsizei instances, GLsizei baseInstance) override; - void drawBuffers(GLsizei n, const int *bufs) override; + void drawBuffers(GLsizei n, const GLenum *bufs) override; void drawElements(GLenum primitiveType, GLsizei primitiveCount, GLint indexType, void *indices, GLint baseVertex = 0) override; void drawElementsIndirect(GLenum mode, GLenum type, void *indirect) override; void drawElementsInstancedBaseVertexBaseInstance(GLenum primitiveType, GLsizei primitiveCount, GLint indexType, void *indices, GLsizei instances, GLint baseVertex = 0, GLint baseInstance = 0) override; diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelperinterface_p.h b/src/plugins/renderers/opengl/graphicshelpers/graphicshelperinterface_p.h index ff9de8c59..2443f6304 100644 --- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelperinterface_p.h +++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelperinterface_p.h @@ -93,7 +93,7 @@ public: virtual void drawArraysIndirect(GLenum mode,void *indirect) = 0; virtual void drawArraysInstanced(GLenum primitiveType, GLint first, GLsizei count, GLsizei instances) = 0; virtual void drawArraysInstancedBaseInstance(GLenum primitiveType, GLint first, GLsizei count, GLsizei instances, GLsizei baseinstance) = 0; - virtual void drawBuffers(GLsizei n, const int *bufs) = 0; + virtual void drawBuffers(GLsizei n, const GLenum *bufs) = 0; virtual void drawElements(GLenum primitiveType, GLsizei primitiveCount, GLint indexType, void * indices, GLint baseVertex) = 0; virtual void drawElementsIndirect(GLenum mode, GLenum type, void *indirect) = 0; virtual void drawElementsInstancedBaseVertexBaseInstance(GLenum primitiveType, GLsizei primitiveCount, GLint indexType, void * indices, GLsizei instances, GLint baseVertex, GLint baseInstance) = 0; diff --git a/src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp b/src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp index eb1bd78b3..4df426b57 100644 --- a/src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp +++ b/src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp @@ -333,6 +333,16 @@ GLint glAttachmentPoint(const QRenderTargetOutput::AttachmentPoint &attachmentPo return GL_DEPTH_ATTACHMENT; case QRenderTargetOutput::Stencil: return GL_STENCIL_ATTACHMENT; + case QRenderTargetOutput::Left: +#ifndef GL_BACK_LEFT: +# define GL_BACK_LEFT 0x0402 +#endif + return GL_BACK_LEFT; + case QRenderTargetOutput::Right: +#ifndef GL_BACK_RIGHT: +# define GL_BACK_RIGHT 0x0403 +#endif + return GL_BACK_RIGHT; default: Q_UNREACHABLE_RETURN(GL_NONE); } @@ -859,17 +869,22 @@ SubmissionContext::RenderTargetInfo SubmissionContext::bindFrameBufferAttachment void SubmissionContext::activateDrawBuffers(const AttachmentPack &attachments) { - const std::vector<int> &activeDrawBuffers = attachments.getGlDrawBuffers(); + const std::vector<QRenderTargetOutput::AttachmentPoint> &activeDrawBuffers = attachments.getDrawBuffers(); + + std::vector<GLenum> activeGlDrawBuffers; + activeGlDrawBuffers.reserve(activeDrawBuffers.size()); + for (const auto &attachmentPoint : activeDrawBuffers) + activeGlDrawBuffers.push_back(glAttachmentPoint(attachmentPoint)); if (m_glHelper->checkFrameBufferComplete()) { if (activeDrawBuffers.size() > 1) {// We need MRT if (m_glHelper->supportsFeature(GraphicsHelperInterface::MRT)) { // Set up MRT, glDrawBuffers... - m_glHelper->drawBuffers(GLsizei(activeDrawBuffers.size()), activeDrawBuffers.data()); + m_glHelper->drawBuffers(GLsizei(activeGlDrawBuffers.size()), activeGlDrawBuffers.data()); } } else if (activeDrawBuffers.size() == 1){ - m_glHelper->drawBuffer(activeDrawBuffers.at(0)); + m_glHelper->drawBuffer(activeGlDrawBuffers.at(0)); } } else { qCWarning(Backend) << "FBO incomplete"; @@ -1616,7 +1631,7 @@ void SubmissionContext::blitFramebuffer(Qt3DCore::QNodeId inputRenderTargetId, if (!outputBufferIsDefault) { // Note that we use glDrawBuffers, not glDrawBuffer. The // latter is not available with GLES. - const int buf = outputAttachmentPoint; + const GLenum buf = glAttachmentPoint(outputAttachmentPoint); drawBuffers(1, &buf); } @@ -1630,7 +1645,7 @@ void SubmissionContext::blitFramebuffer(Qt3DCore::QNodeId inputRenderTargetId, // Reset draw buffer bindFramebuffer(lastDrawFboId, GraphicsHelperInterface::FBOReadAndDraw); if (outputAttachmentPoint != QRenderTargetOutput::Color0) { - const int buf = QRenderTargetOutput::Color0; + const GLenum buf = GL_COLOR_ATTACHMENT0; drawBuffers(1, &buf); } } diff --git a/src/plugins/renderers/opengl/renderer/glshader.cpp b/src/plugins/renderers/opengl/renderer/glshader.cpp index fdd2a710c..35cfef738 100644 --- a/src/plugins/renderers/opengl/renderer/glshader.cpp +++ b/src/plugins/renderers/opengl/renderer/glshader.cpp @@ -333,7 +333,7 @@ void GLShader::initializeUniformBlocks(const std::vector<ShaderUniformBlock> &un const std::vector<ShaderUniform>::const_iterator uniformsEnd = m_uniforms.cend(); std::vector<QString>::const_iterator uniformNamesIt = m_uniformsNames.cbegin(); - const std::vector<QString>::const_iterator uniformNamesEnd = m_attributesNames.cend(); + const std::vector<QString>::const_iterator uniformNamesEnd = m_uniformsNames.cend(); QHash<QString, ShaderUniform> activeUniformsInBlock; diff --git a/src/render/backend/attachmentpack.cpp b/src/render/backend/attachmentpack.cpp index a96e3affb..8f096e21c 100644 --- a/src/render/backend/attachmentpack.cpp +++ b/src/render/backend/attachmentpack.cpp @@ -47,22 +47,18 @@ AttachmentPack::AttachmentPack(const RenderTarget *target, if (drawBuffers.empty()) { m_drawBuffers.reserve(m_attachments.size()); for (const Attachment &attachment : std::as_const(m_attachments)) { - if (attachment.m_point >= QRenderTargetOutput::Color0 && attachment.m_point <= QRenderTargetOutput::Color15) - m_drawBuffers.push_back((int)attachment.m_point); - else if (attachment.m_point == QRenderTargetOutput::Left) - m_drawBuffers.push_back(GL_BACK_LEFT); - else if (attachment.m_point == QRenderTargetOutput::Right) - m_drawBuffers.push_back(GL_BACK_RIGHT); + if ((attachment.m_point >= QRenderTargetOutput::Color0 && attachment.m_point <= QRenderTargetOutput::Color15) + || attachment.m_point == QRenderTargetOutput::Left + || attachment.m_point == QRenderTargetOutput::Right) + m_drawBuffers.push_back(attachment.m_point); } } else { m_drawBuffers.reserve(drawBuffers.size()); for (QRenderTargetOutput::AttachmentPoint drawBuffer : drawBuffers) { - if (drawBuffer >= QRenderTargetOutput::Color0 && drawBuffer <= QRenderTargetOutput::Color15) - m_drawBuffers.push_back((int)drawBuffer); - else if (drawBuffer == QRenderTargetOutput::Left) - m_drawBuffers.push_back(GL_BACK_LEFT); - else if (drawBuffer == QRenderTargetOutput::Right) - m_drawBuffers.push_back(GL_BACK_RIGHT); + if ((drawBuffer >= QRenderTargetOutput::Color0 && drawBuffer <= QRenderTargetOutput::Color15) + || drawBuffer == QRenderTargetOutput::Left + || drawBuffer == QRenderTargetOutput::Right) + m_drawBuffers.push_back(drawBuffer); } } } @@ -71,7 +67,7 @@ AttachmentPack::AttachmentPack(const RenderTarget *target, int AttachmentPack::getDrawBufferIndex(QRenderTargetOutput::AttachmentPoint attachmentPoint) const { for (size_t i = 0; i < m_drawBuffers.size(); i++) - if (m_drawBuffers.at(i) == (int)attachmentPoint) + if (m_drawBuffers.at(i) == attachmentPoint) return int(i); return -1; } @@ -94,7 +90,7 @@ bool operator !=(const Attachment &a, const Attachment &b) bool operator ==(const AttachmentPack &packA, const AttachmentPack &packB) { return (packA.attachments() == packB.attachments() && - packA.getGlDrawBuffers() == packB.getGlDrawBuffers()); + packA.getDrawBuffers() == packB.getDrawBuffers()); } bool operator !=(const AttachmentPack &packA, const AttachmentPack &packB) diff --git a/src/render/backend/attachmentpack_p.h b/src/render/backend/attachmentpack_p.h index 8bc9a899f..f1d984e24 100644 --- a/src/render/backend/attachmentpack_p.h +++ b/src/render/backend/attachmentpack_p.h @@ -54,14 +54,14 @@ public: const QList<QRenderTargetOutput::AttachmentPoint> &drawBuffers = {}); const std::vector<Attachment> &attachments() const { return m_attachments; } - const std::vector<int> &getGlDrawBuffers() const { return m_drawBuffers; } + const std::vector<QRenderTargetOutput::AttachmentPoint> &getDrawBuffers() const { return m_drawBuffers; } // return index of given attachment within actual draw buffers list int getDrawBufferIndex(QRenderTargetOutput::AttachmentPoint attachmentPoint) const; private: std::vector<Attachment> m_attachments; - std::vector<int> m_drawBuffers; + std::vector<QRenderTargetOutput::AttachmentPoint> m_drawBuffers; }; Q_3DRENDERSHARED_PRIVATE_EXPORT bool operator ==(const Attachment &a, const Attachment &b); diff --git a/tests/auto/render/opengl/graphicshelpergl2/tst_graphicshelpergl2.cpp b/tests/auto/render/opengl/graphicshelpergl2/tst_graphicshelpergl2.cpp index 5299e3a46..655c67a36 100644 --- a/tests/auto/render/opengl/graphicshelpergl2/tst_graphicshelpergl2.cpp +++ b/tests/auto/render/opengl/graphicshelpergl2/tst_graphicshelpergl2.cpp @@ -520,12 +520,12 @@ private Q_SLOTS: QCOMPARE(enumValue, GL_COLOR_ATTACHMENT4); // WHEN - GLint newBufferEnum = 2; + GLenum newBufferEnum = GL_COLOR_ATTACHMENT0 + 2; m_glHelper.drawBuffers(1, &newBufferEnum); // THEN m_func->glGetIntegerv(GL_DRAW_BUFFER0, &enumValue); - QCOMPARE(enumValue, GL_COLOR_ATTACHMENT0 + newBufferEnum); + QCOMPARE(enumValue, GL_COLOR_ATTACHMENT0 + 2); // WHEN newBufferEnum = 0; @@ -533,7 +533,7 @@ private Q_SLOTS: // THEN m_func->glGetIntegerv(GL_DRAW_BUFFER0, &enumValue); - QCOMPARE(enumValue, GL_COLOR_ATTACHMENT0 + newBufferEnum); + QCOMPARE(enumValue, GL_NONE); // Restore m_extraFunctions->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); diff --git a/tests/auto/render/opengl/graphicshelpergl3_2/tst_graphicshelpergl3_2.cpp b/tests/auto/render/opengl/graphicshelpergl3_2/tst_graphicshelpergl3_2.cpp index 2b6d531b6..542374af8 100644 --- a/tests/auto/render/opengl/graphicshelpergl3_2/tst_graphicshelpergl3_2.cpp +++ b/tests/auto/render/opengl/graphicshelpergl3_2/tst_graphicshelpergl3_2.cpp @@ -720,12 +720,12 @@ private Q_SLOTS: QCOMPARE(enumValue, GL_COLOR_ATTACHMENT4); // WHEN - GLint newBufferEnum = 2; + GLenum newBufferEnum = GL_COLOR_ATTACHMENT0 + 2; m_glHelper.drawBuffers(1, &newBufferEnum); // THEN m_func->glGetIntegerv(GL_DRAW_BUFFER0, &enumValue); - QCOMPARE(enumValue, GL_COLOR_ATTACHMENT0 + newBufferEnum); + QCOMPARE(enumValue, GL_COLOR_ATTACHMENT0 + 2); // WHEN newBufferEnum = 0; @@ -733,7 +733,7 @@ private Q_SLOTS: // THEN m_func->glGetIntegerv(GL_DRAW_BUFFER0, &enumValue); - QCOMPARE(enumValue, GL_COLOR_ATTACHMENT0 + newBufferEnum); + QCOMPARE(enumValue, GL_NONE); // Restore m_func->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); diff --git a/tests/auto/render/opengl/graphicshelpergl3_3/tst_graphicshelpergl3_3.cpp b/tests/auto/render/opengl/graphicshelpergl3_3/tst_graphicshelpergl3_3.cpp index 859c18158..3f0b06097 100644 --- a/tests/auto/render/opengl/graphicshelpergl3_3/tst_graphicshelpergl3_3.cpp +++ b/tests/auto/render/opengl/graphicshelpergl3_3/tst_graphicshelpergl3_3.cpp @@ -818,12 +818,12 @@ private Q_SLOTS: QCOMPARE(enumValue, GL_COLOR_ATTACHMENT4); // WHEN - GLint newBufferEnum = 2; + GLenum newBufferEnum = GL_COLOR_ATTACHMENT0 + 2; m_glHelper.drawBuffers(1, &newBufferEnum); // THEN m_func->glGetIntegerv(GL_DRAW_BUFFER0, &enumValue); - QCOMPARE(enumValue, GL_COLOR_ATTACHMENT0 + newBufferEnum); + QCOMPARE(enumValue, GL_COLOR_ATTACHMENT0 + 2); // WHEN newBufferEnum = 0; @@ -831,7 +831,7 @@ private Q_SLOTS: // THEN m_func->glGetIntegerv(GL_DRAW_BUFFER0, &enumValue); - QCOMPARE(enumValue, GL_COLOR_ATTACHMENT0 + newBufferEnum); + QCOMPARE(enumValue, GL_NONE); // Restore m_func->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); diff --git a/tests/auto/render/opengl/graphicshelpergl4/tst_graphicshelpergl4.cpp b/tests/auto/render/opengl/graphicshelpergl4/tst_graphicshelpergl4.cpp index d706f7e8a..3a5588257 100644 --- a/tests/auto/render/opengl/graphicshelpergl4/tst_graphicshelpergl4.cpp +++ b/tests/auto/render/opengl/graphicshelpergl4/tst_graphicshelpergl4.cpp @@ -1088,21 +1088,21 @@ private Q_SLOTS: QVERIFY(status == GL_FRAMEBUFFER_COMPLETE); // WHEN + GLint enumValue = 0; GLenum bufferEnum = GL_COLOR_ATTACHMENT4; m_func->glDrawBuffers(1, &bufferEnum); // THEN - GLint enumValue = -1; m_func->glGetIntegerv(GL_DRAW_BUFFER0, &enumValue); QCOMPARE(enumValue, GL_COLOR_ATTACHMENT4); // WHEN - GLint newBufferEnum = 2; + GLenum newBufferEnum = GL_COLOR_ATTACHMENT0 + 2; m_glHelper.drawBuffers(1, &newBufferEnum); // THEN m_func->glGetIntegerv(GL_DRAW_BUFFER0, &enumValue); - QCOMPARE(enumValue, GL_COLOR_ATTACHMENT0 + newBufferEnum); + QCOMPARE(enumValue, newBufferEnum); // WHEN newBufferEnum = 0; @@ -1110,7 +1110,7 @@ private Q_SLOTS: // THEN m_func->glGetIntegerv(GL_DRAW_BUFFER0, &enumValue); - QCOMPARE(enumValue, GL_COLOR_ATTACHMENT0 + newBufferEnum); + QCOMPARE(enumValue, GL_NONE); // Restore m_func->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); diff --git a/tests/manual/buffercapture-qml/main.cpp b/tests/manual/buffercapture-qml/main.cpp index cf2f29fd4..f86a6ef71 100644 --- a/tests/manual/buffercapture-qml/main.cpp +++ b/tests/manual/buffercapture-qml/main.cpp @@ -23,14 +23,13 @@ int main(int argc, char* argv[]) Qt3DCore::QBuffer *buffer = rootObject->findChild<Qt3DCore::QBuffer*>("buffer"); QObject::connect(buffer, &Qt3DCore::QBuffer::dataChanged, - [=](const QByteArray &bytes) { - //I know I'm receiving int data - const uint *data = reinterpret_cast<const uint*>(bytes.data()); - qDebug() << "Data received"; - for (uint i = 0; i < 1024; ++i) - qDebug() << data[i]; - } - ); + &app, [=](const QByteArray &bytes) { + // I know I'm receiving int data + const uint *data = reinterpret_cast<const uint *>(bytes.data()); + qDebug() << "Data received"; + for (uint i = 0; i < 1024; ++i) + qDebug() << data[i]; + }); view.show(); diff --git a/tests/manual/deferred-renderer-cpp/deferredrenderer.cpp b/tests/manual/deferred-renderer-cpp/deferredrenderer.cpp index 67f4c822a..38ddb85f4 100644 --- a/tests/manual/deferred-renderer-cpp/deferredrenderer.cpp +++ b/tests/manual/deferred-renderer-cpp/deferredrenderer.cpp @@ -74,13 +74,13 @@ void DeferredRenderer::setSurface(QWindow *surface) if (m_window != nullptr) { // Store connections m_widthChangedConnection = QObject::connect(surface, &QWindow::widthChanged, - [this] (int width) { - m_winSize->setValue(QSizeF(float(width), m_winSize->value().toSizeF().height())); - }); + this, [this](int width) { + m_winSize->setValue(QSizeF(float(width), m_winSize->value().toSizeF().height())); + }); m_heightChangedConnection = QObject::connect(surface, &QWindow::heightChanged, - [this] (int height) { - m_winSize->setValue(QSizeF(m_winSize->value().toSizeF().width(), float(height))); - }); + this, [this](int height) { + m_winSize->setValue(QSizeF(m_winSize->value().toSizeF().width(), float(height))); + }); } } } diff --git a/tests/manual/exampleresources/assets/cubemaps/miramar/qt_attribution.json b/tests/manual/exampleresources/assets/cubemaps/miramar/qt_attribution.json deleted file mode 100644 index c147af447..000000000 --- a/tests/manual/exampleresources/assets/cubemaps/miramar/qt_attribution.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "Id": "miramar-sky", - "Name": "Miramar Skybox Textures", - "QDocModule": "qt3d", - "QtUsage": "Used in the anaglyph-rendering example and autotests of Qt 3D.", - - "QtParts": [ "examples", "tests" ] , - "Description": "High res environment map (converted to webgl).", - "Homepage": "http://www.zfight.com/misc/files/textures/envmap_miramar.rar", - "DownloadLocation": "https://opengameart.org/sites/default/files/envmap_miramar.zip", - "License": "Modify however you like, just cred me for my work, maybe link to my page.", - "LicenseId": "LicenseRef-MIRAMAR", - "LicenseFile": "README.TXT", - "Copyright": "Copyright (c) Jockum Skoglund aka hipshot" -} diff --git a/tests/manual/exampleresources/assets/obj/qt_attribution.json b/tests/manual/exampleresources/assets/obj/qt_attribution.json deleted file mode 100644 index 82c57cdea..000000000 --- a/tests/manual/exampleresources/assets/obj/qt_attribution.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "Id": "substance_share", - "Name": "Substance Share", - "QDocModule": "qt3d", - "QtParts": ["examples"], - "Description": "Substance Share provides for free exchange of 3D assets including material-sphere.obj", - "QtUsage": "Used in Qt 3D pbr-materials example.", - - "Homepage": "https://share.allegorithmic.com/libraries/2026", - "License": "Creative Commons Attribution 4.0", - "LicenseId": "CC-BY-4.0", - "Copyright": "Copyright (c) 2016, Allegorithmic" -} diff --git a/tests/manual/manual-renderloop/main.cpp b/tests/manual/manual-renderloop/main.cpp index 428877954..d5f5240f6 100644 --- a/tests/manual/manual-renderloop/main.cpp +++ b/tests/manual/manual-renderloop/main.cpp @@ -171,7 +171,7 @@ int main(int ac, char **av) renderer.initialize(&win, &ctx); QTimer t; - QObject::connect(&t, &QTimer::timeout, [&] { renderer.render(); }); + QObject::connect(&t, &QTimer::timeout, &t, [&] { renderer.render(); }); t.start(16); return app.exec(); diff --git a/tests/manual/paintedtexture-cpp/main.cpp b/tests/manual/paintedtexture-cpp/main.cpp index cbf334e45..08aed2b5a 100644 --- a/tests/manual/paintedtexture-cpp/main.cpp +++ b/tests/manual/paintedtexture-cpp/main.cpp @@ -69,7 +69,7 @@ int main(int argc, char **argv) changeSizeSlider->setOrientation(Qt::Horizontal); changeSizeSlider->setMinimum(0); changeSizeSlider->setMaximum(4); - QObject::connect(changeSizeSlider, &QSlider::valueChanged, [scene, sizeLabel](int value) { + QObject::connect(changeSizeSlider, &QSlider::valueChanged, scene, [scene, sizeLabel](int value) { int sz = 128 << value; scene->setSize(QSize(sz, sz)); sizeLabel->setText(QString("Current Size: %1x%1").arg(sz)); diff --git a/tests/manual/planets-qml/images/nasa/qt_attribution.json b/tests/manual/planets-qml/images/nasa/qt_attribution.json index 6f47e3837..237580070 100644 --- a/tests/manual/planets-qml/images/nasa/qt_attribution.json +++ b/tests/manual/planets-qml/images/nasa/qt_attribution.json @@ -2,7 +2,7 @@ "Id": "nasa-jpl", "Name": "Jet Propulsion Laboratory Photojournal", "QDocModule": "qt3d", - "QtParts": ["examples"], + "QtParts": ["tests"], "Description": "The NASA/JPL Photojournal provides high quality images related to space research and exploration", "QtUsage": "Used in Qt 3D planets-qml example.", diff --git a/tests/manual/planets-qml/images/solarsystemscope/qt_attribution.json b/tests/manual/planets-qml/images/solarsystemscope/qt_attribution.json index 9d32e541d..c603bbea1 100644 --- a/tests/manual/planets-qml/images/solarsystemscope/qt_attribution.json +++ b/tests/manual/planets-qml/images/solarsystemscope/qt_attribution.json @@ -2,7 +2,7 @@ "Id": "solar_system_scope", "Name": "Solar System Scope Texture Library", "QDocModule": "qt3d", - "QtParts": ["examples"], + "QtParts": ["tests"], "Description": "Solar System Scope provides high quality, free to use textures for objects in the solar system.", "QtUsage": "Used in Qt 3D planets-qml example.", diff --git a/tests/manual/qtbug-72236/main.cpp b/tests/manual/qtbug-72236/main.cpp index 1c0507890..b859809f8 100644 --- a/tests/manual/qtbug-72236/main.cpp +++ b/tests/manual/qtbug-72236/main.cpp @@ -74,7 +74,7 @@ int main(int argc, char **argv) cylinder->addComponent(material); QTimer *timer = new QTimer(rootEntity); - QObject::connect(timer, &QTimer::timeout, [=](){ + QObject::connect(timer, &QTimer::timeout, rootEntity, [=]() { for (int i = 0; i < 2; i++) { auto *dummy = new Qt3DCore::QNode(rootEntity); auto *dummy2 = new Qt3DCore::QNode(dummy); @@ -89,7 +89,7 @@ int main(int argc, char **argv) timer->start(1000); QTimer *timer2 = new QTimer(rootEntity); - QObject::connect(timer2, &QTimer::timeout, [](){ + QObject::connect(timer2, &QTimer::timeout, timer2, []() { QThread::msleep(100); }); timer2->start(100); diff --git a/tests/manual/quickwidget-switch/main.cpp b/tests/manual/quickwidget-switch/main.cpp index f7c364848..048514ed9 100644 --- a/tests/manual/quickwidget-switch/main.cpp +++ b/tests/manual/quickwidget-switch/main.cpp @@ -53,22 +53,22 @@ int main(int argc, char* argv[]) subWindow->setWidget(quickWidget); QObject::connect(button1, &QPushButton::clicked, - [mdiArea1, mdiArea2, subWindow, button1, button2]() { - mdiArea2->removeSubWindow(subWindow); - mdiArea1->addSubWindow(subWindow); - subWindow->show(); - button1->setEnabled(false); - button2->setEnabled(true); - }); + &app, [mdiArea1, mdiArea2, subWindow, button1, button2]() { + mdiArea2->removeSubWindow(subWindow); + mdiArea1->addSubWindow(subWindow); + subWindow->show(); + button1->setEnabled(false); + button2->setEnabled(true); + }); QObject::connect(button2, &QPushButton::clicked, - [mdiArea1, mdiArea2, subWindow, button1, button2]() { - mdiArea1->removeSubWindow(subWindow); - mdiArea2->addSubWindow(subWindow); - subWindow->show(); - button1->setEnabled(true); - button2->setEnabled(false); - }); + &app, [mdiArea1, mdiArea2, subWindow, button1, button2]() { + mdiArea1->removeSubWindow(subWindow); + mdiArea2->addSubWindow(subWindow); + subWindow->show(); + button1->setEnabled(true); + button2->setEnabled(false); + }); mdiArea2->addSubWindow(subWindow); button2->setEnabled(false); diff --git a/tests/manual/rhi/simple-rhi-cpp/main.cpp b/tests/manual/rhi/simple-rhi-cpp/main.cpp index b7049db7e..576094eec 100644 --- a/tests/manual/rhi/simple-rhi-cpp/main.cpp +++ b/tests/manual/rhi/simple-rhi-cpp/main.cpp @@ -257,13 +257,13 @@ int main(int argc, char* argv[]) QTimer *cameraAnimationTimer = new QTimer(&view); QObject::connect(cameraAnimationTimer, &QTimer::timeout, - [cameraEntity] { - static int angle = 0; - const float radius = 40.0f; - const float anglef = qDegreesToRadians(float(angle)); - cameraEntity->setPosition(QVector3D(qSin(anglef), 0.0f, qCos(anglef)) * radius); - angle += 1; - }); + cameraEntity, [cameraEntity] { + static int angle = 0; + const float radius = 40.0f; + const float anglef = qDegreesToRadians(float(angle)); + cameraEntity->setPosition(QVector3D(qSin(anglef), 0.0f, qCos(anglef)) * radius); + angle += 1; + }); cameraAnimationTimer->start(16); // For camera controls @@ -282,12 +282,12 @@ int main(int argc, char* argv[]) QTimer *parameterAnimationTimer = new QTimer(&view); QObject::connect(parameterAnimationTimer, &QTimer::timeout, - [parameter] { - static int angle = 0; - const float anglef = qDegreesToRadians(float(angle)); - parameter->setValue(QColor::fromRgbF(fabs(qCos(anglef)), fabs(qSin(anglef)), 1.0f)); - angle += 10; - }); + parameter, [parameter] { + static int angle = 0; + const float anglef = qDegreesToRadians(float(angle)); + parameter->setValue(QColor::fromRgbF(fabs(qCos(anglef)), fabs(qSin(anglef)), 1.0f)); + angle += 10; + }); parameterAnimationTimer->start(16); // Torus |