summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Harmer <sean.harmer@kdab.com>2017-02-10 11:49:19 +0000
committerSean Harmer <sean.harmer@kdab.com>2017-02-10 11:49:19 +0000
commit905c5e5a366e24bb6d42b102f2e8a019270baec6 (patch)
tree947ba7ee0344be6f2c800fb770eabe123f021b5c
parentd1271dba68f03610c27e87963653bf1600b5f659 (diff)
parente29f8cf68e2f1ed22244f84099589e9444eaf5ba (diff)
Merge branch '5.8' into 5.9
Conflicts: src/render/io/qsceneloader.cpp src/render/picking/objectpicker.cpp Change-Id: Ic36138954381820196eb81c5c59e6a91e7f40f33
-rw-r--r--.gitignore1
-rw-r--r--src/render/graphicshelpers/graphicscontext.cpp17
-rw-r--r--src/render/graphicshelpers/graphicshelperes2.cpp25
-rw-r--r--src/render/graphicshelpers/graphicshelperes2_p.h4
-rw-r--r--src/render/io/qsceneloader.cpp20
-rw-r--r--src/render/io/qsceneloader_p.h2
-rw-r--r--tests/manual/rendercapture-cpp/mycapture.h4
-rw-r--r--tools/utils/qtcreator/templates/wizards/classes/qt3d/backendnode.cpp20
-rw-r--r--tools/utils/qtcreator/templates/wizards/classes/qt3d/backendnode_p.h35
-rw-r--r--tools/utils/qtcreator/templates/wizards/classes/qt3d/file.cpp6
-rw-r--r--tools/utils/qtcreator/templates/wizards/classes/qt3d/file.h2
-rw-r--r--tools/utils/qtcreator/templates/wizards/classes/qt3d/file_p.h2
-rw-r--r--tools/utils/qtcreator/templates/wizards/classes/qt3d/wizard.json18
13 files changed, 114 insertions, 42 deletions
diff --git a/.gitignore b/.gitignore
index 32a748504..490a5cad5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -27,6 +27,7 @@ include/*
*_resource.rc
.qmake.cache
.qmake.vars
+.qmake.stash
*.prl
moc_*.cpp
qrc_*.cpp
diff --git a/src/render/graphicshelpers/graphicscontext.cpp b/src/render/graphicshelpers/graphicscontext.cpp
index d27b7cd06..c6a7aaff3 100644
--- a/src/render/graphicshelpers/graphicscontext.cpp
+++ b/src/render/graphicshelpers/graphicscontext.cpp
@@ -81,6 +81,14 @@
QT_BEGIN_NAMESPACE
+#ifndef GL_READ_FRAMEBUFFER
+#define GL_READ_FRAMEBUFFER 0x8CA8
+#endif
+
+#ifndef GL_DRAW_FRAMEBUFFER
+#define GL_DRAW_FRAMEBUFFER 0x8CA9
+#endif
+
namespace {
QOpenGLShader::ShaderType shaderType(Qt3DRender::QShaderProgram::ShaderType type)
@@ -1706,10 +1714,8 @@ QImage GraphicsContext::readFramebuffer(QSize size)
QImage::Format imageFormat;
uint stride;
-#ifndef QT_OPENGL_ES_2
/* format value should match GL internalFormat */
GLenum internalFormat = m_renderTargetFormat;
-#endif
switch (m_renderTargetFormat) {
case QAbstractTexture::RGBAFormat:
@@ -1785,18 +1791,15 @@ QImage GraphicsContext::readFramebuffer(QSize size)
return img;
}
-#ifndef QT_OPENGL_ES_2
GLint samples = 0;
m_gl->functions()->glGetIntegerv(GL_SAMPLES, &samples);
if (samples > 0 && !m_glHelper->supportsFeature(GraphicsHelperInterface::BlitFramebuffer))
return img;
-#endif
img = QImage(size.width(), size.height(), imageFormat);
QScopedArrayPointer<uchar> data(new uchar [bytes]);
-#ifndef QT_OPENGL_ES_2
if (samples > 0) {
// resolve multisample-framebuffer to renderbuffer and read pixels from it
GLuint fbo, rb;
@@ -1828,14 +1831,10 @@ QImage GraphicsContext::readFramebuffer(QSize size)
gl->glBindFramebuffer(GL_FRAMEBUFFER, m_activeFBO);
gl->glDeleteFramebuffers(1, &fbo);
} else {
-#endif
// read pixels directly from framebuffer
m_gl->functions()->glReadPixels(0,0,size.width(), size.height(), format, type, data.data());
copyGLFramebufferDataToImage(img, data.data(), stride, size.width(), size.height(), m_renderTargetFormat);
-
-#ifndef QT_OPENGL_ES_2
}
-#endif
return img;
}
diff --git a/src/render/graphicshelpers/graphicshelperes2.cpp b/src/render/graphicshelpers/graphicshelperes2.cpp
index 97bfe4c7a..08331e192 100644
--- a/src/render/graphicshelpers/graphicshelperes2.cpp
+++ b/src/render/graphicshelpers/graphicshelperes2.cpp
@@ -65,8 +65,9 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
namespace Render {
-GraphicsHelperES2::GraphicsHelperES2() :
- m_funcs(0)
+GraphicsHelperES2::GraphicsHelperES2()
+ : m_funcs(0)
+ , m_supportFramebufferBlit(false)
{
}
@@ -80,6 +81,9 @@ void GraphicsHelperES2::initializeHelper(QOpenGLContext *context,
Q_ASSERT(context);
m_funcs = context->functions();
Q_ASSERT(m_funcs);
+ m_ext.reset(new QOpenGLExtensions(context));
+ if (m_ext->hasOpenGLExtension(QOpenGLExtensions::FramebufferBlit))
+ m_supportFramebufferBlit = true;
}
void GraphicsHelperES2::drawElementsInstancedBaseVertexBaseInstance(GLenum primitiveType,
@@ -366,6 +370,8 @@ bool GraphicsHelperES2::supportsFeature(GraphicsHelperInterface::Feature feature
switch (feature) {
case RenderBufferDimensionRetrieval:
return true;
+ case BlitFramebuffer:
+ return m_supportFramebufferBlit;
default:
return false;
}
@@ -739,17 +745,10 @@ UniformType GraphicsHelperES2::uniformTypeFromGLType(GLenum type)
void GraphicsHelperES2::blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
{
- Q_UNUSED(srcX0);
- Q_UNUSED(srcX1);
- Q_UNUSED(srcY0);
- Q_UNUSED(srcY1);
- Q_UNUSED(dstX0);
- Q_UNUSED(dstX1);
- Q_UNUSED(dstY0);
- Q_UNUSED(dstY1);
- Q_UNUSED(mask);
- Q_UNUSED(filter);
- qWarning() << "Framebuffer blits are not supported by ES 2.0 (since ES 3.1)";
+ if (!m_supportFramebufferBlit)
+ qWarning() << "Framebuffer blits are not supported by ES 2.0 (since ES 3.1)";
+ else
+ m_ext->glBlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
}
} // namespace Render
diff --git a/src/render/graphicshelpers/graphicshelperes2_p.h b/src/render/graphicshelpers/graphicshelperes2_p.h
index 3ed963c7f..25f6c8cd8 100644
--- a/src/render/graphicshelpers/graphicshelperes2_p.h
+++ b/src/render/graphicshelpers/graphicshelperes2_p.h
@@ -57,6 +57,8 @@
QT_BEGIN_NAMESPACE
+class QOpenGLExtensions;
+
namespace Qt3DRender {
namespace Render {
@@ -153,6 +155,8 @@ public:
protected:
QOpenGLFunctions *m_funcs;
+ bool m_supportFramebufferBlit;
+ QScopedPointer<QOpenGLExtensions> m_ext;
};
} // namespace Render
diff --git a/src/render/io/qsceneloader.cpp b/src/render/io/qsceneloader.cpp
index b9408298f..5070bb9e5 100644
--- a/src/render/io/qsceneloader.cpp
+++ b/src/render/io/qsceneloader.cpp
@@ -207,6 +207,17 @@ void QSceneLoaderPrivate::populateEntityMap(QEntity *parentEntity)
}
}
+void QSceneLoaderPrivate::setStatus(QSceneLoader::Status status)
+{
+ if (m_status != status) {
+ Q_Q(QSceneLoader);
+ m_status = status;
+ const bool wasBlocked = q->blockNotifications(true);
+ emit q->statusChanged(status);
+ q->blockNotifications(wasBlocked);
+ }
+}
+
/*!
The constructor creates an instance with the specified \a parent.
*/
@@ -253,7 +264,7 @@ void QSceneLoader::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change)
d->populateEntityMap(d->m_subTreeRoot);
}
} else if (e->propertyName() == QByteArrayLiteral("status")) {
- setStatus(e->value().value<QSceneLoader::Status>());
+ d->setStatus(e->value().value<QSceneLoader::Status>());
}
}
}
@@ -371,12 +382,7 @@ QComponent *QSceneLoader::component(const QString &entityName,
void QSceneLoader::setStatus(QSceneLoader::Status status)
{
Q_D(QSceneLoader);
- if (d->m_status != status) {
- d->m_status = status;
- const bool wasBlocked = blockNotifications(true);
- emit statusChanged(status);
- blockNotifications(wasBlocked);
- }
+ d->setStatus(status);
}
Qt3DCore::QNodeCreatedChangeBasePtr QSceneLoader::createNodeCreationChange() const
diff --git a/src/render/io/qsceneloader_p.h b/src/render/io/qsceneloader_p.h
index 13569ea70..45a6a1a4e 100644
--- a/src/render/io/qsceneloader_p.h
+++ b/src/render/io/qsceneloader_p.h
@@ -66,6 +66,8 @@ class QT3DRENDERSHARED_PRIVATE_EXPORT QSceneLoaderPrivate : public Qt3DCore::QCo
public:
QSceneLoaderPrivate();
+ void setStatus(QSceneLoader::Status status);
+
Q_DECLARE_PUBLIC(QSceneLoader)
void populateEntityMap(Qt3DCore::QEntity *parentEntity);
diff --git a/tests/manual/rendercapture-cpp/mycapture.h b/tests/manual/rendercapture-cpp/mycapture.h
index 803ef7336..249561a1e 100644
--- a/tests/manual/rendercapture-cpp/mycapture.h
+++ b/tests/manual/rendercapture-cpp/mycapture.h
@@ -60,10 +60,10 @@ class MyCapture : public QObject
public:
MyCapture(Qt3DRender::QRenderCapture* capture, QLabel *imageLabel)
: m_capture(capture)
- , m_cid(1)
- , m_imageLabel(imageLabel)
, m_reply(nullptr)
+ , m_imageLabel(imageLabel)
, m_continuous(false)
+ , m_cid(1)
{
}
diff --git a/tools/utils/qtcreator/templates/wizards/classes/qt3d/backendnode.cpp b/tools/utils/qtcreator/templates/wizards/classes/qt3d/backendnode.cpp
new file mode 100644
index 000000000..46f711849
--- /dev/null
+++ b/tools/utils/qtcreator/templates/wizards/classes/qt3d/backendnode.cpp
@@ -0,0 +1,20 @@
+%{Cpp:LicenseTemplate}\
+#include "%{PrivateHdrFileName}"
+
+QT_BEGIN_NAMESPACE
+%{JS: Cpp.openNamespaces('%{Class}')}
+%{CN}::%{CN}()
+{
+}
+
+void %{CN}::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
+{
+}
+
+void %{CN}::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
+{
+}
+
+%{JS: Cpp.closeNamespaces('%{Class}')}\
+
+QT_END_NAMESPACE
diff --git a/tools/utils/qtcreator/templates/wizards/classes/qt3d/backendnode_p.h b/tools/utils/qtcreator/templates/wizards/classes/qt3d/backendnode_p.h
new file mode 100644
index 000000000..12ee68155
--- /dev/null
+++ b/tools/utils/qtcreator/templates/wizards/classes/qt3d/backendnode_p.h
@@ -0,0 +1,35 @@
+%{Cpp:LicenseTemplate}\
+
+#ifndef %{GUARD}
+#define %{GUARD}
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DCore/qbackendnode.h>
+
+QT_BEGIN_NAMESPACE
+%{JS: Cpp.openNamespaces('%{Class}')}
+class %{CN} : public Qt3DCore::%{Base}
+{
+public:
+ %{CN}();
+
+ void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
+
+private:
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
+};
+%{JS: Cpp.closeNamespaces('%{Class}')}
+
+QT_END_NAMESPACE
+
+#endif // %{GUARD}\
diff --git a/tools/utils/qtcreator/templates/wizards/classes/qt3d/file.cpp b/tools/utils/qtcreator/templates/wizards/classes/qt3d/file.cpp
index 4200859a9..5106a9e74 100644
--- a/tools/utils/qtcreator/templates/wizards/classes/qt3d/file.cpp
+++ b/tools/utils/qtcreator/templates/wizards/classes/qt3d/file.cpp
@@ -4,7 +4,6 @@
QT_BEGIN_NAMESPACE
%{JS: Cpp.openNamespaces('%{Class}')}
-@if '%{Base}' === 'QNode' || '%{Base}' === 'QComponent' || '%{Base}' === 'QEntity'
%{CN}Private::%{CN}Private()
: Qt3DCore::%{Base}Private()
{
@@ -23,11 +22,7 @@ QT_BEGIN_NAMESPACE
%{CN}::~%{CN}()
{
}
-@else
-// TODO: Implement QBackendNode template
-@endif
-@if '%{Base}' === 'QNode' || '%{Base}' === 'QComponent' || '%{Base}' === 'QEntity'
Qt3DCore::QNodeCreatedChangeBasePtr %{CN}::createNodeCreationChange() const
{
auto creationChange = Qt3DCore::QNodeCreatedChangePtr<%{CN}Data>::create(this);
@@ -36,7 +31,6 @@ Qt3DCore::QNodeCreatedChangeBasePtr %{CN}::createNodeCreationChange() const
// TODO: Send data members in creation change
return creationChange;
}
-@endif
%{JS: Cpp.closeNamespaces('%{Class}')}\
QT_END_NAMESPACE
diff --git a/tools/utils/qtcreator/templates/wizards/classes/qt3d/file.h b/tools/utils/qtcreator/templates/wizards/classes/qt3d/file.h
index 9060461eb..c4162d647 100644
--- a/tools/utils/qtcreator/templates/wizards/classes/qt3d/file.h
+++ b/tools/utils/qtcreator/templates/wizards/classes/qt3d/file.h
@@ -9,8 +9,6 @@
#include <Qt3DCore/qcomponent.h>
@elsif '%{Base}' === 'QEntity'
#include <Qt3DCore/qentity.h>
-@elsif '%{Base}' === 'QBackendNode'
-#include <Qt3DCore/qbackendnode.h>
@endif
QT_BEGIN_NAMESPACE
diff --git a/tools/utils/qtcreator/templates/wizards/classes/qt3d/file_p.h b/tools/utils/qtcreator/templates/wizards/classes/qt3d/file_p.h
index 9de21e805..d1acea35e 100644
--- a/tools/utils/qtcreator/templates/wizards/classes/qt3d/file_p.h
+++ b/tools/utils/qtcreator/templates/wizards/classes/qt3d/file_p.h
@@ -20,8 +20,6 @@
#include <Qt3DCore/private/qcomponent_p.h>
@elsif '%{Base}' === 'QEntity'
#include <Qt3DCore/private/qentity_p.h>
-@elsif '%{Base}' === 'QBackendNode'
-#include <Qt3DCore/private/qbackendnode_p.h>
@endif
QT_BEGIN_NAMESPACE
diff --git a/tools/utils/qtcreator/templates/wizards/classes/qt3d/wizard.json b/tools/utils/qtcreator/templates/wizards/classes/qt3d/wizard.json
index c9fe63685..8079aa4b4 100644
--- a/tools/utils/qtcreator/templates/wizards/classes/qt3d/wizard.json
+++ b/tools/utils/qtcreator/templates/wizards/classes/qt3d/wizard.json
@@ -73,7 +73,8 @@
"name": "HdrFileName",
"type": "LineEdit",
"trDisplayName": "Header file:",
- "mandatory": true,
+ "mandatory": false,
+ "enabled": "%{JS: '%{BaseCB}' !== 'QBackendNode'}",
"data": { "trText": "%{JS: Cpp.classToFileName('%{Class}', '%{JS: Util.preferredSuffix('text/x-c++hdr')}')}" }
},
{
@@ -120,16 +121,31 @@
{
"source": "file.h",
"target": "%{HdrPath}",
+ "condition": "%{JS: '%{Base}' !== 'QBackendNode'}",
"openInEditor": true
},
{
"source": "file_p.h",
"target": "%{PrivateHdrPath}",
+ "condition": "%{JS: '%{Base}' !== 'QBackendNode'}",
"openInEditor": true
},
{
"source": "file.cpp",
"target": "%{SrcPath}",
+ "condition": "%{JS: '%{Base}' !== 'QBackendNode'}",
+ "openInEditor": true
+ },
+ {
+ "source": "backendnode.cpp",
+ "target": "%{SrcPath}",
+ "condition": "%{JS: '%{Base}' === 'QBackendNode'}",
+ "openInEditor": true
+ },
+ {
+ "source": "backendnode_p.h",
+ "target": "%{PrivateHdrPath}",
+ "condition": "%{JS: '%{Base}' === 'QBackendNode'}",
"openInEditor": true
}
]