diff options
author | Jani Hautakangas <jani.hautakangas@nokia.com> | 2011-05-10 21:38:01 (GMT) |
---|---|---|
committer | Jani Hautakangas <jani.hautakangas@nokia.com> | 2011-05-11 12:55:39 (GMT) |
commit | 1f854897da1231594d916ca3b094fcc59e43e8eb (patch) | |
tree | f6d41b0b375c35f111bef511e8cf42c908144d5f | |
parent | 36f43e454e772776f77401806b49115894963dfa (diff) | |
download | Qt-1f854897da1231594d916ca3b094fcc59e43e8eb.zip Qt-1f854897da1231594d916ca3b094fcc59e43e8eb.tar.gz Qt-1f854897da1231594d916ca3b094fcc59e43e8eb.tar.bz2 |
Enable multisampling on Symbian if hw supports it
BCM2727 don't have hw support for multisampling
but on other chips it should be enabled on Symbian.
Task-number: QTBUG-19183
Reviewed-by: Samuel Rødal
-rw-r--r-- | src/opengl/qgl_symbian.cpp | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/src/opengl/qgl_symbian.cpp b/src/opengl/qgl_symbian.cpp index 1b41db4..ab37977 100644 --- a/src/opengl/qgl_symbian.cpp +++ b/src/opengl/qgl_symbian.cpp @@ -49,6 +49,9 @@ #include <private/qpaintengine_opengl_p.h> #include <private/qwidget_p.h> // to access QWExtra #include <private/qnativeimagehandleprovider_p.h> +#include <private/qapplication_p.h> +#include <private/qgraphicssystem_p.h> +#include <private/qgraphicssystemex_symbian_p.h> #include "qgl_egl_p.h" #include "qpixmapdata_gl_p.h" #include "qgltexturepool_p.h" @@ -180,6 +183,15 @@ bool QGLContext::chooseContext(const QGLContext* shareContext) // almost same as d->ownsEglContext = true; d->eglContext->setApi(QEgl::OpenGL); + QGraphicsSystemEx *ex = QApplicationPrivate::graphicsSystem()->platformExtension(); + QSymbianGraphicsSystemEx *symex = static_cast<QSymbianGraphicsSystemEx*>(ex); + if (symex && !symex->hasBCM2727()) { + // Most likely we have hw support for multisampling + // so let's enable it. + d->glFormat.setSampleBuffers(1); + d->glFormat.setSamples(4); + } + // If the device is a widget with WA_TranslucentBackground set, make sure the glFormat // has the alpha channel option set: if (devType == QInternal::Widget) { @@ -229,20 +241,20 @@ bool QGLContext::chooseContext(const QGLContext* shareContext) // almost same as d->eglSurface = QEgl::createSurface(device(), d->eglContext->config()); - eglGetError(); // Clear error state first. + eglGetError(); // Clear error state first. #ifdef QGL_NO_PRESERVED_SWAP - eglSurfaceAttrib(QEgl::display(), d->eglSurface, - EGL_SWAP_BEHAVIOR, EGL_BUFFER_DESTROYED); + eglSurfaceAttrib(QEgl::display(), d->eglSurface, + EGL_SWAP_BEHAVIOR, EGL_BUFFER_DESTROYED); - if (eglGetError() != EGL_SUCCESS) - qWarning("QGLContext: could not enable destroyed swap behaviour"); + if (eglGetError() != EGL_SUCCESS) + qWarning("QGLContext: could not enable destroyed swap behaviour"); #else - eglSurfaceAttrib(QEgl::display(), d->eglSurface, - EGL_SWAP_BEHAVIOR, EGL_BUFFER_PRESERVED); + eglSurfaceAttrib(QEgl::display(), d->eglSurface, + EGL_SWAP_BEHAVIOR, EGL_BUFFER_PRESERVED); - if (eglGetError() != EGL_SUCCESS) - qWarning("QGLContext: could not enable preserved swap behaviour"); + if (eglGetError() != EGL_SUCCESS) + qWarning("QGLContext: could not enable preserved swap behaviour"); #endif setWindowCreated(true); |