diff options
author | Miikka Heikkinen <miikka.heikkinen@theqtcompany.com> | 2015-10-20 13:18:59 +0300 |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@theqtcompany.com> | 2015-10-22 10:08:51 +0000 |
commit | 31f9c57bc50ae053cfaf039a1dfdb128e2494458 (patch) | |
tree | 316138cb73c49877f5a80a8496c2f1b737122fb5 /src/datavisualization/engine | |
parent | 4162ddeb02ee41fd4217d7f3d93d45cab3313ba8 (diff) |
Fix issues with COIN builds
-Fix miscellaneous compile errors
-Move manual tests to manual folder and enable export of autotests
-Added widgets requirement
-Fixed autotests
-Fixed renderer and controller synchronization in QML case
-Treat fallback Mesa as ES2 similar to setting AA_UseSoftwareOpenGL
Change-Id: If6619733725d079e339bef16262e5ea1450ab20f
Reviewed-by: Tomi Korpipää <tomi.korpipaa@theqtcompany.com>
Diffstat (limited to 'src/datavisualization/engine')
6 files changed, 28 insertions, 1 deletions
diff --git a/src/datavisualization/engine/abstract3dcontroller.cpp b/src/datavisualization/engine/abstract3dcontroller.cpp index 7a592e04..1c8c0958 100644 --- a/src/datavisualization/engine/abstract3dcontroller.cpp +++ b/src/datavisualization/engine/abstract3dcontroller.cpp @@ -31,6 +31,7 @@ #include "utils_p.h" #include <QtCore/QThread> #include <QtGui/QOpenGLFramebufferObject> +#include <QtCore/QMutexLocker> QT_BEGIN_NAMESPACE_DATAVISUALIZATION @@ -103,6 +104,7 @@ Abstract3DController::~Abstract3DController() void Abstract3DController::destroyRenderer() { + QMutexLocker mutexLocker(&m_renderMutex); // Renderer can be in another thread, don't delete it directly in that case if (m_renderer && m_renderer->thread() && m_renderer->thread() != this->thread()) m_renderer->deleteLater(); @@ -117,6 +119,7 @@ void Abstract3DController::destroyRenderer() */ void Abstract3DController::setRenderer(Abstract3DRenderer *renderer) { + // Note: This function must be called within render mutex m_renderer = renderer; // If renderer is created in different thread than controller, make sure renderer gets @@ -527,6 +530,8 @@ void Abstract3DController::synchDataToRenderer() void Abstract3DController::render(const GLuint defaultFboHandle) { + QMutexLocker mutexLocker(&m_renderMutex); + // If not initialized, do nothing. if (!m_renderer) return; @@ -978,6 +983,7 @@ void Abstract3DController::markSeriesVisualsDirty() void Abstract3DController::requestRender(QOpenGLFramebufferObject *fbo) { + QMutexLocker mutexLocker(&m_renderMutex); m_renderer->render(fbo->handle()); } diff --git a/src/datavisualization/engine/abstract3dcontroller_p.h b/src/datavisualization/engine/abstract3dcontroller_p.h index e6209bb3..9ed5a7d7 100644 --- a/src/datavisualization/engine/abstract3dcontroller_p.h +++ b/src/datavisualization/engine/abstract3dcontroller_p.h @@ -42,6 +42,7 @@ #include <QtGui/QLinearGradient> #include <QtCore/QTime> #include <QtCore/QLocale> +#include <QtCore/QMutex> QT_FORWARD_DECLARE_CLASS(QOpenGLFramebufferObject) @@ -215,6 +216,8 @@ protected: int m_selectedCustomItemIndex; qreal m_margin; + QMutex m_renderMutex; + explicit Abstract3DController(QRect initialViewport, Q3DScene *scene, QObject *parent = 0); public: diff --git a/src/datavisualization/engine/bars3dcontroller.cpp b/src/datavisualization/engine/bars3dcontroller.cpp index 9f114f3d..c1858211 100644 --- a/src/datavisualization/engine/bars3dcontroller.cpp +++ b/src/datavisualization/engine/bars3dcontroller.cpp @@ -27,6 +27,7 @@ #include "qbar3dseries_p.h" #include "thememanager_p.h" #include "q3dtheme_p.h" +#include <QtCore/QMutexLocker> QT_BEGIN_NAMESPACE_DATAVISUALIZATION @@ -56,6 +57,8 @@ Bars3DController::~Bars3DController() void Bars3DController::initializeOpenGL() { + QMutexLocker mutexLocker(&m_renderMutex); + // Initialization is called multiple times when Qt Quick components are used if (isInitialized()) return; @@ -63,6 +66,8 @@ void Bars3DController::initializeOpenGL() m_renderer = new Bars3DRenderer(this); setRenderer(m_renderer); + + mutexLocker.unlock(); synchDataToRenderer(); emitNeedRender(); @@ -70,6 +75,8 @@ void Bars3DController::initializeOpenGL() void Bars3DController::synchDataToRenderer() { + QMutexLocker mutexLocker(&m_renderMutex); + if (!isInitialized()) return; diff --git a/src/datavisualization/engine/qabstract3dgraph.cpp b/src/datavisualization/engine/qabstract3dgraph.cpp index 0b58b453..2f3caccd 100644 --- a/src/datavisualization/engine/qabstract3dgraph.cpp +++ b/src/datavisualization/engine/qabstract3dgraph.cpp @@ -1105,7 +1105,6 @@ QImage QAbstract3DGraphPrivate::renderToImage(int msaaSamples, const QSize &imag imageSize.height())); m_visualController->synchDataToRenderer(); fbo->bind(); - m_context->swapBuffers(m_offscreenSurface); m_visualController->requestRender(fbo); image = fbo->toImage(); fbo->release(); diff --git a/src/datavisualization/engine/scatter3dcontroller.cpp b/src/datavisualization/engine/scatter3dcontroller.cpp index a6406cd6..a78c0426 100644 --- a/src/datavisualization/engine/scatter3dcontroller.cpp +++ b/src/datavisualization/engine/scatter3dcontroller.cpp @@ -24,6 +24,7 @@ #include "qvalue3daxis_p.h" #include "qscatterdataproxy_p.h" #include "qscatter3dseries_p.h" +#include <QtCore/QMutexLocker> QT_BEGIN_NAMESPACE_DATAVISUALIZATION @@ -50,12 +51,16 @@ Scatter3DController::~Scatter3DController() void Scatter3DController::initializeOpenGL() { + QMutexLocker mutexLocker(&m_renderMutex); + // Initialization is called multiple times when Qt Quick components are used if (isInitialized()) return; m_renderer = new Scatter3DRenderer(this); setRenderer(m_renderer); + + mutexLocker.unlock(); synchDataToRenderer(); emitNeedRender(); @@ -63,6 +68,8 @@ void Scatter3DController::initializeOpenGL() void Scatter3DController::synchDataToRenderer() { + QMutexLocker mutexLocker(&m_renderMutex); + if (!isInitialized()) return; diff --git a/src/datavisualization/engine/surface3dcontroller.cpp b/src/datavisualization/engine/surface3dcontroller.cpp index 15dc60e1..82885c01 100644 --- a/src/datavisualization/engine/surface3dcontroller.cpp +++ b/src/datavisualization/engine/surface3dcontroller.cpp @@ -24,6 +24,7 @@ #include "qvalue3daxis_p.h" #include "qsurfacedataproxy_p.h" #include "qsurface3dseries_p.h" +#include <QtCore/QMutexLocker> QT_BEGIN_NAMESPACE_DATAVISUALIZATION @@ -49,6 +50,8 @@ Surface3DController::~Surface3DController() void Surface3DController::initializeOpenGL() { + QMutexLocker mutexLocker(&m_renderMutex); + // Initialization is called multiple times when Qt Quick components are used if (isInitialized()) return; @@ -61,6 +64,8 @@ void Surface3DController::initializeOpenGL() void Surface3DController::synchDataToRenderer() { + QMutexLocker mutexLocker(&m_renderMutex); + if (!isInitialized()) return; |