Browse Source

GL: get rid of std::bitset and std::array in Context internals.

We have our own lighter versions.
pull/331/head
Vladimír Vondruš 7 years ago
parent
commit
84d553cd28
  1. 10
      src/Magnum/GL/Context.cpp
  2. 8
      src/Magnum/GL/Context.h

10
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);
}
}

8
src/Magnum/GL/Context.h

@ -30,13 +30,13 @@
*/
#include <cstdlib>
#include <array>
#include <bitset>
#include <vector>
#include <Corrade/Containers/EnumSet.h>
#include <Corrade/Containers/Optional.h>
#include <Corrade/Containers/StaticArray.h>
#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<Version, Implementation::ExtensionCount> _extensionRequiredVersion;
std::bitset<Implementation::ExtensionCount> _extensionStatus;
Containers::StaticArray<Implementation::ExtensionCount, Version> _extensionRequiredVersion;
Math::BoolVector<Implementation::ExtensionCount> _extensionStatus;
std::vector<Extension> _supportedExtensions;
Implementation::State* _state;

Loading…
Cancel
Save