Changeset View
Changeset View
Standalone View
Standalone View
plugins/platforms/x11/standalone/glx_context_attribute_builder.cpp
- This file was added.
1 | /******************************************************************** | ||||
---|---|---|---|---|---|
2 | KWin - the KDE window manager | ||||
3 | This file is part of the KDE project. | ||||
4 | | ||||
5 | Copyright (C) 2017 Martin Flöser <mgraesslin@kde.org> | ||||
6 | | ||||
7 | This program is free software; you can redistribute it and/or modify | ||||
8 | it under the terms of the GNU General Public License as published by | ||||
9 | the Free Software Foundation; either version 2 of the License, or | ||||
10 | (at your option) any later version. | ||||
11 | | ||||
12 | This program is distributed in the hope that it will be useful, | ||||
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
15 | GNU General Public License for more details. | ||||
16 | | ||||
17 | You should have received a copy of the GNU General Public License | ||||
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||||
19 | *********************************************************************/ | ||||
20 | #include "glx_context_attribute_builder.h" | ||||
21 | #include <epoxy/glx.h> | ||||
22 | | ||||
23 | #ifndef GLX_GENERATE_RESET_ON_VIDEO_MEMORY_PURGE_NV | ||||
24 | #define GLX_GENERATE_RESET_ON_VIDEO_MEMORY_PURGE_NV 0x20F7 | ||||
25 | #endif | ||||
26 | | ||||
27 | namespace KWin | ||||
28 | { | ||||
29 | | ||||
30 | std::vector<int> GlxContextAttributeBuilder::build() const | ||||
31 | { | ||||
32 | std::vector<int> attribs; | ||||
33 | if (isVersionRequested()) { | ||||
34 | attribs.emplace_back(GLX_CONTEXT_MAJOR_VERSION_ARB); | ||||
35 | attribs.emplace_back(majorVersion()); | ||||
36 | attribs.emplace_back(GLX_CONTEXT_MINOR_VERSION_ARB); | ||||
37 | attribs.emplace_back(minorVersion()); | ||||
38 | } | ||||
39 | if (isRobust()) { | ||||
40 | attribs.emplace_back(GLX_CONTEXT_FLAGS_ARB); | ||||
41 | attribs.emplace_back(GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB); | ||||
42 | attribs.emplace_back(GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB); | ||||
43 | attribs.emplace_back(GLX_LOSE_CONTEXT_ON_RESET_ARB); | ||||
44 | if (isResetOnVideoMemoryPurge()) { | ||||
45 | attribs.emplace_back(GLX_GENERATE_RESET_ON_VIDEO_MEMORY_PURGE_NV); | ||||
46 | attribs.emplace_back(GL_TRUE); | ||||
47 | } | ||||
48 | } | ||||
49 | attribs.emplace_back(0); | ||||
50 | return attribs; | ||||
51 | } | ||||
52 | | ||||
53 | } |