Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
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
// Qt-Security score:significant reason:default
4
5
#
include
"qwaylandbrcmglcontext.h"
6
7
#
include
<
QtWaylandClient
/
private
/
qwaylanddisplay_p
.
h
>
8
#
include
<
QtWaylandClient
/
private
/
qwaylandwindow_p
.
h
>
9
#
include
"qwaylandbrcmeglwindow.h"
10
11
#
include
<
QtGui
/
private
/
qeglconvenience_p
.
h
>
12
13
#
include
<
qpa
/
qplatformopenglcontext
.
h
>
14
#
include
<
QtGui
/
QSurfaceFormat
>
15
16
#
include
<
dlfcn
.
h
>
17
18
QT_BEGIN_NAMESPACE
19
20
namespace
QtWaylandClient
{
21
22
extern
QSurfaceFormat
brcmFixFormat
(
const
QSurfaceFormat &format);
23
24
QWaylandBrcmGLContext
::
QWaylandBrcmGLContext
() =
default
;
25
26
QWaylandBrcmGLContext
::
QWaylandBrcmGLContext
(EGLDisplay eglDisplay,
const
QSurfaceFormat &format, QPlatformOpenGLContext *share)
27
:
QPlatformOpenGLContext
()
28
, m_eglDisplay(eglDisplay)
29
, m_config(q_configFromGLFormat(m_eglDisplay, brcmFixFormat(format),
true
))
30
,
m_format
(
q_glFormatFromConfig
(
m_eglDisplay
,
m_config
))
31
{
32
EGLContext shareEGLContext = share ?
static_cast
<
QWaylandBrcmGLContext
*>(share)
->
eglContext
(
)
: EGL_NO_CONTEXT;
33
34
eglBindAPI(EGL_OPENGL_ES_API);
35
36
QList<EGLint> eglContextAttrs;
37
eglContextAttrs.append(EGL_CONTEXT_CLIENT_VERSION);
38
eglContextAttrs.append(format.majorVersion() == 1 ? 1 : 2);
39
eglContextAttrs.append(EGL_NONE);
40
41
m_context = eglCreateContext(m_eglDisplay, m_config, shareEGLContext, eglContextAttrs.constData());
42
}
43
44
QWaylandBrcmGLContext
::~
QWaylandBrcmGLContext
()
45
{
46
eglDestroyContext(m_eglDisplay, m_context);
47
}
48
49
bool
QWaylandBrcmGLContext
::
makeCurrent
(QPlatformSurface *surface)
50
{
51
return
static_cast
<
QWaylandBrcmEglWindow
*>(surface)
->
makeCurrent
(
m_context
)
;
52
}
53
54
void
QWaylandBrcmGLContext
::
doneCurrent
()
55
{
56
eglMakeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
57
}
58
59
void
QWaylandBrcmGLContext
::
swapBuffers
(QPlatformSurface *surface)
60
{
61
static_cast
<
QWaylandBrcmEglWindow
*>(surface)
->
swapBuffers
(
)
;
62
}
63
64
QFunctionPointer
QWaylandBrcmGLContext
::
getProcAddress
(
const
char
*procName)
65
{
66
QFunctionPointer proc = (QFunctionPointer) eglGetProcAddress(procName);
67
if
(!proc)
68
proc = (QFunctionPointer) dlsym(RTLD_DEFAULT, procName);
69
return
proc;
70
}
71
72
EGLConfig
QWaylandBrcmGLContext
::
eglConfig
()
const
73
{
74
return
m_config;
75
}
76
77
}
78
79
QT_END_NAMESPACE
QtWaylandClient::QWaylandBrcmEglWindow
Definition
qwaylandbrcmeglwindow.h:22
QtWaylandClient::QWaylandBrcmEglWindow::makeCurrent
bool makeCurrent(EGLContext context)
Definition
qwaylandbrcmeglwindow.cpp:222
QtWaylandClient::QWaylandBrcmEglWindow::swapBuffers
void swapBuffers()
Definition
qwaylandbrcmeglwindow.cpp:203
QtWaylandClient::QWaylandBrcmGLContext
Definition
qwaylandbrcmglcontext.h:20
QtWaylandClient::QWaylandBrcmGLContext::eglConfig
EGLConfig eglConfig() const
Definition
qwaylandbrcmglcontext.cpp:72
QtWaylandClient::QWaylandBrcmGLContext::swapBuffers
void swapBuffers(QPlatformSurface *surface) override
Reimplement in subclass to native swap buffers calls.
Definition
qwaylandbrcmglcontext.cpp:59
QtWaylandClient::QWaylandBrcmGLContext::makeCurrent
bool makeCurrent(QPlatformSurface *surface) override
Definition
qwaylandbrcmglcontext.cpp:49
QtWaylandClient::QWaylandBrcmGLContext::~QWaylandBrcmGLContext
~QWaylandBrcmGLContext()
Definition
qwaylandbrcmglcontext.cpp:44
QtWaylandClient::QWaylandBrcmGLContext::QWaylandBrcmGLContext
QWaylandBrcmGLContext(EGLDisplay eglDisplay, const QSurfaceFormat &format, QPlatformOpenGLContext *share)
Definition
qwaylandbrcmglcontext.cpp:26
QtWaylandClient::QWaylandBrcmGLContext::doneCurrent
void doneCurrent() override
Definition
qwaylandbrcmglcontext.cpp:54
QtWaylandClient::QWaylandBrcmGLContext::eglContext
EGLContext eglContext() const
Definition
qwaylandbrcmglcontext.h:36
QtWaylandClient::QWaylandBrcmGLContext::QWaylandBrcmGLContext
QWaylandBrcmGLContext()
QtWaylandClient::QWaylandBrcmGLContext::getProcAddress
QFunctionPointer getProcAddress(const char *procName) override
Reimplement in subclass to allow dynamic querying of OpenGL symbols.
Definition
qwaylandbrcmglcontext.cpp:64
QtWaylandClient
Definition
qwaylandclientextension.h:16
QtWaylandClient::brcmFixFormat
QSurfaceFormat brcmFixFormat(const QSurfaceFormat &f)
Definition
qwaylandbrcmeglwindow.cpp:137
qtbase
src
plugins
platforms
wayland
plugins
hardwareintegration
brcm-egl
qwaylandbrcmglcontext.cpp
Generated on
for Qt by
1.18.0