diff options
Diffstat (limited to 'src')
35 files changed, 93 insertions, 95 deletions
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); |