Fix major performance regression in QGLWidget on texture bind
Since Qt 5.1 we have not recognized the GL_EXT_bgra extension on desktop OpenGL, or the GL_EXT_texture_format_BGRA8888 extension on OpenGL ES. This patch matches the GL_EXT_bgra extension on both OpenGL and OpenGL ES and adds discovery of GL_EXT_texture_format_BGRA8888 under OpenGL ES. The old name for GL_EXT_texture_format_BGRA8888, GL_IMG_texture_format_BGRA8888 is also recognized. Change-Id: I2035bfe045aee14e86a1f407f5b8556454f8bb90 Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
This commit is contained in:
parent
c87b27f308
commit
1d07c72431
@ -347,6 +347,9 @@ static int qt_gl_resolve_extensions()
|
||||
{
|
||||
int extensions = 0;
|
||||
QOpenGLExtensionMatcher extensionMatcher;
|
||||
if (extensionMatcher.match("GL_EXT_bgra"))
|
||||
extensions |= QOpenGLExtensions::BGRATextureFormat;
|
||||
|
||||
#if defined(QT_OPENGL_ES)
|
||||
if (extensionMatcher.match("GL_OES_mapbuffer"))
|
||||
extensions |= QOpenGLExtensions::MapBuffer;
|
||||
@ -356,10 +359,9 @@ static int qt_gl_resolve_extensions()
|
||||
extensions |= QOpenGLExtensions::ElementIndexUint;
|
||||
if (extensionMatcher.match("GL_OES_depth24"))
|
||||
extensions |= QOpenGLExtensions::Depth24;
|
||||
|
||||
if (extensionMatcher.match("GL_EXT_bgra"))
|
||||
// TODO: Consider matching GL_APPLE_texture_format_BGRA8888 as well, but it needs testing.
|
||||
if (extensionMatcher.match("GL_IMG_texture_format_BGRA8888") || extensionMatcher.match("GL_EXT_texture_format_BGRA8888"))
|
||||
extensions |= QOpenGLExtensions::BGRATextureFormat;
|
||||
|
||||
#else
|
||||
QSurfaceFormat format = QOpenGLContext::currentContext()->format();
|
||||
extensions |= QOpenGLExtensions::ElementIndexUint | QOpenGLExtensions::MapBuffer;
|
||||
|
Loading…
Reference in New Issue
Block a user