File indexing completed on 2024-05-19 05:31:56

0001 /*
0002     KWin - the KDE window manager
0003     This file is part of the KDE project.
0004 
0005     SPDX-FileCopyrightText: 2023 Xaver Hugl <xaver.hugl@gmail.com>
0006 
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 #pragma once
0010 #include "kwin_export.h"
0011 #include "utils/version.h"
0012 
0013 #include <stdint.h>
0014 #include <string_view>
0015 
0016 #include <QByteArray>
0017 #include <QSet>
0018 
0019 namespace KWin
0020 {
0021 
0022 class KWIN_EXPORT OpenGlContext
0023 {
0024 public:
0025     explicit OpenGlContext();
0026     virtual ~OpenGlContext() = default;
0027 
0028     bool hasVersion(const Version &version) const;
0029 
0030     QByteArrayView openglVersionString() const;
0031     Version openglVersion() const;
0032     QByteArrayView vendor() const;
0033     QByteArrayView renderer() const;
0034     bool isOpenglES() const;
0035     bool hasOpenglExtension(QByteArrayView name) const;
0036     bool isSoftwareRenderer() const;
0037     bool supportsTimerQueries() const;
0038 
0039     /**
0040      * checks whether or not this context supports all the features that KWin requires
0041      */
0042     bool checkSupported() const;
0043 
0044 protected:
0045     bool checkTimerQuerySupport() const;
0046 
0047     const QByteArrayView m_versionString;
0048     const Version m_version;
0049     const QByteArrayView m_vendor;
0050     const QByteArrayView m_renderer;
0051     const bool m_isOpenglES;
0052     const QSet<QByteArray> m_extensions;
0053     const bool m_supportsTimerQueries;
0054 };
0055 
0056 }