diff --git a/irr/src/OpenGL/ExtensionHandler.cpp b/irr/src/OpenGL/ExtensionHandler.cpp index 3ac212987..3c248ba0a 100644 --- a/irr/src/OpenGL/ExtensionHandler.cpp +++ b/irr/src/OpenGL/ExtensionHandler.cpp @@ -12,47 +12,14 @@ #include "os.h" #include -// FIXME: this basically duplicates what mt_opengl.h already does - namespace irr { namespace video { -void COpenGL3ExtensionHandler::initExtensionsOld() -{ - auto extensions_string = reinterpret_cast(GL.GetString(GL_EXTENSIONS)); - const char *pos = extensions_string; - while (const char *next = strchr(pos, ' ')) { - addExtension(std::string{pos, next}); - pos = next + 1; - } - addExtension(pos); - extensionsLoaded(); -} -void COpenGL3ExtensionHandler::initExtensionsNew() +void COpenGL3ExtensionHandler::initExtensions() { - int ext_count = GetInteger(GL_NUM_EXTENSIONS); - for (int k = 0; k < ext_count; k++) - addExtension(reinterpret_cast(GL.GetStringi(GL_EXTENSIONS, k))); - extensionsLoaded(); -} - -void COpenGL3ExtensionHandler::addExtension(std::string &&name) -{ - Extensions.emplace(std::move(name)); -} - -bool COpenGL3ExtensionHandler::queryExtension(const std::string &name) const noexcept -{ - return Extensions.find(name) != Extensions.end(); -} - -void COpenGL3ExtensionHandler::extensionsLoaded() -{ - os::Printer::log((std::string("Loaded ") + std::to_string(Extensions.size()) + " extensions:").c_str(), ELL_DEBUG); - for (const auto &it : Extensions) - os::Printer::log((std::string(" ") + it).c_str(), ELL_DEBUG); + // reading extensions happens in mt_opengl.cpp for (size_t j = 0; j < IRR_OGLES_Feature_Count; ++j) FeatureAvailable[j] = queryExtension(getFeatureString(j)); } diff --git a/irr/src/OpenGL/ExtensionHandler.h b/irr/src/OpenGL/ExtensionHandler.h index 74c3e0b8a..8f76c0eea 100644 --- a/irr/src/OpenGL/ExtensionHandler.h +++ b/irr/src/OpenGL/ExtensionHandler.h @@ -28,11 +28,13 @@ class COpenGL3ExtensionHandler : public COGLESCoreExtensionHandler COpenGL3ExtensionHandler() : COGLESCoreExtensionHandler() {} - void initExtensionsOld(); - void initExtensionsNew(); + void initExtensions(); /// Checks whether a named extension is present - bool queryExtension(const std::string &name) const noexcept; + inline bool queryExtension(const std::string &name) const noexcept + { + return GL.IsExtensionPresent(name); + } bool queryFeature(video::E_VIDEO_DRIVER_FEATURE feature) const { @@ -159,12 +161,6 @@ class COpenGL3ExtensionHandler : public COGLESCoreExtensionHandler bool AnisotropicFilterSupported = false; bool BlendMinMaxSupported = false; - -private: - void addExtension(std::string &&name); - void extensionsLoaded(); - - std::unordered_set Extensions; }; } diff --git a/irr/src/OpenGL3/Driver.cpp b/irr/src/OpenGL3/Driver.cpp index 8196a8117..fd018b91d 100644 --- a/irr/src/OpenGL3/Driver.cpp +++ b/irr/src/OpenGL3/Driver.cpp @@ -36,7 +36,7 @@ void COpenGL3Driver::initFeatures() { assert(Version.Spec == OpenGLSpec::Compat); assert(isVersionAtLeast(3, 2)); - initExtensionsNew(); + initExtensions(); TextureFormats[ECF_A1R5G5B5] = {GL_RGB5_A1, GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV}; // WARNING: may not be renderable TextureFormats[ECF_R5G6B5] = {GL_RGB, GL_RGB, GL_UNSIGNED_SHORT_5_6_5}; // GL_RGB565 is an extension until 4.1 diff --git a/irr/src/OpenGLES2/Driver.cpp b/irr/src/OpenGLES2/Driver.cpp index 6278ee9c3..249b6caef 100644 --- a/irr/src/OpenGLES2/Driver.cpp +++ b/irr/src/OpenGLES2/Driver.cpp @@ -31,10 +31,7 @@ void COpenGLES2Driver::initFeatures() { assert(Version.Spec == OpenGLSpec::ES); assert(Version.Major >= 2); - if (Version.Major >= 3) - initExtensionsNew(); - else - initExtensionsOld(); + initExtensions(); static const GLenum BGRA8_EXT = 0x93A1;