KWin
Loading...
Searching...
No Matches
openglbackend.h
Go to the documentation of this file.
1/*
2 KWin - the KDE window manager
3 This file is part of the KDE project.
4
5 SPDX-FileCopyrightText: 2006 Lubos Lunak <l.lunak@kde.org>
6 SPDX-FileCopyrightText: 2009, 2010, 2011 Martin Gräßlin <mgraesslin@kde.org>
7
8 SPDX-License-Identifier: GPL-2.0-or-later
9*/
10#pragma once
11
12#include "core/renderbackend.h"
13
14#include <QRegion>
15#include <memory>
16
17namespace KWin
18{
19class Output;
20class OpenGLBackend;
21class GLTexture;
22
37class KWIN_EXPORT OpenGLBackend : public RenderBackend
38{
39 Q_OBJECT
40
41public:
43 virtual ~OpenGLBackend();
44
45 virtual void init() = 0;
46 CompositingType compositingType() const override final;
47 bool checkGraphicsReset() override final;
48
49 virtual bool makeCurrent() = 0;
50 virtual void doneCurrent() = 0;
51
60 bool isFailed() const
61 {
62 return m_failed;
63 }
64
65 bool supportsBufferAge() const
66 {
67 return m_haveBufferAge;
68 }
69
71 {
72 return m_haveNativeFence;
73 }
74
80 QList<QByteArray> extensions() const
81 {
82 return m_extensions;
83 }
84
88 bool hasExtension(const QByteArray &extension) const
89 {
90 return m_extensions.contains(extension);
91 }
92
96 void copyPixels(const QRegion &region, const QSize &screenSize);
97
98 virtual std::pair<std::shared_ptr<GLTexture>, ColorDescription> textureForOutput(Output *output) const;
99
100protected:
109 void setFailed(const QString &reason);
110
111 void setSupportsBufferAge(bool value)
112 {
113 m_haveBufferAge = value;
114 }
115
116 void setSupportsNativeFence(bool value)
117 {
118 m_haveNativeFence = value;
119 }
120
126 void setExtensions(const QList<QByteArray> &extensions)
127 {
128 m_extensions = extensions;
129 }
130
131private:
135 bool m_haveBufferAge;
139 bool m_haveNativeFence = false;
143 bool m_failed;
144 QList<QByteArray> m_extensions;
145};
146
147}
The OpenGLBackend creates and holds the OpenGL context and is responsible for Texture from Pixmap.
void setSupportsBufferAge(bool value)
void setSupportsNativeFence(bool value)
QList< QByteArray > extensions() const
virtual void init()=0
bool supportsNativeFence() const
void setExtensions(const QList< QByteArray > &extensions)
bool hasExtension(const QByteArray &extension) const
bool supportsBufferAge() const
CompositingType
Definition globals.h:28