From deddda418e4003f79bf292baea1ea4d0a731e58c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 24 Feb 2021 23:06:42 +0100 Subject: [PATCH] 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). --- src/Magnum/GL/Context.cpp | 4 ++++ src/Magnum/GL/Context.h | 11 +++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Magnum/GL/Context.cpp b/src/Magnum/GL/Context.cpp index 2fe912ccc..d86aa5b35 100644 --- a/src/Magnum/GL/Context.cpp +++ b/src/Magnum/GL/Context.cpp @@ -738,7 +738,9 @@ Context::Context(Context&& other) noexcept: _version{other._version}, #endif _extensionStatus{other._extensionStatus}, _extensionRequiredVersion{other._extensionRequiredVersion}, + #ifdef MAGNUM_BUILD_DEPRECATED _supportedExtensions{std::move(other._supportedExtensions)}, + #endif _state{std::move(other._state)}, _detectedDrivers{std::move(other._detectedDrivers)} { @@ -909,7 +911,9 @@ bool Context::tryCreate(const Configuration& configuration) { const Containers::Array extensions = extensionStrings(); for(const Containers::StringView extension: extensions) { if(const Extension* found = findExtension(extension, future)) { + #ifdef MAGNUM_BUILD_DEPRECATED arrayAppend(_supportedExtensions, *found); + #endif _extensionStatus.set(found->index(), true); } } diff --git a/src/Magnum/GL/Context.h b/src/Magnum/GL/Context.h index 8a1766a74..e0d9fdb3e 100644 --- a/src/Magnum/GL/Context.h +++ b/src/Magnum/GL/Context.h @@ -615,16 +615,21 @@ class MAGNUM_GL_EXPORT Context { Flags flags() const { return _flags; } #endif + #ifdef MAGNUM_BUILD_DEPRECATED /** * @brief Supported extensions * * The list contains only extensions from OpenGL versions newer than * 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 supportedExtensions() const { + CORRADE_DEPRECATED("use extensionStrings(), Extension::extensions() and isExtensionSupported() instead") Containers::ArrayView supportedExtensions() const { return _supportedExtensions; } + #endif #ifndef MAGNUM_TARGET_GLES /** @@ -842,7 +847,9 @@ class MAGNUM_GL_EXPORT Context { this field contains the minimal required GL version the extension needs. Extensions that are disabled have None here. */ Containers::StaticArray _extensionRequiredVersion; + #ifdef MAGNUM_BUILD_DEPRECATED Containers::Array _supportedExtensions; + #endif Containers::Pointer _state;