summaryrefslogtreecommitdiffstats
path: root/src/opengl/qgl_egl.cpp
diff options
context:
space:
mode:
authorTrond Kjernåsen <trond.kjernasen@nokia.com>2010-05-14 13:42:43 (GMT)
committerTrond Kjernåsen <trond.kjernasen@nokia.com>2010-05-14 13:42:43 (GMT)
commit9a69656bd64016933124813ea5403e7e5d454719 (patch)
tree220e31e08e11bfa3a76627b53f303880e065f8e0 /src/opengl/qgl_egl.cpp
parentb2e15281d56415e6ef8d4f1604d25b198d449f06 (diff)
downloadQt-9a69656bd64016933124813ea5403e7e5d454719.zip
Qt-9a69656bd64016933124813ea5403e7e5d454719.tar.gz
Qt-9a69656bd64016933124813ea5403e7e5d454719.tar.bz2
Added workarounds for two MBX/SGX specific GL ES bugs/problems.
The workaround flags are put into the platform independent section for now, since there might be a general need for these as we expand our GL and GL ES usage. The workaround_needsFullClearOnEveryFrame flag covers the case where you get a performance penalty on PowerVR hw if all rendering buffers are not cleared. The workaround_brokenFBOReadBack flag covers the case where copying pixels from a texture (e.g. via glCopyTexSubImage2d()) bound in an FBO doesn't work. Task-number: QTBUG-10670 Reviewed-by: Gunnar
Diffstat (limited to 'src/opengl/qgl_egl.cpp')
-rw-r--r--src/opengl/qgl_egl.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/opengl/qgl_egl.cpp b/src/opengl/qgl_egl.cpp
index 0fbbbf9..44e8ae9 100644
--- a/src/opengl/qgl_egl.cpp
+++ b/src/opengl/qgl_egl.cpp
@@ -185,8 +185,26 @@ void QGLContext::makeCurrent()
return;
}
- if (d->eglContext->makeCurrent(d->eglSurfaceForDevice()))
+ if (d->eglContext->makeCurrent(d->eglSurfaceForDevice())) {
QGLContextPrivate::setCurrentContext(this);
+ if (!d->workaroundsCached) {
+ d->workaroundsCached = true;
+ const char *renderer = reinterpret_cast<const char *>(glGetString(GL_RENDERER));
+ if (strstr(renderer, "SGX") || strstr(renderer, "MBX")) {
+ // PowerVR MBX/SGX chips needs to clear all buffers when starting to render
+ // a new frame, otherwise there will be a performance penalty to pay for
+ // each frame.
+ d->workaround_needsFullClearOnEveryFrame = true;
+
+ // Older PowerVR SGX drivers (like the one in the N900) have a
+ // bug which prevents glCopyTexSubImage2D() to work with a POT
+ // or GL_ALPHA texture bound to an FBO. The only way to
+ // identify that driver is to check the EGL version number for it.
+ if (strstr(eglQueryString(d->eglContext->display(), EGL_VERSION), "1.3"))
+ d->workaround_brokenFBOReadBack = true;
+ }
+ }
+ }
}
void QGLContext::doneCurrent()