Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 8015e4e8 authored by Martin Flöser's avatar Martin Flöser

Add virtual method to Scene to get the EGL/GLX extensions

Summary:
We had a few places (e.g. DebugConsole, Platform) where the Scene was
cased into a SceneOpenGL to access the backend and get the extensions.

This change simplifies that by adding a virtual method to Scene directly
which is implemented in SceneOpenGL and returns the backend's
extensions.

Thus the casts to SceneOpenGL are no longer required.

Test Plan:
Opened debug console to verify extensions are listed,
triggered Outline to verify the sharing QPA context gets created.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D7734
parent 23eaed2f
......@@ -22,7 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "client.h"
#include "input_event.h"
#include "main.h"
#include "scene_opengl.h"
#include "scene.h"
#include "shell_client.h"
#include "unmanaged.h"
#include "wayland_server.h"
......@@ -528,7 +528,7 @@ void DebugConsole::initGLTab()
m_ui->glVersionLabel->setText(GLPlatform::versionToString(gl->glVersion()));
m_ui->glslLabel->setText(GLPlatform::versionToString(gl->glslVersion()));
auto extensionsString = [] (const QList<QByteArray> &extensions) {
auto extensionsString = [] (const auto &extensions) {
QString text = QStringLiteral("<ul>");
for (auto extension : extensions) {
text.append(QStringLiteral("<li>%1</li>").arg(QString::fromLocal8Bit(extension)));
......@@ -537,7 +537,7 @@ void DebugConsole::initGLTab()
return text;
};
m_ui->platformExtensionsLabel->setText(extensionsString(static_cast<SceneOpenGL*>(Compositor::self()->scene())->backend()->extensions()));
m_ui->platformExtensionsLabel->setText(extensionsString(Compositor::self()->scene()->openGLPlatformInterfaceExtensions()));
m_ui->openGLExtensionsLabel->setText(extensionsString(openGLExtensions()));
}
......
......@@ -19,7 +19,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#include "platform.h"
#include <config-kwin.h>
#include "abstract_egl_backend.h"
#include "composite.h"
#include "cursor.h"
#include "effects.h"
......@@ -27,7 +26,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "overlaywindow.h"
#include "outline.h"
#include "pointer_input.h"
#include "scene_opengl.h"
#include "scene.h"
#include "screenedge.h"
#include "wayland_server.h"
......@@ -353,9 +352,7 @@ void Platform::warpPointer(const QPointF &globalPos)
bool Platform::supportsQpaContext() const
{
if (Compositor *c = Compositor::self()) {
if (SceneOpenGL *s = dynamic_cast<SceneOpenGL*>(c->scene())) {
return s->backend()->hasExtension(QByteArrayLiteral("EGL_KHR_surfaceless_context"));
}
return c->scene()->openGLPlatformInterfaceExtensions().contains(QByteArrayLiteral("EGL_KHR_surfaceless_context"));
}
return false;
}
......
......@@ -671,6 +671,11 @@ QImage *Scene::qpainterRenderBuffer() const
return nullptr;
}
QVector<QByteArray> Scene::openGLPlatformInterfaceExtensions() const
{
return QVector<QByteArray>{};
}
//****************************************
// Scene::Window
//****************************************
......
......@@ -175,6 +175,15 @@ public:
**/
virtual QImage *qpainterRenderBuffer() const;
/**
* The backend specific extensions (e.g. EGL/GLX extensions).
*
* Not the OpenGL (ES) extension!
*
* Default implementation returns empty list
**/
virtual QVector<QByteArray> openGLPlatformInterfaceExtensions() const;
Q_SIGNALS:
void frameRendered();
......
......@@ -1021,6 +1021,11 @@ bool SceneOpenGL::animationsSupported() const
return !GLPlatform::instance()->isSoftwareEmulation();
}
QVector<QByteArray> SceneOpenGL::openGLPlatformInterfaceExtensions() const
{
return m_backend->extensions().toVector();
}
//****************************************
// SceneOpenGL2
//****************************************
......
......@@ -82,6 +82,8 @@ public:
return m_backend;
}
QVector<QByteArray> openGLPlatformInterfaceExtensions() const override;
/**
* Copy a region of pixels from the current read to the current draw buffer
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment