3f4995fb9b
Summary: The current way to specify the OpenGL context attributes does no longer scale as can be seen in D6344. There are too many different context attribute sets and with every addition we grow lots of copied code. The chances to introduce errors in that code which is difficult to debug are very high. As can be seen in the glx backend which defines major 1, minor 2, but it should be major 2, minor 1. This change reworks this code by creating a builder class which contains only an abstract definition of what needs to be in the attributes. E.g. the version, whether it's robust and so on. Now we can just have a list of possible attributes in a well described way: auto builder; builder.setVersion(3, 1); builder.setRobust(true); All possible builders are added to a list and operated on in a for loop which tries to creat a context. Once it succeeded it breaks the list. In addition a debug statement is added which prints out the set of options which went into the context. So far this is only done for EGL, GLX can follow once D6344 is merged. Test Plan: New unit test added, kwin_wayland OpenGL tests run and verified Reviewers: #kwin, #plasma Subscribers: plasma-devel, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D6396
36 lines
1.3 KiB
C++
36 lines
1.3 KiB
C++
/********************************************************************
|
|
KWin - the KDE window manager
|
|
This file is part of the KDE project.
|
|
|
|
Copyright (C) 2017 Martin Flöser <mgraesslin@kde.org>
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*********************************************************************/
|
|
#include "abstract_opengl_context_attribute_builder.h"
|
|
|
|
namespace KWin
|
|
{
|
|
|
|
QDebug AbstractOpenGLContextAttributeBuilder::operator<<(QDebug dbg) const
|
|
{
|
|
QDebugStateSaver saver(dbg);
|
|
dbg.nospace() << "\nVersion requested:\t" << isVersionRequested() << "\n";
|
|
if (isVersionRequested()) {
|
|
dbg.nospace() << "Version:\t" << majorVersion() << "." << minorVersion() << "\n";
|
|
}
|
|
dbg.nospace() << "Robust:\t" << isRobust();
|
|
return dbg;
|
|
}
|
|
|
|
}
|