From 86f91bf0f707e34392fbdf424d6914e7cf6bb4e6 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Sun, 21 Jul 2019 22:15:45 +0200 Subject: Make the warning in QBackingStore::endPaint() a little more helpful MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Amends 2aa9908e24611fa6d321e694b8415ba7e8d364b0 Change-Id: I2883ca27b06b2b414b4991b2dab3f84100b4c853 Reviewed-by: Tor Arne Vestbø --- src/gui/painting/qbackingstore.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gui') diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp index d935deb4d6..b9ed3d4995 100644 --- a/src/gui/painting/qbackingstore.cpp +++ b/src/gui/painting/qbackingstore.cpp @@ -186,7 +186,7 @@ QPaintDevice *QBackingStore::paintDevice() void QBackingStore::endPaint() { if (paintDevice()->paintingActive()) - qWarning() << "QBackingStore::endPaint() called with active painter on backingstore paint device"; + qWarning("QBackingStore::endPaint() called with active painter; did you forget to destroy it or call QPainter::end() on it?"); handle()->endPaint(); } -- cgit v1.2.3 From 65cdd0f36678a6b77caf9cf0007ad44c51f7f7af Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 4 Jun 2019 14:42:31 -0500 Subject: Enable shader cache for ES2 when GL_OES_get_program_binary is present Change-Id: I4fb71471a7dd22441def1eb837857d245c3e3c5a Reviewed-by: Laszlo Agocs --- src/gui/opengl/qopenglprogrambinarycache.cpp | 31 ++++++++++++++++++++++++++-- src/gui/opengl/qopenglprogrambinarycache_p.h | 6 ++++++ src/gui/opengl/qopenglshaderprogram.cpp | 8 ++++++- 3 files changed, 42 insertions(+), 3 deletions(-) (limited to 'src/gui') diff --git a/src/gui/opengl/qopenglprogrambinarycache.cpp b/src/gui/opengl/qopenglprogrambinarycache.cpp index c96021a969..7029cd5455 100644 --- a/src/gui/opengl/qopenglprogrambinarycache.cpp +++ b/src/gui/opengl/qopenglprogrambinarycache.cpp @@ -168,12 +168,19 @@ bool QOpenGLProgramBinaryCache::verifyHeader(const QByteArray &buf) const bool QOpenGLProgramBinaryCache::setProgramBinary(uint programId, uint blobFormat, const void *p, uint blobSize) { - QOpenGLExtraFunctions *funcs = QOpenGLContext::currentContext()->extraFunctions(); + QOpenGLContext *context = QOpenGLContext::currentContext(); + QOpenGLExtraFunctions *funcs = context->extraFunctions(); while (true) { GLenum error = funcs->glGetError(); if (error == GL_NO_ERROR || error == GL_CONTEXT_LOST) break; } +#if defined(QT_OPENGL_ES_2) + if (context->isOpenGLES() && context->format().majorVersion() < 3) { + initializeProgramBinaryOES(context); + programBinaryOES(programId, blobFormat, p, blobSize); + } else +#endif funcs->glProgramBinary(programId, blobFormat, p, blobSize); GLenum err = funcs->glGetError(); @@ -347,7 +354,8 @@ void QOpenGLProgramBinaryCache::save(const QByteArray &cacheKey, uint programId) GLEnvInfo info; - QOpenGLExtraFunctions *funcs = QOpenGLContext::currentContext()->extraFunctions(); + QOpenGLContext *context = QOpenGLContext::currentContext(); + QOpenGLExtraFunctions *funcs = context->extraFunctions(); GLint blobSize = 0; while (true) { GLenum error = funcs->glGetError(); @@ -390,6 +398,12 @@ void QOpenGLProgramBinaryCache::save(const QByteArray &cacheKey, uint programId) *p++ = 0; GLint outSize = 0; +#if defined(QT_OPENGL_ES_2) + if (context->isOpenGLES() && context->format().majorVersion() < 3) { + initializeProgramBinaryOES(context); + getProgramBinaryOES(programId, blobSize, &outSize, &blobFormat, p); + } else +#endif funcs->glGetProgramBinary(programId, blobSize, &outSize, &blobFormat, p); if (blobSize != outSize) { qCDebug(DBG_SHADER_CACHE, "glGetProgramBinary returned size %d instead of %d", outSize, blobSize); @@ -408,4 +422,17 @@ void QOpenGLProgramBinaryCache::save(const QByteArray &cacheKey, uint programId) } } +#if defined(QT_OPENGL_ES_2) +void QOpenGLProgramBinaryCache::initializeProgramBinaryOES(QOpenGLContext *context) +{ + if (m_programBinaryOESInitialized) + return; + m_programBinaryOESInitialized = true; + + Q_ASSERT(context); + getProgramBinaryOES = (void (QOPENGLF_APIENTRYP)(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary))context->getProcAddress("glGetProgramBinaryOES"); + programBinaryOES = (void (QOPENGLF_APIENTRYP)(GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length))context->getProcAddress("glProgramBinaryOES"); +} +#endif + QT_END_NAMESPACE diff --git a/src/gui/opengl/qopenglprogrambinarycache_p.h b/src/gui/opengl/qopenglprogrambinarycache_p.h index a0e1f91e25..9fade08e66 100644 --- a/src/gui/opengl/qopenglprogrambinarycache_p.h +++ b/src/gui/opengl/qopenglprogrambinarycache_p.h @@ -93,6 +93,12 @@ private: uint format; }; QCache m_memCache; +#if defined(QT_OPENGL_ES_2) + void (QOPENGLF_APIENTRYP programBinaryOES)(GLuint program, GLenum binaryFormat, const GLvoid *binary, GLsizei length); + void (QOPENGLF_APIENTRYP getProgramBinaryOES)(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary); + void initializeProgramBinaryOES(QOpenGLContext *context); + bool m_programBinaryOESInitialized = false; +#endif }; QT_END_NAMESPACE diff --git a/src/gui/opengl/qopenglshaderprogram.cpp b/src/gui/opengl/qopenglshaderprogram.cpp index c39177080d..3ce0cf230b 100644 --- a/src/gui/opengl/qopenglshaderprogram.cpp +++ b/src/gui/opengl/qopenglshaderprogram.cpp @@ -3753,8 +3753,14 @@ QOpenGLProgramBinarySupportCheck::QOpenGLProgramBinarySupportCheck(QOpenGLContex if (ctx) { if (ctx->isOpenGLES()) { qCDebug(DBG_SHADER_CACHE, "OpenGL ES v%d context", ctx->format().majorVersion()); - if (ctx->format().majorVersion() >= 3) + if (ctx->format().majorVersion() >= 3) { m_supported = true; + } else { + const bool hasExt = ctx->hasExtension("GL_OES_get_program_binary"); + qCDebug(DBG_SHADER_CACHE, "GL_OES_get_program_binary support = %d", hasExt); + if (hasExt) + m_supported = true; + } } else { const bool hasExt = ctx->hasExtension("GL_ARB_get_program_binary"); qCDebug(DBG_SHADER_CACHE, "GL_ARB_get_program_binary support = %d", hasExt); -- cgit v1.2.3