![]() |
Qt 6.x
The Qt SDK
|
An EGL context implementation. More...
#include <qeglplatformcontext_p.h>
Public Types | |
enum | Flag { NoSurfaceless = 0x01 } |
Public Member Functions | |
QEGLPlatformContext (const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display, EGLConfig *config=nullptr, Flags flags={ }) | |
~QEGLPlatformContext () | |
void | initialize () override |
Called after a new instance is constructed. | |
bool | makeCurrent (QPlatformSurface *surface) override |
void | doneCurrent () override |
void | swapBuffers (QPlatformSurface *surface) override |
Reimplement in subclass to native swap buffers calls. | |
QFunctionPointer | getProcAddress (const char *procName) override |
Reimplement in subclass to allow dynamic querying of OpenGL symbols. | |
QSurfaceFormat | format () const override |
bool | isSharing () const override |
bool | isValid () const override |
EGLContext | nativeContext () const override |
EGLConfig | config () const override |
EGLDisplay | display () const override |
virtual void | invalidateContext () override |
EGLContext | eglContext () const |
EGLDisplay | eglDisplay () const |
EGLConfig | eglConfig () const |
![]() | |
QPlatformOpenGLContext () | |
virtual | ~QPlatformOpenGLContext () |
virtual void | initialize () |
Called after a new instance is constructed. | |
virtual QSurfaceFormat | format () const =0 |
virtual void | swapBuffers (QPlatformSurface *surface)=0 |
Reimplement in subclass to native swap buffers calls. | |
virtual GLuint | defaultFramebufferObject (QPlatformSurface *surface) const |
Reimplement in subclass if your platform uses framebuffer objects for surfaces. | |
virtual bool | makeCurrent (QPlatformSurface *surface)=0 |
virtual void | doneCurrent ()=0 |
virtual void | beginFrame () |
Called when the RHI begins rendering a new frame in the context. | |
virtual void | endFrame () |
Called when the RHI ends rendering a in the context. | |
virtual bool | isSharing () const |
virtual bool | isValid () const |
virtual QFunctionPointer | getProcAddress (const char *procName)=0 |
Reimplement in subclass to allow dynamic querying of OpenGL symbols. | |
QOpenGLContext * | context () const |
Static Public Member Functions | |
template<typename T > | |
static QOpenGLContext * | createFrom (EGLContext context, EGLDisplay contextDisplay, EGLDisplay platformDisplay, QOpenGLContext *shareContext) |
![]() | |
static bool | parseOpenGLVersion (const QByteArray &versionString, int &major, int &minor) |
Protected Member Functions | |
QEGLPlatformContext () | |
virtual EGLSurface | eglSurfaceForPlatformSurface (QPlatformSurface *surface)=0 |
virtual EGLSurface | createTemporaryOffscreenSurface () |
virtual void | destroyTemporaryOffscreenSurface (EGLSurface surface) |
virtual void | runGLChecks () |
An EGL context implementation.
Implement QPlatformOpenGLContext using EGL. To use it in platform plugins a subclass must be created since eglSurfaceForPlatformSurface() has to be reimplemented. This function is used for mapping platform surfaces (windows) to EGL surfaces and is necessary since different platform plugins may have different ways of handling native windows (for example, a plugin may choose not to back every platform window by a real EGL surface). Other than that, no further customization is necessary.
Definition at line 27 of file qeglplatformcontext_p.h.
Enumerator | |
---|---|
NoSurfaceless |
Definition at line 31 of file qeglplatformcontext_p.h.
QEGLPlatformContext::QEGLPlatformContext | ( | const QSurfaceFormat & | format, |
QPlatformOpenGLContext * | share, | ||
EGLDisplay | display, | ||
EGLConfig * | config = nullptr , |
||
Flags | flags = { } |
||
) |
Definition at line 80 of file qeglplatformcontext.cpp.
References QList< T >::append(), config(), QList< T >::constData(), QSurfaceFormat::CoreProfile, QList< T >::data(), QSurfaceFormat::DebugContext, QSurfaceFormat::DeprecatedFunctions, EGL_CONTEXT_FLAGS_KHR, EGL_CONTEXT_MINOR_VERSION_KHR, EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR, EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR, EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR, EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR, EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR, i, QSurfaceFormat::OpenGL, QSurfaceFormat::OpenVG, QSurfaceFormat::ProtectedContent, q_configFromGLFormat(), q_glFormatFromConfig(), q_hasEglExtension(), q_printEglConfig(), qDebug, qEnvironmentVariableIntValue(), qWarning, QSurfaceFormat::renderableType(), QList< T >::resize(), and QSurfaceFormat::setOption().
QEGLPlatformContext::~QEGLPlatformContext | ( | ) |
Definition at line 388 of file qeglplatformcontext.cpp.
|
inlineprotected |
Definition at line 85 of file qeglplatformcontext_p.h.
|
inlineoverride |
Definition at line 75 of file qeglplatformcontext_p.h.
Referenced by QEGLPlatformContext().
|
inlinestatic |
Definition at line 40 of file qeglplatformcontext_p.h.
References context, QOpenGLContextPrivate::get(), QOpenGLContext::handle(), QPlatformOpenGLContext::QOpenGLContext, and qWarning.
|
protectedvirtual |
Reimplemented in QEglFSContext, and QtWaylandClient::QWaylandGLContext.
Definition at line 241 of file qeglplatformcontext.cpp.
References q_configFromGLFormat().
Referenced by QEglFSContext::createTemporaryOffscreenSurface().
|
protectedvirtual |
Reimplemented in QEglFSContext, and QtWaylandClient::QWaylandGLContext.
Definition at line 259 of file qeglplatformcontext.cpp.
Referenced by QEglFSContext::destroyTemporaryOffscreenSurface().
|
inlineoverride |
Definition at line 76 of file qeglplatformcontext_p.h.
|
overridevirtual |
Implements QPlatformOpenGLContext.
Reimplemented in QQnxGLContext, QXcbEglContext, and QtWaylandClient::QWaylandGLContext.
Definition at line 396 of file qeglplatformcontext.cpp.
Referenced by QQnxGLContext::doneCurrent(), and QXcbEglContext::doneCurrent().
EGLConfig QEGLPlatformContext::eglConfig | ( | ) | const |
Definition at line 833 of file qeglplatformcontext.cpp.
Referenced by QtWaylandClient::QWaylandGLContext::QWaylandGLContext(), QtWaylandClient::QWaylandGLContext::createTemporaryOffscreenSurface(), QAndroidPlatformOpenGLContext::eglSurfaceForPlatformSurface(), and QAndroidPlatformOpenGLContext::swapBuffers().
EGLContext QEGLPlatformContext::eglContext | ( | ) | const |
Definition at line 823 of file qeglplatformcontext.cpp.
Referenced by QtWaylandClient::QWaylandGLContext::QWaylandGLContext(), eglContextForContext(), and QtWaylandClient::QWaylandGLContext::makeCurrent().
EGLDisplay QEGLPlatformContext::eglDisplay | ( | ) | const |
Definition at line 828 of file qeglplatformcontext.cpp.
Referenced by QtWaylandClient::QWaylandGLContext::QWaylandGLContext(), QtWaylandClient::QWaylandGLContext::~QWaylandGLContext(), QEglFSContext::createTemporaryOffscreenSurface(), QtWaylandClient::QWaylandGLContext::createTemporaryOffscreenSurface(), QEglFSContext::destroyTemporaryOffscreenSurface(), QtWaylandClient::QWaylandGLContext::destroyTemporaryOffscreenSurface(), QtWaylandClient::QWaylandGLContext::doneCurrent(), makeCurrent(), QtWaylandClient::QWaylandGLContext::makeCurrent(), and QtWaylandClient::QWaylandGLContext::swapBuffers().
|
protectedpure virtual |
Implemented in QDirectFbEGLContext, QAndroidPlatformOpenGLContext, QEglFSContext, QMinimalEglContext, QQnxGLContext, QXcbEglContext, and QtWaylandClient::QWaylandGLContext.
Referenced by makeCurrent(), and swapBuffers().
|
overridevirtual |
Implements QPlatformOpenGLContext.
Definition at line 818 of file qeglplatformcontext.cpp.
Referenced by QtWaylandClient::QWaylandGLContext::QWaylandGLContext(), QEglFSContext::createTemporaryOffscreenSurface(), and QtWaylandClient::QWaylandGLContext::swapBuffers().
|
overridevirtual |
Reimplement in subclass to allow dynamic querying of OpenGL symbols.
As opposed to e.g. the wglGetProcAddress function on Windows, Qt expects this methods to be able to return valid function pointers even for standard OpenGL symbols.
Implements QPlatformOpenGLContext.
Reimplemented in QtWaylandClient::QWaylandGLContext.
Definition at line 415 of file qeglplatformcontext.cpp.
|
overridevirtual |
Called after a new instance is constructed.
The default implementation does nothing.
Subclasses can use this function to perform additional initialization that relies on virtual functions.
Reimplemented from QPlatformOpenGLContext.
Definition at line 233 of file qeglplatformcontext.cpp.
|
inlineoverridevirtual |
Definition at line 78 of file qeglplatformcontext_p.h.
Referenced by QtWaylandClient::QWaylandGLContext::QWaylandGLContext().
|
inlineoverridevirtual |
Reimplemented from QPlatformOpenGLContext.
Definition at line 71 of file qeglplatformcontext_p.h.
|
inlineoverridevirtual |
Reimplemented from QPlatformOpenGLContext.
Definition at line 72 of file qeglplatformcontext_p.h.
Referenced by QtWaylandClient::QWaylandGLContext::makeCurrent().
|
overridevirtual |
Implements QPlatformOpenGLContext.
Reimplemented in QQnxGLContext, QXcbEglContext, and QtWaylandClient::QWaylandGLContext.
Definition at line 345 of file qeglplatformcontext.cpp.
References eglDisplay(), EGLSurface(), eglSurfaceForPlatformSurface(), QPlatformSurface::format(), ok, Q_ASSERT, qEnvironmentVariableIsSet(), qgetenv(), qWarning, QSurface::supportsOpenGL(), QPlatformSurface::surface(), QSurfaceFormat::swapInterval(), and QByteArray::toInt().
Referenced by QAndroidPlatformOpenGLContext::makeCurrent(), QQnxGLContext::makeCurrent(), QXcbEglContext::makeCurrent(), and QAndroidPlatformOpenGLContext::swapBuffers().
|
inlineoverride |
Definition at line 74 of file qeglplatformcontext_p.h.
|
protectedvirtual |
Reimplemented in QEglFSContext.
Definition at line 264 of file qeglplatformcontext.cpp.
|
overridevirtual |
Reimplement in subclass to native swap buffers calls.
The implementation must support being called in a thread different than the gui-thread.
Implements QPlatformOpenGLContext.
Reimplemented in QQnxGLContext, QXcbEglContext, and QtWaylandClient::QWaylandGLContext.
Definition at line 404 of file qeglplatformcontext.cpp.
References EGLSurface(), eglSurfaceForPlatformSurface(), ok, and qWarning.
Referenced by QAndroidPlatformOpenGLContext::swapBuffers(), QEglFSContext::swapBuffers(), QQnxGLContext::swapBuffers(), and QXcbEglContext::swapBuffers().