From 47e8352a00fb46945ed7bcfd2abfe66a8ae36992 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 23 May 2012 15:04:16 +0200 Subject: QEGLPlatformContext: Add accessors for display and config. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I4a7c033691ed83698ac161c034f795f1ac3b0ade Reviewed-by: Samuel Rødal Reviewed-by: Andreas Holzammer Reviewed-by: Sean Harmer --- .../eglconvenience/qeglplatformcontext.cpp | 20 ++++++++++++++------ .../eglconvenience/qeglplatformcontext_p.h | 6 ++++-- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/platformsupport/eglconvenience/qeglplatformcontext.cpp b/src/platformsupport/eglconvenience/qeglplatformcontext.cpp index 97b4571dbf..d8ee996215 100644 --- a/src/platformsupport/eglconvenience/qeglplatformcontext.cpp +++ b/src/platformsupport/eglconvenience/qeglplatformcontext.cpp @@ -51,11 +51,9 @@ QEGLPlatformContext::QEGLPlatformContext(const QSurfaceFormat &format, QPlatform EGLenum eglApi) : m_eglDisplay(display) , m_eglApi(eglApi) - , m_format(format) + , m_eglConfig(q_configFromGLFormat(display, format, true)) + , m_format(q_glFormatFromConfig(display, m_eglConfig)) { - EGLConfig config = q_configFromGLFormat(display, format, true); - m_format = q_glFormatFromConfig(display, config); - m_shareContext = share ? static_cast(share)->m_eglContext : 0; QVector contextAttrs; @@ -64,10 +62,10 @@ QEGLPlatformContext::QEGLPlatformContext(const QSurfaceFormat &format, QPlatform contextAttrs.append(EGL_NONE); eglBindAPI(m_eglApi); - m_eglContext = eglCreateContext(m_eglDisplay, config, m_shareContext, contextAttrs.constData()); + m_eglContext = eglCreateContext(m_eglDisplay, m_eglConfig, m_shareContext, contextAttrs.constData()); if (m_eglContext == EGL_NO_CONTEXT && m_shareContext != EGL_NO_CONTEXT) { m_shareContext = 0; - m_eglContext = eglCreateContext(m_eglDisplay, config, 0, contextAttrs.constData()); + m_eglContext = eglCreateContext(m_eglDisplay, m_eglConfig, 0, contextAttrs.constData()); } } @@ -157,3 +155,13 @@ EGLContext QEGLPlatformContext::eglContext() const { return m_eglContext; } + +EGLDisplay QEGLPlatformContext::eglDisplay() const +{ + return m_eglDisplay; +} + +EGLConfig QEGLPlatformContext::eglConfig() const +{ + return m_eglConfig; +} diff --git a/src/platformsupport/eglconvenience/qeglplatformcontext_p.h b/src/platformsupport/eglconvenience/qeglplatformcontext_p.h index d48d49a696..4b7b03ccb9 100644 --- a/src/platformsupport/eglconvenience/qeglplatformcontext_p.h +++ b/src/platformsupport/eglconvenience/qeglplatformcontext_p.h @@ -63,6 +63,8 @@ public: bool isValid() const { return m_eglContext != EGL_NO_CONTEXT; } EGLContext eglContext() const; + EGLDisplay eglDisplay() const; + EGLConfig eglConfig() const; protected: virtual EGLSurface eglSurfaceForPlatformSurface(QPlatformSurface *surface) = 0; @@ -72,8 +74,8 @@ private: EGLContext m_shareContext; EGLDisplay m_eglDisplay; EGLenum m_eglApi; - - QSurfaceFormat m_format; + EGLConfig m_eglConfig; + const QSurfaceFormat m_format; }; #endif //QEGLPLATFORMCONTEXT_H -- cgit v1.2.3