KWin
Loading...
Searching...
No Matches
eglcontext.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: 2023 Xaver Hugl <xaver.hugl@gmail.com>
6
7 SPDX-License-Identifier: GPL-2.0-or-later
8*/
9#pragma once
10
11#include "opengl/gltexture.h"
13
14#include <QByteArray>
15#include <QList>
16#include <epoxy/egl.h>
17
18namespace KWin
19{
20
21class EglDisplay;
22class ShaderManager;
23struct DmaBufAttributes;
24
25class KWIN_EXPORT EglContext : public OpenGlContext
26{
27public:
28 EglContext(EglDisplay *display, EGLConfig config, ::EGLContext context);
29 ~EglContext() override;
30
31 bool makeCurrent(EGLSurface surface = EGL_NO_SURFACE) const;
32 void doneCurrent() const;
33 std::shared_ptr<GLTexture> importDmaBufAsTexture(const DmaBufAttributes &attributes) const;
34
35 EglDisplay *displayObject() const;
36 ::EGLContext handle() const;
37 EGLConfig config() const;
38 bool isValid() const;
39 ShaderManager *shaderManager() const;
40
41 static std::unique_ptr<EglContext> create(EglDisplay *display, EGLConfig config, ::EGLContext sharedContext);
42
43private:
44 static ::EGLContext createContext(EglDisplay *display, EGLConfig config, ::EGLContext sharedContext);
45
46 EglDisplay *const m_display;
47 const ::EGLContext m_handle;
48 const EGLConfig m_config;
49 std::unique_ptr<ShaderManager> m_shaderManager;
50 uint32_t m_vao = 0;
51};
52
53}
Manager for Shaders.