2023-03-25 09:11:09 +01:00
|
|
|
// Copyright (C) 2015 Patryk Nadrowski
|
|
|
|
// Copyright (C) 2009-2010 Amundis
|
|
|
|
// 2017 modified by Michael Zeilfelder (unifying extension handlers)
|
|
|
|
// This file is part of the "Irrlicht Engine".
|
|
|
|
// For conditions of distribution and use, see copyright notice in Irrlicht.h
|
|
|
|
|
|
|
|
#include "ExtensionHandler.h"
|
|
|
|
|
|
|
|
#include "irrString.h"
|
|
|
|
#include "SMaterial.h"
|
|
|
|
#include "fast_atof.h"
|
|
|
|
#include <mt_opengl.h>
|
|
|
|
|
|
|
|
namespace irr
|
|
|
|
{
|
|
|
|
namespace video
|
|
|
|
{
|
2023-04-15 17:11:08 +02:00
|
|
|
void COpenGL3ExtensionHandler::initExtensionsOld()
|
2023-03-25 09:11:09 +01:00
|
|
|
{
|
2023-10-07 18:47:16 +02:00
|
|
|
auto extensions_string = reinterpret_cast<const char *>(GL.GetString(GL_EXTENSIONS));
|
2023-04-15 17:11:08 +02:00
|
|
|
const char *pos = extensions_string;
|
|
|
|
while (const char *next = strchr(pos, ' ')) {
|
2023-04-20 16:37:15 +02:00
|
|
|
addExtension(std::string{pos, next});
|
2023-04-15 17:11:08 +02:00
|
|
|
pos = next + 1;
|
|
|
|
}
|
|
|
|
addExtension(pos);
|
2023-04-20 16:37:15 +02:00
|
|
|
updateLegacyExtensionList();
|
2023-04-15 17:11:08 +02:00
|
|
|
}
|
2023-03-25 09:11:09 +01:00
|
|
|
|
2023-04-15 17:11:08 +02:00
|
|
|
void COpenGL3ExtensionHandler::initExtensionsNew()
|
|
|
|
{
|
2023-04-15 18:33:23 +02:00
|
|
|
int ext_count = GetInteger(GL_NUM_EXTENSIONS);
|
2023-04-15 17:11:08 +02:00
|
|
|
for (int k = 0; k < ext_count; k++)
|
|
|
|
addExtension(reinterpret_cast<const char *>(GL.GetStringi(GL_EXTENSIONS, k)));
|
2023-04-20 16:37:15 +02:00
|
|
|
updateLegacyExtensionList();
|
2023-04-15 17:11:08 +02:00
|
|
|
}
|
2023-03-25 09:11:09 +01:00
|
|
|
|
2023-04-20 16:37:15 +02:00
|
|
|
void COpenGL3ExtensionHandler::addExtension(std::string name) {
|
|
|
|
Extensions.emplace(std::move(name));
|
|
|
|
}
|
|
|
|
|
2023-10-07 18:57:40 +02:00
|
|
|
bool COpenGL3ExtensionHandler::queryExtension(const std::string &name) const noexcept {
|
2023-04-20 16:37:15 +02:00
|
|
|
return Extensions.find(name) != Extensions.end();
|
2023-03-25 09:11:09 +01:00
|
|
|
}
|
2023-04-20 16:37:15 +02:00
|
|
|
|
|
|
|
void COpenGL3ExtensionHandler::updateLegacyExtensionList() {
|
|
|
|
for (size_t j = 0; j < IRR_OGLES_Feature_Count; ++j)
|
|
|
|
FeatureAvailable[j] = queryExtension(getFeatureString(j));
|
|
|
|
}
|
|
|
|
|
2023-03-25 09:11:09 +01:00
|
|
|
} // end namespace video
|
|
|
|
} // end namespace irr
|