diff options
-rw-r--r-- | src/opengl/qgl_egl.cpp | 70 | ||||
-rw-r--r-- | src/opengl/qgl_egl_p.h | 2 | ||||
-rw-r--r-- | src/opengl/qgl_qws.cpp | 2 | ||||
-rw-r--r-- | src/opengl/qgl_wince.cpp | 2 | ||||
-rw-r--r-- | src/opengl/qgl_x11egl.cpp | 5 | ||||
-rw-r--r-- | src/opengl/qglpixelbuffer_egl.cpp | 2 |
6 files changed, 38 insertions, 45 deletions
diff --git a/src/opengl/qgl_egl.cpp b/src/opengl/qgl_egl.cpp index 3d146b7..c08d6fd 100644 --- a/src/opengl/qgl_egl.cpp +++ b/src/opengl/qgl_egl.cpp @@ -111,46 +111,40 @@ void qt_eglproperties_set_glformat(QEglProperties& eglProperties, const QGLForma eglProperties.setValue(EGL_SAMPLE_BUFFERS, sampleCount ? 1 : 0); } - // Updates "format" with the parameters of the selected configuration. -void qt_egl_update_format(const QEglContext& context, QGLFormat& format) +void qt_glformat_from_eglconfig(QGLFormat& format, const EGLConfig config) { - EGLint value = 0; - - if (context.configAttrib(EGL_RED_SIZE, &value)) - format.setRedBufferSize(value); - if (context.configAttrib(EGL_GREEN_SIZE, &value)) - format.setGreenBufferSize(value); - if (context.configAttrib(EGL_BLUE_SIZE, &value)) - format.setBlueBufferSize(value); - if (context.configAttrib(EGL_ALPHA_SIZE, &value)) { - format.setAlpha(value != 0); - if (format.alpha()) - format.setAlphaBufferSize(value); - } - - if (context.configAttrib(EGL_DEPTH_SIZE, &value)) { - format.setDepth(value != 0); - if (format.depth()) - format.setDepthBufferSize(value); - } - - if (context.configAttrib(EGL_LEVEL, &value)) - format.setPlane(value); - - if (context.configAttrib(EGL_SAMPLE_BUFFERS, &value)) { - format.setSampleBuffers(value != 0); - if (format.sampleBuffers()) { - context.configAttrib(EGL_SAMPLES, &value); - format.setSamples(value); - } - } - - if (context.configAttrib(EGL_STENCIL_SIZE, &value)) { - format.setStencil(value != 0); - if (format.stencil()) - format.setStencilBufferSize(value); - } + EGLint redSize = 0; + EGLint greenSize = 0; + EGLint blueSize = 0; + EGLint alphaSize = 0; + EGLint depthSize = 0; + EGLint stencilSize = 0; + EGLint sampleCount = 0; + EGLint level = 0; + + EGLDisplay display = QEgl::display(); + eglGetConfigAttrib(display, config, EGL_RED_SIZE, &redSize); + eglGetConfigAttrib(display, config, EGL_GREEN_SIZE, &greenSize); + eglGetConfigAttrib(display, config, EGL_BLUE_SIZE, &blueSize); + eglGetConfigAttrib(display, config, EGL_ALPHA_SIZE, &alphaSize); + eglGetConfigAttrib(display, config, EGL_DEPTH_SIZE, &depthSize); + eglGetConfigAttrib(display, config, EGL_STENCIL_SIZE, &stencilSize); + eglGetConfigAttrib(display, config, EGL_SAMPLES, &sampleCount); + eglGetConfigAttrib(display, config, EGL_LEVEL, &level); + + format.setRedBufferSize(redSize); + format.setGreenBufferSize(greenSize); + format.setBlueBufferSize(blueSize); + format.setAlphaBufferSize(alphaSize); + format.setDepthBufferSize(depthSize); + format.setStencilBufferSize(stencilSize); + format.setSamples(sampleCount); + format.setPlane(level + 1); // EGL calls level 0 "normal" whereas Qt calls 1 "normal" + format.setDirectRendering(true); // All EGL contexts are direct-rendered + format.setRgba(true); // EGL doesn't support colour index rendering + format.setStereo(false); // EGL doesn't support stereo buffers + format.setAccumBufferSize(0); // EGL doesn't support accululation buffers // Clear the EGL error state because some of the above may // have errored out because the attribute is not applicable diff --git a/src/opengl/qgl_egl_p.h b/src/opengl/qgl_egl_p.h index 6b65227..43793cd 100644 --- a/src/opengl/qgl_egl_p.h +++ b/src/opengl/qgl_egl_p.h @@ -61,7 +61,7 @@ QT_BEGIN_NAMESPACE class QGLFormat; void qt_eglproperties_set_glformat(QEglProperties& props, const QGLFormat& format); -void qt_egl_update_format(const QEglContext& context, QGLFormat& format); +void qt_glformat_from_eglconfig(QGLFormat& format, const EGLConfig config); QT_END_NAMESPACE diff --git a/src/opengl/qgl_qws.cpp b/src/opengl/qgl_qws.cpp index f72f051..96b2454 100644 --- a/src/opengl/qgl_qws.cpp +++ b/src/opengl/qgl_qws.cpp @@ -200,7 +200,7 @@ bool QGLContext::chooseContext(const QGLContext* shareContext) } // Inform the higher layers about the actual format properties. - qt_egl_update_format(*(d->eglContext), d->glFormat); + qt_glformat_from_eglconfig(d->glFormat, d->eglContext->config()); // Create a new context for the configuration. if (!d->eglContext->createContext diff --git a/src/opengl/qgl_wince.cpp b/src/opengl/qgl_wince.cpp index 3bf7f3a..fefcca2 100644 --- a/src/opengl/qgl_wince.cpp +++ b/src/opengl/qgl_wince.cpp @@ -163,7 +163,7 @@ bool QGLContext::chooseContext(const QGLContext* shareContext) } // Inform the higher layers about the actual format properties. - qt_egl_update_format(*(d->eglContext), d->glFormat); + qt_glformat_from_eglconfig(d->glFormat, d->eglContext->config()); // Create a new context for the configuration. if (!d->eglContext->createContext diff --git a/src/opengl/qgl_x11egl.cpp b/src/opengl/qgl_x11egl.cpp index a7c92cf..fe87c65 100644 --- a/src/opengl/qgl_x11egl.cpp +++ b/src/opengl/qgl_x11egl.cpp @@ -216,9 +216,8 @@ bool QGLContext::chooseContext(const QGLContext* shareContext) const_cast<QGLContext *>(shareContext)->d_func()->sharing = true; } - // Inform the higher layers about the actual format properties. - qt_egl_update_format(*(d->eglContext), d->glFormat); - + // Inform the higher layers about the actual format properties + qt_glformat_from_eglconfig(d->glFormat, d->eglContext->config()); // Do don't create the EGLSurface for everything. // QWidget - yes, create the EGLSurface and store it in QGLContextPrivate::eglSurface diff --git a/src/opengl/qglpixelbuffer_egl.cpp b/src/opengl/qglpixelbuffer_egl.cpp index ee0714f..db9e754 100644 --- a/src/opengl/qglpixelbuffer_egl.cpp +++ b/src/opengl/qglpixelbuffer_egl.cpp @@ -113,7 +113,7 @@ bool QGLPixelBufferPrivate::init(const QSize &size, const QGLFormat &f, QGLWidge } // Retrieve the actual format properties. - qt_egl_update_format(*ctx, format); + qt_glformat_from_eglconfig(format, ctx->config()); // Create the attributes needed for the pbuffer. QEglProperties attribs; |