From d8281a92b8eb1c5fa3e430c296f22a713cbe1808 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 1 Apr 2014 13:25:18 +0200 Subject: Do not set fwdcompat bit for a compatibility profile QGLFormat AMD drivers do weird things. Provide a workaround. Task-number: QTBUG-37909 Change-Id: Idabd6ebb6e1447cb9bd92c7711a50aaa8575b9d6 Reviewed-by: Sean Harmer --- src/opengl/qgl_qpa.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/opengl') diff --git a/src/opengl/qgl_qpa.cpp b/src/opengl/qgl_qpa.cpp index fe4d1c363c..10e6ffde46 100644 --- a/src/opengl/qgl_qpa.cpp +++ b/src/opengl/qgl_qpa.cpp @@ -109,6 +109,11 @@ QSurfaceFormat QGLFormat::toSurfaceFormat(const QGLFormat &format) retFormat.setMajorVersion(format.majorVersion()); retFormat.setMinorVersion(format.minorVersion()); retFormat.setProfile(static_cast(format.profile())); + // QGLFormat has no way to set DeprecatedFunctions, that is, to tell that forward + // compatibility should not be requested. Some drivers fail to ignore the fwdcompat + // bit with compatibility profiles so make sure it is not set. + if (format.profile() == QGLFormat::CompatibilityProfile) + retFormat.setOption(QSurfaceFormat::DeprecatedFunctions); return retFormat; } -- cgit v1.2.3 From 2c36469a16f166a3b4e513cccf8186157952bba0 Mon Sep 17 00:00:00 2001 From: Fabian Bumberger Date: Mon, 17 Mar 2014 17:45:08 +0100 Subject: QNX: Fix OpenGL autotest On QNX grabbing the frame buffer returns the content of the back buffer. In order to execute the OpenGL tests properly a swapBuffers is executed before in order to be able to retrieve the content of the front buffer. The patch also documents this platform behavior. Change-Id: I7a501818ec6eea061f2f54f95854f68cb72e0534 Reviewed-by: James McDonnell Reviewed-by: Sean Harmer --- src/opengl/qgl.cpp | 5 +++++ src/opengl/qglframebufferobject.cpp | 3 +++ 2 files changed, 8 insertions(+) (limited to 'src/opengl') diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index e602a05af9..637cfc55a8 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -4083,6 +4083,11 @@ QPixmap QGLWidget::renderPixmap(int w, int h, bool useContext) Depending on your hardware, you can explicitly select which color buffer to grab with a glReadBuffer() call before calling this function. + + On QNX the back buffer is not preserved when swapBuffers() is called. The back buffer + where this function reads from, might thus not contain the same content as the front buffer. + In order to retrieve what is currently visible on the screen, swapBuffers() + has to be executed prior to this function call. */ QImage QGLWidget::grabFrameBuffer(bool withAlpha) { diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp index d636da91b5..bd8bc2f64a 100644 --- a/src/opengl/qglframebufferobject.cpp +++ b/src/opengl/qglframebufferobject.cpp @@ -1114,6 +1114,9 @@ QGLFramebufferObjectFormat QGLFramebufferObject::format() const \fn QImage QGLFramebufferObject::toImage() const Returns the contents of this framebuffer object as a QImage. + + On QNX the back buffer is not preserved when a buffer swap occures. So this function + might return old content. */ QImage QGLFramebufferObject::toImage() const { -- cgit v1.2.3 From 581d10bdf26dacaa36a916744ff5b43ecaa05f77 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 1 Apr 2014 14:18:15 +0200 Subject: Avoid recreating the underlying context in QGLContext wrappers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QGLContexts created from a QOpenGLContext get their valid flag reset, resulting in creating a totally new underlying context. This is wrong and becomes visible when sharing is expected between contexts (since the QGLContext's underlying QOpenGLContext will not have sharing). Task-number: QTBUG-37893 Change-Id: I8cb37c11dfb400a77e510bf4c8219bedc742309e Reviewed-by: Jørgen Lind --- src/opengl/qgl.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/opengl') diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 637cfc55a8..3cfdcc549c 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -2934,8 +2934,9 @@ void QGLContext::setFormat(const QGLFormat &format) void QGLContext::setDevice(QPaintDevice *pDev) { Q_D(QGLContext); - if (isValid()) - reset(); + // Do not touch the valid flag here. The context is either a new one and + // valid is not yet set or it is adapted from a valid QOpenGLContext in which + // case it must remain valid. d->paintDevice = pDev; if (d->paintDevice && (d->paintDevice->devType() != QInternal::Widget && d->paintDevice->devType() != QInternal::Pixmap -- cgit v1.2.3 From a4ec90175c76ce35688acc06cdf93e9cab886223 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 3 Mar 2014 21:20:30 +0100 Subject: purge vestiges of opengl es 1 support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit amends 0d5170256c1. Change-Id: Ifa178d38f602bb7c66ef13334673ff47e332af5b Reviewed-by: Jørgen Lind Reviewed-by: Laszlo Agocs --- src/opengl/opengl.pro | 1 - src/opengl/qglbuffer.cpp | 16 +++++++--------- src/opengl/qglfunctions.cpp | 22 +--------------------- 3 files changed, 8 insertions(+), 31 deletions(-) (limited to 'src/opengl') diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro index 4d9208d983..5cd553a5e8 100644 --- a/src/opengl/opengl.pro +++ b/src/opengl/opengl.pro @@ -11,7 +11,6 @@ QMAKE_DOCS = $$PWD/doc/qtopengl.qdocconf load(qt_module) contains(QT_CONFIG, opengl):CONFIG += opengl -contains(QT_CONFIG, opengles1):CONFIG += opengles1 contains(QT_CONFIG, opengles2):CONFIG += opengles2 contains(QT_CONFIG, egl):CONFIG += egl diff --git a/src/opengl/qglbuffer.cpp b/src/opengl/qglbuffer.cpp index 0bcb9d4f1f..1c9545990f 100644 --- a/src/opengl/qglbuffer.cpp +++ b/src/opengl/qglbuffer.cpp @@ -344,20 +344,18 @@ void QGLBuffer::destroy() bool QGLBuffer::read(int offset, void *data, int count) { #if !defined(QT_OPENGL_ES) - if (QOpenGLContext::openGLModuleType() != QOpenGLContext::GLES1) { - Q_D(QGLBuffer); - if (!d->funcs->hasOpenGLFeature(QOpenGLFunctions::Buffers) || !d->guard->id()) - return false; - while (glGetError() != GL_NO_ERROR) ; // Clear error state. - d->funcs->glGetBufferSubData(d->type, offset, count, data); - return glGetError() == GL_NO_ERROR; - } + Q_D(QGLBuffer); + if (!d->funcs->hasOpenGLFeature(QOpenGLFunctions::Buffers) || !d->guard->id()) + return false; + while (glGetError() != GL_NO_ERROR) ; // Clear error state. + d->funcs->glGetBufferSubData(d->type, offset, count, data); + return glGetError() == GL_NO_ERROR; #else Q_UNUSED(offset); Q_UNUSED(data); Q_UNUSED(count); -#endif return false; +#endif } /*! diff --git a/src/opengl/qglfunctions.cpp b/src/opengl/qglfunctions.cpp index d6d77d0568..42b3b47f7f 100644 --- a/src/opengl/qglfunctions.cpp +++ b/src/opengl/qglfunctions.cpp @@ -223,7 +223,7 @@ QGLFunctions::QGLFunctions(const QGLContext *context) static int qt_gl_resolve_features() { QOpenGLContext *ctx = QOpenGLContext::currentContext(); - if (ctx->isES() && QOpenGLContext::openGLModuleType() != QOpenGLContext::GLES1) { + if (ctx->isES()) { // OpenGL ES 2 int features = QGLFunctions::Multitexture | QGLFunctions::Shaders | @@ -243,26 +243,6 @@ static int qt_gl_resolve_features() if (extensions.match("GL_IMG_texture_npot")) features |= QGLFunctions::NPOTTextures; return features; - } else if (ctx->isES()) { - // OpenGL ES 1 - int features = QGLFunctions::Multitexture | - QGLFunctions::Buffers | - QGLFunctions::CompressedTextures | - QGLFunctions::Multisample; - QOpenGLExtensionMatcher extensions; - if (extensions.match("GL_OES_framebuffer_object")) - features |= QGLFunctions::Framebuffers; - if (extensions.match("GL_OES_blend_equation_separate")) - features |= QGLFunctions::BlendEquationSeparate; - if (extensions.match("GL_OES_blend_func_separate")) - features |= QGLFunctions::BlendFuncSeparate; - if (extensions.match("GL_OES_blend_subtract")) - features |= QGLFunctions::BlendSubtract; - if (extensions.match("GL_OES_texture_npot")) - features |= QGLFunctions::NPOTTextures; - if (extensions.match("GL_IMG_texture_npot")) - features |= QGLFunctions::NPOTTextures; - return features; } else { // OpenGL int features = 0; -- cgit v1.2.3