Browse Source

GL: deprecate Context::supportedExtensions().

I don't see a real use case for this API (and don't remember ever using
it) and it only causes extra overhead during context creation (and then
a ton of useless allocations at runtime).
euler-xxx
Vladimír Vondruš 5 years ago
parent
commit
deddda418e
  1. 4
      src/Magnum/GL/Context.cpp
  2. 11
      src/Magnum/GL/Context.h

4
src/Magnum/GL/Context.cpp

@ -738,7 +738,9 @@ Context::Context(Context&& other) noexcept: _version{other._version},
#endif #endif
_extensionStatus{other._extensionStatus}, _extensionStatus{other._extensionStatus},
_extensionRequiredVersion{other._extensionRequiredVersion}, _extensionRequiredVersion{other._extensionRequiredVersion},
#ifdef MAGNUM_BUILD_DEPRECATED
_supportedExtensions{std::move(other._supportedExtensions)}, _supportedExtensions{std::move(other._supportedExtensions)},
#endif
_state{std::move(other._state)}, _state{std::move(other._state)},
_detectedDrivers{std::move(other._detectedDrivers)} _detectedDrivers{std::move(other._detectedDrivers)}
{ {
@ -909,7 +911,9 @@ bool Context::tryCreate(const Configuration& configuration) {
const Containers::Array<Containers::StringView> extensions = extensionStrings(); const Containers::Array<Containers::StringView> extensions = extensionStrings();
for(const Containers::StringView extension: extensions) { for(const Containers::StringView extension: extensions) {
if(const Extension* found = findExtension(extension, future)) { if(const Extension* found = findExtension(extension, future)) {
#ifdef MAGNUM_BUILD_DEPRECATED
arrayAppend(_supportedExtensions, *found); arrayAppend(_supportedExtensions, *found);
#endif
_extensionStatus.set(found->index(), true); _extensionStatus.set(found->index(), true);
} }
} }

11
src/Magnum/GL/Context.h

@ -615,16 +615,21 @@ class MAGNUM_GL_EXPORT Context {
Flags flags() const { return _flags; } Flags flags() const { return _flags; }
#endif #endif
#ifdef MAGNUM_BUILD_DEPRECATED
/** /**
* @brief Supported extensions * @brief Supported extensions
* *
* The list contains only extensions from OpenGL versions newer than * The list contains only extensions from OpenGL versions newer than
* the current. * the current.
* @see @ref isExtensionSupported(), @ref Extension::extensions() * @m_deprecated_since_latest Deprecated as it doesn't provide anything
* that @ref extensionStrings(), @ref Extension::extensions() and
* @ref isExtensionSupported() wouldn't provide already and only
* causes extra overhead during context creation.
*/ */
Containers::ArrayView<const Extension> supportedExtensions() const { CORRADE_DEPRECATED("use extensionStrings(), Extension::extensions() and isExtensionSupported() instead") Containers::ArrayView<const Extension> supportedExtensions() const {
return _supportedExtensions; return _supportedExtensions;
} }
#endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
/** /**
@ -842,7 +847,9 @@ class MAGNUM_GL_EXPORT Context {
this field contains the minimal required GL version the extension this field contains the minimal required GL version the extension
needs. Extensions that are disabled have None here. */ needs. Extensions that are disabled have None here. */
Containers::StaticArray<Implementation::ExtensionCount, Version> _extensionRequiredVersion; Containers::StaticArray<Implementation::ExtensionCount, Version> _extensionRequiredVersion;
#ifdef MAGNUM_BUILD_DEPRECATED
Containers::Array<Extension> _supportedExtensions; Containers::Array<Extension> _supportedExtensions;
#endif
Containers::Pointer<Implementation::State> _state; Containers::Pointer<Implementation::State> _state;

Loading…
Cancel
Save