Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qwaylandbrcmglcontext.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
5
6#include <QtWaylandClient/private/qwaylanddisplay_p.h>
7#include <QtWaylandClient/private/qwaylandwindow_p.h>
9
10#include <QtGui/private/qeglconvenience_p.h>
11
12#include <qpa/qplatformopenglcontext.h>
13#include <QtGui/QSurfaceFormat>
14
15#include <dlfcn.h>
16
18
19namespace QtWaylandClient {
20
22
25 , m_eglDisplay(eglDisplay)
26 , m_config(q_configFromGLFormat(m_eglDisplay, brcmFixFormat(format), true))
27 , m_format(q_glFormatFromConfig(m_eglDisplay, m_config))
28{
29 EGLContext shareEGLContext = share ? static_cast<QWaylandBrcmGLContext *>(share)->eglContext() : EGL_NO_CONTEXT;
30
31 eglBindAPI(EGL_OPENGL_ES_API);
32
33 QList<EGLint> eglContextAttrs;
34 eglContextAttrs.append(EGL_CONTEXT_CLIENT_VERSION);
35 eglContextAttrs.append(format.majorVersion() == 1 ? 1 : 2);
36 eglContextAttrs.append(EGL_NONE);
37
38 m_context = eglCreateContext(m_eglDisplay, m_config, shareEGLContext, eglContextAttrs.constData());
39}
40
42{
43 eglDestroyContext(m_eglDisplay, m_context);
44}
45
47{
48 return static_cast<QWaylandBrcmEglWindow *>(surface)->makeCurrent(m_context);
49}
50
52{
53 eglMakeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
54}
55
57{
58 static_cast<QWaylandBrcmEglWindow *>(surface)->swapBuffers();
59}
60
61QFunctionPointer QWaylandBrcmGLContext::getProcAddress(const char *procName)
62{
63 QFunctionPointer proc = (QFunctionPointer) eglGetProcAddress(procName);
64 if (!proc)
65 proc = (QFunctionPointer) dlsym(RTLD_DEFAULT, procName);
66 return proc;
67}
68
70{
71 return m_config;
72}
73
74}
75
The QPlatformOpenGLContext class provides an abstraction for native GL contexts.
The QPlatformSurface class provides an abstraction for a surface.
The QSurfaceFormat class represents the format of a QSurface. \inmodule QtGui.
void swapBuffers(QPlatformSurface *surface) override
Reimplement in subclass to native swap buffers calls.
bool makeCurrent(QPlatformSurface *surface) override
QWaylandBrcmGLContext(EGLDisplay eglDisplay, const QSurfaceFormat &format, QPlatformOpenGLContext *share)
QFunctionPointer getProcAddress(const char *procName) override
Reimplement in subclass to allow dynamic querying of OpenGL symbols.
Combined button and popup list for selecting options.
QSurfaceFormat brcmFixFormat(const QSurfaceFormat &f)
EGLConfig q_configFromGLFormat(EGLDisplay display, const QSurfaceFormat &format, bool highestPixelFormat, int surfaceType)
QSurfaceFormat q_glFormatFromConfig(EGLDisplay display, const EGLConfig config, const QSurfaceFormat &referenceFormat)
typedef EGLDisplay(EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYEXTPROC)(EGLenum platform
GLint GLsizei GLsizei GLenum format