From ff193e33d80a08ca0c21fdbccc2d63e6b7400d88 Mon Sep 17 00:00:00 2001 From: Tuomo Pelkonen Date: Mon, 18 Jan 2021 19:03:07 +0200 Subject: Fix compilation issues for macOS and Android on Qt 6.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-89297 Change-Id: I57acf345b6fc64a93d08d41016c755cae4edd6db Reviewed-by: Tomi Korpipää --- src/datavisualization/engine/abstract3drenderer.cpp | 8 +++++--- src/datavisualization/engine/abstract3drenderer_p.h | 4 ++-- src/datavisualization/engine/drawer.cpp | 6 +++--- src/datavisualization/engine/scatter3drenderer.cpp | 8 ++++---- src/datavisualization/utils/qutils.h | 4 ++-- src/datavisualization/utils/texturehelper.cpp | 14 ++++++++------ src/datavisualization/utils/texturehelper_p.h | 4 ++-- src/datavisualization/utils/utils.cpp | 3 ++- src/datavisualizationqml2/enumtostringmap.cpp | 2 +- src/datavisualizationqml2/glstatestore.cpp | 12 ++++++------ src/datavisualizationqml2/glstatestore_p.h | 2 +- 11 files changed, 36 insertions(+), 31 deletions(-) (limited to 'src') diff --git a/src/datavisualization/engine/abstract3drenderer.cpp b/src/datavisualization/engine/abstract3drenderer.cpp index fd81e930..b45cd756 100644 --- a/src/datavisualization/engine/abstract3drenderer.cpp +++ b/src/datavisualization/engine/abstract3drenderer.cpp @@ -118,7 +118,7 @@ Abstract3DRenderer::Abstract3DRenderer(Abstract3DController *controller) m_oldCameraTarget(QVector3D(2000.0f, 2000.0f, 2000.0f)), // Just random invalid target m_reflectionEnabled(false), m_reflectivity(0.5), -#if !defined(QT_OPENGL_ES_2) +#if !QT_CONFIG(opengles2) m_funcs_2_1(0), #endif m_context(0), @@ -127,7 +127,7 @@ Abstract3DRenderer::Abstract3DRenderer(Abstract3DController *controller) { initializeOpenGLFunctions(); m_isOpenGLES = Utils::isOpenGLES(); -#if !defined(QT_OPENGL_ES_2) +#if !QT_CONFIG(opengles2) if (!m_isOpenGLES) { // Discard warnings about deprecated functions QtMessageHandler handler = qInstallMessageHandler(discardDebugMsgs); @@ -193,7 +193,9 @@ Abstract3DRenderer::~Abstract3DRenderer() m_axisCacheY.clearLabels(); m_axisCacheZ.clearLabels(); +#if !QT_CONFIG(opengles2) delete m_funcs_2_1; +#endif } void Abstract3DRenderer::contextCleanup() @@ -212,7 +214,7 @@ void Abstract3DRenderer::initializeOpenGL() glEnable(GL_CULL_FACE); glCullFace(GL_BACK); -#if !defined(QT_OPENGL_ES_2) +#if !QT_CONFIG(opengles2) if (!m_isOpenGLES) { glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); diff --git a/src/datavisualization/engine/abstract3drenderer_p.h b/src/datavisualization/engine/abstract3drenderer_p.h index 4155a551..bc7ca819 100644 --- a/src/datavisualization/engine/abstract3drenderer_p.h +++ b/src/datavisualization/engine/abstract3drenderer_p.h @@ -41,7 +41,7 @@ #define ABSTRACT3DRENDERER_P_H #include -#if !defined(QT_OPENGL_ES_2) +#if !QT_CONFIG(opengles2) # include #endif #include "datavisualizationglobal_p.h" @@ -333,7 +333,7 @@ protected: qreal m_reflectivity; QLocale m_locale; -#if !defined(QT_OPENGL_ES_2) +#if !QT_CONFIG(opengles2) QOpenGLFunctions_2_1 *m_funcs_2_1; #endif QPointer m_context; // Not owned diff --git a/src/datavisualization/engine/drawer.cpp b/src/datavisualization/engine/drawer.cpp index 3b873ba4..8d7cdf6e 100644 --- a/src/datavisualization/engine/drawer.cpp +++ b/src/datavisualization/engine/drawer.cpp @@ -105,7 +105,7 @@ QFont Drawer::font() const void Drawer::drawObject(ShaderHelper *shader, AbstractObjectHelper *object, GLuint textureId, GLuint depthTextureId, GLuint textureId3D) { -#if defined(QT_OPENGL_ES_2) +#if QT_CONFIG(opengles2) Q_UNUSED(textureId3D); #endif if (textureId) { @@ -121,7 +121,7 @@ void Drawer::drawObject(ShaderHelper *shader, AbstractObjectHelper *object, GLui glBindTexture(GL_TEXTURE_2D, depthTextureId); shader->setUniformValue(shader->shadow(), 1); } -#if !defined(QT_OPENGL_ES_2) +#if !QT_CONFIG(opengles2) if (textureId3D) { // Activate texture glActiveTexture(GL_TEXTURE2); @@ -166,7 +166,7 @@ void Drawer::drawObject(ShaderHelper *shader, AbstractObjectHelper *object, GLui glDisableVertexAttribArray(shader->posAtt()); // Release textures -#if !defined(QT_OPENGL_ES_2) +#if !QT_CONFIG(opengles2) if (textureId3D) { glActiveTexture(GL_TEXTURE2); glBindTexture(GL_TEXTURE_3D, 0); diff --git a/src/datavisualization/engine/scatter3drenderer.cpp b/src/datavisualization/engine/scatter3drenderer.cpp index e999827e..5255b51e 100644 --- a/src/datavisualization/engine/scatter3drenderer.cpp +++ b/src/datavisualization/engine/scatter3drenderer.cpp @@ -554,7 +554,7 @@ void Scatter3DRenderer::drawScene(const GLuint defaultFboHandle) ShaderHelper *pointSelectionShader; if (!m_isOpenGLES) { -#if !defined(QT_OPENGL_ES_2) +#if !QT_CONFIG(opengles2) if (m_havePointSeries) { glEnable(GL_POINT_SMOOTH); glEnable(GL_PROGRAM_POINT_SIZE); @@ -751,7 +751,7 @@ void Scatter3DRenderer::drawScene(const GLuint defaultFboHandle) float itemSize = cache->itemSize() / itemScaler; if (itemSize == 0.0f) itemSize = m_dotSizeScale; -#if !defined(QT_OPENGL_ES_2) +#if !QT_CONFIG(opengles2) if (drawingPoints && !m_isOpenGLES) m_funcs_2_1->glPointSize(itemSize * activeCamera->zoomLevel()); #endif @@ -884,7 +884,7 @@ void Scatter3DRenderer::drawScene(const GLuint defaultFboHandle) float itemSize = cache->itemSize() / itemScaler; if (itemSize == 0.0f) itemSize = m_dotSizeScale; -#if !defined(QT_OPENGL_ES_2) +#if !QT_CONFIG(opengles2) if (drawingPoints && !m_isOpenGLES) m_funcs_2_1->glPointSize(itemSize * activeCamera->zoomLevel()); #endif @@ -1195,7 +1195,7 @@ void Scatter3DRenderer::drawScene(const GLuint defaultFboHandle) } } -#if !defined(QT_OPENGL_ES_2) +#if !QT_CONFIG(opengles2) if (m_havePointSeries) { glDisable(GL_POINT_SMOOTH); glDisable(GL_PROGRAM_POINT_SIZE); diff --git a/src/datavisualization/utils/qutils.h b/src/datavisualization/utils/qutils.h index b7001652..65fb8047 100644 --- a/src/datavisualization/utils/qutils.h +++ b/src/datavisualization/utils/qutils.h @@ -39,7 +39,7 @@ namespace QtDataVisualization { #ifndef Q_QDOC -static inline QSurfaceFormat qDefaultSurfaceFormat(bool antialias = true) Q_DECL_UNUSED; +static inline QSurfaceFormat qDefaultSurfaceFormat(bool antialias = true); #endif static inline QSurfaceFormat qDefaultSurfaceFormat(bool antialias) { @@ -65,7 +65,7 @@ static inline QSurfaceFormat qDefaultSurfaceFormat(bool antialias) ctx->makeCurrent(dummySurface); } -#if defined(QT_OPENGL_ES_2) +#if QT_CONFIG(opengles2) isES = true; #elif (QT_VERSION < QT_VERSION_CHECK(5, 3, 0)) isES = false; diff --git a/src/datavisualization/utils/texturehelper.cpp b/src/datavisualization/utils/texturehelper.cpp index 4ff56cb3..d424234c 100644 --- a/src/datavisualization/utils/texturehelper.cpp +++ b/src/datavisualization/utils/texturehelper.cpp @@ -42,7 +42,7 @@ extern void discardDebugMsgs(QtMsgType type, const QMessageLogContext &context, TextureHelper::TextureHelper() { initializeOpenGLFunctions(); -#if !defined(QT_OPENGL_ES_2) +#if !QT_CONFIG(opengles2) if (!Utils::isOpenGLES()) { // Discard warnings about deprecated functions QtMessageHandler handler = qInstallMessageHandler(discardDebugMsgs); @@ -62,7 +62,9 @@ TextureHelper::TextureHelper() TextureHelper::~TextureHelper() { +#if !QT_CONFIG(opengles2) delete m_openGlFunctions_2_1; +#endif } GLuint TextureHelper::create2DTexture(const QImage &image, bool useTrilinearFiltering, @@ -115,7 +117,7 @@ GLuint TextureHelper::create3DTexture(const QList *data, int width, int h return 0; GLuint textureId = 0; -#if defined(QT_OPENGL_ES_2) +#if QT_CONFIG(opengles2) Q_UNUSED(dataFormat); Q_UNUSED(data); #else @@ -290,7 +292,7 @@ GLuint TextureHelper::createGradientTexture(const QLinearGradient &gradient) GLuint TextureHelper::createDepthTexture(const QSize &size, GLuint textureSize) { GLuint depthtextureid = 0; -#if defined(QT_OPENGL_ES_2) +#if QT_CONFIG(opengles2) Q_UNUSED(size); Q_UNUSED(textureSize); #else @@ -316,7 +318,7 @@ GLuint TextureHelper::createDepthTextureFrameBuffer(const QSize &size, GLuint &f GLuint textureSize) { GLuint depthtextureid = createDepthTexture(size, textureSize); -#if defined(QT_OPENGL_ES_2) +#if QT_CONFIG(opengles2) Q_UNUSED(frameBuffer); #else if (!Utils::isOpenGLES()) { @@ -402,7 +404,7 @@ void TextureHelper::convertToGLFormatHelper(QImage &dstImage, const QImage &srcI const uint *p = (const uint*) srcImage.scanLine(srcImage.height() - 1); uint *q = (uint*) dstImage.scanLine(0); -#if !defined(QT_OPENGL_ES_2) +#if !QT_CONFIG(opengles2) if (texture_format == GL_BGRA) { #else if (texture_format == GL_BGRA8_EXT) { @@ -457,7 +459,7 @@ void TextureHelper::convertToGLFormatHelper(QImage &dstImage, const QImage &srcI QRgb TextureHelper::qt_gl_convertToGLFormatHelper(QRgb src_pixel, GLenum texture_format) { -#if !defined(QT_OPENGL_ES_2) +#if !QT_CONFIG(opengles2) if (texture_format == GL_BGRA) { #else if (texture_format == GL_BGRA8_EXT) { diff --git a/src/datavisualization/utils/texturehelper_p.h b/src/datavisualization/utils/texturehelper_p.h index 9ef68d74..b9a4fa92 100644 --- a/src/datavisualization/utils/texturehelper_p.h +++ b/src/datavisualization/utils/texturehelper_p.h @@ -43,7 +43,7 @@ #include "datavisualizationglobal_p.h" #include #include -#if !defined(QT_OPENGL_ES_2) +#if !QT_CONFIG(opengles2) // 3D Textures are not supported by ES set # include #endif @@ -77,7 +77,7 @@ class TextureHelper : protected QOpenGLFunctions void convertToGLFormatHelper(QImage &dstImage, const QImage &srcImage, GLenum texture_format); QRgb qt_gl_convertToGLFormatHelper(QRgb src_pixel, GLenum texture_format); -#if !defined(QT_OPENGL_ES_2) +#if !QT_CONFIG(opengles2) QOpenGLFunctions_2_1 *m_openGlFunctions_2_1; #endif friend class Bars3DRenderer; diff --git a/src/datavisualization/utils/utils.cpp b/src/datavisualization/utils/utils.cpp index 2503ad2b..6b4c9727 100644 --- a/src/datavisualization/utils/utils.cpp +++ b/src/datavisualization/utils/utils.cpp @@ -34,6 +34,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE_DATAVISUALIZATION @@ -355,7 +356,7 @@ void Utils::resolveStatics() ctx->makeCurrent(dummySurface); } -#if defined(QT_OPENGL_ES_2) +#if QT_CONFIG(opengles2) isES = true; #elif (QT_VERSION < QT_VERSION_CHECK(5, 3, 0)) isES = false; diff --git a/src/datavisualizationqml2/enumtostringmap.cpp b/src/datavisualizationqml2/enumtostringmap.cpp index d683c0a1..e10e8bc0 100644 --- a/src/datavisualizationqml2/enumtostringmap.cpp +++ b/src/datavisualizationqml2/enumtostringmap.cpp @@ -393,7 +393,7 @@ EnumToStringMap::EnumToStringMap() : m_map[GL_FRAMEBUFFER_UNSUPPORTED] = "FRAMEBUFFER_UNSUPPORTED"; m_map[GL_FRAMEBUFFER_BINDING] = "FRAMEBUFFER_BINDING"; -#if !defined(QT_OPENGL_ES_2) +#if !QT_CONFIG(opengles2) m_map[GL_RENDERBUFFER_BINDING] = "RENDERBUFFER_BINDING"; #else m_map[GL_RENDERBUFFER] = "RENDERBUFFER_BINDING"; diff --git a/src/datavisualizationqml2/glstatestore.cpp b/src/datavisualizationqml2/glstatestore.cpp index 0d24f3f9..dfb4266f 100644 --- a/src/datavisualizationqml2/glstatestore.cpp +++ b/src/datavisualizationqml2/glstatestore.cpp @@ -87,7 +87,7 @@ void GLStateStore::storeGLState() printCurrentState(true); #endif -#if !defined(QT_OPENGL_ES_2) +#if !QT_CONFIG(opengles2) glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &m_drawFramebuffer); glGetIntegerv(GL_READ_FRAMEBUFFER_BINDING, &m_readFramebuffer); glGetIntegerv(GL_RENDERBUFFER_BINDING, &m_renderbuffer); @@ -144,7 +144,7 @@ void GLStateStore::printCurrentState(bool in) if (file->isOpen()) { QDebug msg(file); -#if !defined(QT_OPENGL_ES_2) +#if !QT_CONFIG(opengles2) GLint drawFramebuffer; GLint readFramebuffer; GLint renderbuffer; @@ -183,7 +183,7 @@ void GLStateStore::printCurrentState(bool in) GLfloat polygonOffsetUnits; glGetBooleanv(GL_DEPTH_WRITEMASK, &isDepthWriteEnabled); -#if !defined(QT_OPENGL_ES_2) +#if !QT_CONFIG(opengles2) glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &drawFramebuffer); glGetIntegerv(GL_READ_FRAMEBUFFER_BINDING, &readFramebuffer); glGetIntegerv(GL_RENDERBUFFER_BINDING, &renderbuffer); @@ -226,7 +226,7 @@ void GLStateStore::printCurrentState(bool in) color.setRgbF(clearColor[0], clearColor[1], clearColor[2]); color.setAlphaF(clearColor[3]); -#if !defined(QT_OPENGL_ES_2) +#if !QT_CONFIG(opengles2) msg << "---" << endl; msg << " GL_DRAW_FRAMEBUFFER_BINDING "<< drawFramebuffer << endl; msg << " GL_READ_FRAMEBUFFER_BINDING "<< readFramebuffer << endl; @@ -278,7 +278,7 @@ void GLStateStore::printCurrentState(bool in) void GLStateStore::restoreGLState() { -#if !defined(QT_OPENGL_ES_2) +#if !QT_CONFIG(opengles2) glBindFramebuffer(GL_READ_FRAMEBUFFER, m_readFramebuffer); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_drawFramebuffer); glBindRenderbuffer(GL_RENDERBUFFER_BINDING, m_renderbuffer); @@ -353,7 +353,7 @@ void GLStateStore::restoreGLState() void GLStateStore::initGLDefaultState() { -#if !defined(QT_OPENGL_ES_2) +#if !QT_CONFIG(opengles2) m_drawFramebuffer = 0; m_readFramebuffer = 0; m_renderbuffer = 0; diff --git a/src/datavisualizationqml2/glstatestore_p.h b/src/datavisualizationqml2/glstatestore_p.h index 830f5e64..f5aa0bdd 100644 --- a/src/datavisualizationqml2/glstatestore_p.h +++ b/src/datavisualizationqml2/glstatestore_p.h @@ -63,7 +63,7 @@ public: GLint m_scissorBox[4]; GLboolean m_isScissorTestEnabled; -#if !defined(QT_OPENGL_ES_2) +#if !QT_CONFIG(opengles2) GLint m_drawFramebuffer; GLint m_readFramebuffer; GLint m_renderbuffer; -- cgit v1.2.3