From 84d553cd28eee60ab479e50301cae39eeec50477 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 20 Mar 2019 16:11:31 +0100 Subject: [PATCH] GL: get rid of std::bitset and std::array in Context internals. We have our own lighter versions. --- src/Magnum/GL/Context.cpp | 10 +++++++--- src/Magnum/GL/Context.h | 8 ++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/Magnum/GL/Context.cpp b/src/Magnum/GL/Context.cpp index 42795f62d..4a653030f 100644 --- a/src/Magnum/GL/Context.cpp +++ b/src/Magnum/GL/Context.cpp @@ -492,12 +492,16 @@ Context::Context(Context&& other): _version{other._version}, #ifndef MAGNUM_TARGET_WEBGL _flags{other._flags}, #endif - _extensionRequiredVersion(other._extensionRequiredVersion), + _extensionRequiredVersion{Containers::NoInit}, _extensionStatus{other._extensionStatus}, _supportedExtensions{std::move(other._supportedExtensions)}, _state{other._state}, _detectedDrivers{std::move(other._detectedDrivers)} { + /* StaticArray is deliberately non-copyable */ + for(std::size_t i = 0; i != Implementation::ExtensionCount; ++i) + _extensionRequiredVersion[i] = other._extensionRequiredVersion[i]; + other._state = nullptr; if(currentContext == &other) currentContext = this; } @@ -661,7 +665,7 @@ bool Context::tryCreate() { /* Mark all extensions from past versions as supported */ for(std::size_t i = 0; i != future; ++i) for(const Extension& extension: Extension::extensions(versions[i])) - _extensionStatus.set(extension.index()); + _extensionStatus.set(extension.index(), true); /* List of extensions from future versions (extensions from current and previous versions should be supported automatically, so we don't need @@ -677,7 +681,7 @@ bool Context::tryCreate() { const auto found = futureExtensions.find(extension); if(found != futureExtensions.end()) { _supportedExtensions.push_back(found->second); - _extensionStatus.set(found->second.index()); + _extensionStatus.set(found->second.index(), true); } } diff --git a/src/Magnum/GL/Context.h b/src/Magnum/GL/Context.h index dc063f128..be38c3be9 100644 --- a/src/Magnum/GL/Context.h +++ b/src/Magnum/GL/Context.h @@ -30,13 +30,13 @@ */ #include -#include -#include #include #include #include +#include #include "Magnum/Magnum.h" +#include "Magnum/Math/BoolVector.h" #include "Magnum/Tags.h" #include "Magnum/GL/GL.h" #include "Magnum/GL/OpenGL.h" @@ -704,8 +704,8 @@ class MAGNUM_GL_EXPORT Context { Flags _flags; #endif - std::array _extensionRequiredVersion; - std::bitset _extensionStatus; + Containers::StaticArray _extensionRequiredVersion; + Math::BoolVector _extensionStatus; std::vector _supportedExtensions; Implementation::State* _state;