summaryrefslogtreecommitdiffstats
path: root/src/platformsupport/eglconvenience
diff options
context:
space:
mode:
Diffstat (limited to 'src/platformsupport/eglconvenience')
-rw-r--r--src/platformsupport/eglconvenience/qeglconvenience.cpp10
-rw-r--r--src/platformsupport/eglconvenience/qeglconvenience_p.h8
-rw-r--r--src/platformsupport/eglconvenience/qeglplatformcontext.cpp21
-rw-r--r--src/platformsupport/eglconvenience/qeglplatformcontext_p.h25
4 files changed, 26 insertions, 38 deletions
diff --git a/src/platformsupport/eglconvenience/qeglconvenience.cpp b/src/platformsupport/eglconvenience/qeglconvenience.cpp
index a9973b642a..63f564c2d5 100644
--- a/src/platformsupport/eglconvenience/qeglconvenience.cpp
+++ b/src/platformsupport/eglconvenience/qeglconvenience.cpp
@@ -45,7 +45,7 @@
QT_BEGIN_NAMESPACE
-QVector<EGLint> q_createConfigAttributesFromFormat(const QGuiGLFormat &format)
+QVector<EGLint> q_createConfigAttributesFromFormat(const QSurfaceFormat &format)
{
int redSize = format.redBufferSize();
int greenSize = format.greenBufferSize();
@@ -70,7 +70,7 @@ QVector<EGLint> q_createConfigAttributesFromFormat(const QGuiGLFormat &format)
// "AtLeast" for EGL_BUFFER_SIZE, it's sort order is "smaller" meaning 16-bit configs are
// put in the list before 32-bit configs. So, to make sure 16-bit is preffered over 32-bit,
// we must set the red/green/blue sizes to zero. This has an unfortunate consequence that
- // if the application sets the red/green/blue size to 5/6/5 on the QGuiGLFormat,
+ // if the application sets the red/green/blue size to 5/6/5 on the QSurfaceFormat,
// they will probably get a 32-bit config, even when there's an RGB565 config available.
// // Now normalize the values so -1 becomes 0
@@ -197,7 +197,7 @@ bool q_reduceConfigAttributes(QVector<EGLint> *configAttributes)
return false;
}
-EGLConfig q_configFromGLFormat(EGLDisplay display, const QGuiGLFormat &format, bool highestPixelFormat, int surfaceType)
+EGLConfig q_configFromGLFormat(EGLDisplay display, const QSurfaceFormat &format, bool highestPixelFormat, int surfaceType)
{
EGLConfig cfg = 0;
QVector<EGLint> configureAttributes = q_createConfigAttributesFromFormat(format);
@@ -259,9 +259,9 @@ EGLConfig q_configFromGLFormat(EGLDisplay display, const QGuiGLFormat &format, b
return 0;
}
-QGuiGLFormat q_glFormatFromConfig(EGLDisplay display, const EGLConfig config)
+QSurfaceFormat q_glFormatFromConfig(EGLDisplay display, const EGLConfig config)
{
- QGuiGLFormat format;
+ QSurfaceFormat format;
EGLint redSize = 0;
EGLint greenSize = 0;
EGLint blueSize = 0;
diff --git a/src/platformsupport/eglconvenience/qeglconvenience_p.h b/src/platformsupport/eglconvenience/qeglconvenience_p.h
index 302aba318f..7b5b970415 100644
--- a/src/platformsupport/eglconvenience/qeglconvenience_p.h
+++ b/src/platformsupport/eglconvenience/qeglconvenience_p.h
@@ -43,16 +43,16 @@
#define QEGLCONVENIENCE_H
-#include <QtGui/QGuiGLFormat>
+#include <QtGui/QSurfaceFormat>
#include <QtCore/QVector>
#include <EGL/egl.h>
QT_BEGIN_NAMESPACE
-QVector<EGLint> q_createConfigAttributesFromFormat(const QGuiGLFormat &format);
+QVector<EGLint> q_createConfigAttributesFromFormat(const QSurfaceFormat &format);
bool q_reduceConfigAttributes(QVector<EGLint> *configAttributes);
-EGLConfig q_configFromGLFormat(EGLDisplay display, const QGuiGLFormat &format, bool highestPixelFormat = false, int surfaceType = EGL_WINDOW_BIT);
-QGuiGLFormat q_glFormatFromConfig(EGLDisplay display, const EGLConfig config);
+EGLConfig q_configFromGLFormat(EGLDisplay display, const QSurfaceFormat &format, bool highestPixelFormat = false, int surfaceType = EGL_WINDOW_BIT);
+QSurfaceFormat q_glFormatFromConfig(EGLDisplay display, const EGLConfig config);
bool q_hasEglExtension(EGLDisplay display,const char* extensionName);
QT_END_NAMESPACE
diff --git a/src/platformsupport/eglconvenience/qeglplatformcontext.cpp b/src/platformsupport/eglconvenience/qeglplatformcontext.cpp
index bb2d167c81..0e61dd3486 100644
--- a/src/platformsupport/eglconvenience/qeglplatformcontext.cpp
+++ b/src/platformsupport/eglconvenience/qeglplatformcontext.cpp
@@ -47,13 +47,7 @@
#include <EGL/egl.h>
-QEGLSurface::QEGLSurface(EGLSurface surface, const QGuiGLFormat &format)
- : QPlatformGLSurface(format)
- , m_eglSurface(surface)
-{
-}
-
-QEGLPlatformContext::QEGLPlatformContext(const QGuiGLFormat &format, QPlatformGLContext *share, EGLDisplay display,
+QEGLPlatformContext::QEGLPlatformContext(const QSurfaceFormat &format, QPlatformGLContext *share, EGLDisplay display,
EGLint eglClientVersion, EGLenum eglApi)
: m_eglDisplay(display)
, m_eglApi(eglApi)
@@ -78,18 +72,18 @@ QEGLPlatformContext::QEGLPlatformContext(const QGuiGLFormat &format, QPlatformGL
}
}
-bool QEGLPlatformContext::makeCurrent(const QPlatformGLSurface &surface)
+bool QEGLPlatformContext::makeCurrent(QPlatformSurface *surface)
{
#ifdef QEGL_EXTRA_DEBUG
qWarning("QEglContext::makeCurrent: %p\n",this);
#endif
eglBindAPI(m_eglApi);
- EGLSurface eglSurface = static_cast<const QEGLSurface &>(surface).eglSurface();
+ EGLSurface eglSurface = eglSurfaceForPlatformSurface(surface);
bool ok = eglMakeCurrent(m_eglDisplay, eglSurface, eglSurface, m_eglContext);
if (!ok)
- qWarning("QEGLPlatformContext::makeCurrent: eglError: %d, this: %p \n", eglGetError(), this);
+ qWarning("QEGLPlatformContext::makeCurrent: eglError: %x, this: %p \n", eglGetError(), this);
#ifdef QEGL_EXTRA_DEBUG
static bool showDebug = true;
if (showDebug) {
@@ -134,13 +128,14 @@ void QEGLPlatformContext::doneCurrent()
qWarning("QEGLPlatformContext::doneCurrent(): eglError: %d, this: %p \n", eglGetError(), this);
}
-void QEGLPlatformContext::swapBuffers(const QPlatformGLSurface &surface)
+void QEGLPlatformContext::swapBuffers(QPlatformSurface *surface)
{
#ifdef QEGL_EXTRA_DEBUG
qWarning("QEglContext::swapBuffers:%p\n",this);
#endif
eglBindAPI(m_eglApi);
- bool ok = eglSwapBuffers(m_eglDisplay, static_cast<const QEGLSurface &>(surface).eglSurface());
+ EGLSurface eglSurface = eglSurfaceForPlatformSurface(surface);
+ bool ok = eglSwapBuffers(m_eglDisplay, eglSurface);
if (!ok)
qWarning("QEGLPlatformContext::swapBuffers(): eglError: %d, this: %p \n", eglGetError(), this);
}
@@ -154,7 +149,7 @@ void (*QEGLPlatformContext::getProcAddress(const QByteArray &procName)) ()
return eglGetProcAddress(procName.constData());
}
-QGuiGLFormat QEGLPlatformContext::format() const
+QSurfaceFormat QEGLPlatformContext::format() const
{
return m_format;
}
diff --git a/src/platformsupport/eglconvenience/qeglplatformcontext_p.h b/src/platformsupport/eglconvenience/qeglplatformcontext_p.h
index 9877b77e4e..56a873afcb 100644
--- a/src/platformsupport/eglconvenience/qeglplatformcontext_p.h
+++ b/src/platformsupport/eglconvenience/qeglplatformcontext_p.h
@@ -42,42 +42,35 @@
#ifndef QEGLPLATFORMCONTEXT_H
#define QEGLPLATFORMCONTEXT_H
+#include <QtGui/QPlatformWindow>
#include <QtGui/QPlatformGLContext>
#include <EGL/egl.h>
-class QEGLSurface : public QPlatformGLSurface
-{
-public:
- QEGLSurface(EGLSurface surface, const QGuiGLFormat &format);
-
- virtual EGLSurface eglSurface() const { return m_eglSurface; }
-
-private:
- EGLSurface m_eglSurface;
-};
-
class QEGLPlatformContext : public QPlatformGLContext
{
public:
- QEGLPlatformContext(const QGuiGLFormat &format, QPlatformGLContext *share, EGLDisplay display,
+ QEGLPlatformContext(const QSurfaceFormat &format, QPlatformGLContext *share, EGLDisplay display,
EGLint eglClientVersion = 2, EGLenum eglApi = EGL_OPENGL_ES_API);
~QEGLPlatformContext();
- bool makeCurrent(const QPlatformGLSurface &surface);
+ bool makeCurrent(QPlatformSurface *surface);
void doneCurrent();
- void swapBuffers(const QPlatformGLSurface &surface);
+ void swapBuffers(QPlatformSurface *surface);
void (*getProcAddress(const QByteArray &procName)) ();
- QGuiGLFormat format() const;
+ QSurfaceFormat format() const;
EGLContext eglContext() const;
+protected:
+ virtual EGLSurface eglSurfaceForPlatformSurface(QPlatformSurface *surface) = 0;
+
private:
EGLContext m_eglContext;
EGLDisplay m_eglDisplay;
EGLenum m_eglApi;
- QGuiGLFormat m_format;
+ QSurfaceFormat m_format;
};
#endif //QEGLPLATFORMCONTEXT_H