summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRhys Weatherley <rhys.weatherley@nokia.com>2009-10-15 00:44:27 (GMT)
committerRhys Weatherley <rhys.weatherley@nokia.com>2009-10-15 00:44:27 (GMT)
commit93eb7c1378d97978fbe415f532e341de0138f4fe (patch)
treee55ca788b049deb32bf16cdc2092769004f7774d /src
parent252fa3d8fa159791a0762a3e02c1594a34a104af (diff)
downloadQt-93eb7c1378d97978fbe415f532e341de0138f4fe.zip
Qt-93eb7c1378d97978fbe415f532e341de0138f4fe.tar.gz
Qt-93eb7c1378d97978fbe415f532e341de0138f4fe.tar.bz2
Back-port several OpenGL/ES fixes from 4.6 to 4.5
8ee6d090d45198fb2530849236c97f014666b7e4: fix EGL_SAMPLES b125af1b298d694c332f56deebe4755d0c985d5d: memory leak of EGLSurface's ef8d9fa7091b0d45fe15aae43b8f1c47547cb16d: double-destroy of pbuffer 73d9dced8298dfad7bc72607146e81e96fffb6d4: suppress pbuffer warnings Reviewed-by: Donald Carr
Diffstat (limited to 'src')
-rw-r--r--src/opengl/qgl_egl.cpp2
-rw-r--r--src/opengl/qgl_qws.cpp2
-rw-r--r--src/opengl/qglpixelbuffer_egl.cpp15
3 files changed, 14 insertions, 5 deletions
diff --git a/src/opengl/qgl_egl.cpp b/src/opengl/qgl_egl.cpp
index 7e91c35..348a677 100644
--- a/src/opengl/qgl_egl.cpp
+++ b/src/opengl/qgl_egl.cpp
@@ -74,7 +74,7 @@ void qt_egl_set_format(QEglProperties& props, int deviceType, const QGLFormat& f
props.setValue(EGL_STENCIL_SIZE, f.stencilBufferSize() == -1 ? 1 : f.stencilBufferSize());
if (f.sampleBuffers()) {
props.setValue(EGL_SAMPLE_BUFFERS, 1);
- props.setValue(EGL_SAMPLES, f.samples());
+ props.setValue(EGL_SAMPLES, f.samples() == -1 ? 1 : f.samples());
} else {
props.setValue(EGL_SAMPLE_BUFFERS, 0);
}
diff --git a/src/opengl/qgl_qws.cpp b/src/opengl/qgl_qws.cpp
index b842426..4058b66 100644
--- a/src/opengl/qgl_qws.cpp
+++ b/src/opengl/qgl_qws.cpp
@@ -187,6 +187,8 @@ void QGLContext::reset()
d->cleanup();
doneCurrent();
if (d->eglContext) {
+ if (d->eglContext->surface() != EGL_NO_SURFACE)
+ eglDestroySurface(d->eglContext->display(), d->eglContext->surface());
delete d->eglContext;
d->eglContext = 0;
}
diff --git a/src/opengl/qglpixelbuffer_egl.cpp b/src/opengl/qglpixelbuffer_egl.cpp
index b2f16c1..fbe6c36 100644
--- a/src/opengl/qglpixelbuffer_egl.cpp
+++ b/src/opengl/qglpixelbuffer_egl.cpp
@@ -152,7 +152,7 @@ bool QGLPixelBufferPrivate::init(const QSize &size, const QGLFormat &f, QGLWidge
bool QGLPixelBufferPrivate::cleanup()
{
- eglDestroySurface(QEglContext::defaultDisplay(0), pbuf);
+ // No need to destroy "pbuf" here - it is done in QGLContext::reset().
return true;
}
@@ -203,13 +203,20 @@ GLuint QGLPixelBuffer::generateDynamicTexture() const
bool QGLPixelBuffer::hasOpenGLPbuffers()
{
// See if we have at least 1 configuration that matches the default format.
- QEglContext ctx;
- if (!ctx.openDisplay(0))
+ EGLDisplay dpy = QEglContext::defaultDisplay(0);
+ if (dpy == EGL_NO_DISPLAY)
return false;
QEglProperties configProps;
qt_egl_set_format(configProps, QInternal::Pbuffer, QGLFormat::defaultFormat());
configProps.setRenderableType(QEglContext::OpenGL);
- return ctx.chooseConfig(configProps, QEglContext::BestPixelFormat);
+ do {
+ EGLConfig cfg = 0;
+ EGLint matching = 0;
+ if (eglChooseConfig(dpy, configProps.properties(),
+ &cfg, 1, &matching) && matching > 0)
+ return true;
+ } while (configProps.reduceConfiguration());
+ return false;
}
QT_END_NAMESPACE