summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Andersen <csandersen3@gmail.com>2018-10-21 14:53:33 +0200
committerChristian Andersen <csandersen3@gmail.com>2018-10-22 17:49:03 +0000
commit3bc2e44bd387aa2185083fcf94eeee67f37380f3 (patch)
tree70c78eb0e62dcd68060e66725a2389b62de79f41
parent62a30edbd5b61e1b9dd5eca119710c5a54d6e803 (diff)
Don't trigger Q_UNREACHABLE if passed invalid render buffer formats
Adds warning printout of the format that triggered the error. The graphics card may produce a proper image, but readFrameBuffer doesn't know how to interpret it. Additionally adds printout of the format when the code doesn't know the equivalent OpenGL ES 2.0 format. Fixes: QTBUG-66515 Change-Id: I65559f7d397a9297521ae0b1ebaf120629be3873 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
-rw-r--r--src/render/renderers/opengl/graphicshelpers/submissioncontext.cpp7
-rw-r--r--src/render/renderers/opengl/textures/gltexture.cpp5
2 files changed, 9 insertions, 3 deletions
diff --git a/src/render/renderers/opengl/graphicshelpers/submissioncontext.cpp b/src/render/renderers/opengl/graphicshelpers/submissioncontext.cpp
index 26ee94305..d9077976c 100644
--- a/src/render/renderers/opengl/graphicshelpers/submissioncontext.cpp
+++ b/src/render/renderers/opengl/graphicshelpers/submissioncontext.cpp
@@ -76,6 +76,7 @@
#include <Qt3DRender/private/graphicshelperes2_p.h>
#include <Qt3DRender/private/graphicshelperes3_p.h>
+#include <private/qdebug_p.h>
#include <QSurface>
#include <QWindow>
#include <QOpenGLTexture>
@@ -707,8 +708,10 @@ QImage SubmissionContext::readFramebuffer(const QRect &rect)
break;
#endif
default:
- // unsupported format
- Q_UNREACHABLE();
+ auto warning = qWarning();
+ warning << "Unable to convert";
+ QtDebugUtils::formatQEnum(warning, m_renderTargetFormat);
+ warning << "render target texture format to QImage.";
return img;
}
diff --git a/src/render/renderers/opengl/textures/gltexture.cpp b/src/render/renderers/opengl/textures/gltexture.cpp
index e98f3965d..cb83e9c1e 100644
--- a/src/render/renderers/opengl/textures/gltexture.cpp
+++ b/src/render/renderers/opengl/textures/gltexture.cpp
@@ -40,6 +40,7 @@
#include <QtCore/qhash.h>
#include "gltexture_p.h"
+#include <private/qdebug_p.h>
#include <QDebug>
#include <QOpenGLFunctions>
#include <QOpenGLTexture>
@@ -383,7 +384,9 @@ QOpenGLTexture *GLTexture::buildGLTexture()
format = QAbstractTexture::DepthFormat;
break;
default:
- qWarning() << Q_FUNC_INFO << "could not find a matching OpenGL ES 2.0 unsized texture format";
+ auto warning = qWarning();
+ warning << "Could not find a matching OpenGL ES 2.0 texture format:";
+ QtDebugUtils::formatQEnum(warning, m_properties.format);
break;
}
}