OpenGL3: New extension listing system

This commit is contained in:
numzero
2023-04-20 17:37:15 +03:00
committed by sfan5
parent 13680ef42d
commit 81ad195aa3
6 changed files with 43 additions and 26 deletions

View File

@ -20,11 +20,11 @@ namespace video
auto extensions_string = reinterpret_cast<const char *>(glGetString(GL_EXTENSIONS));
const char *pos = extensions_string;
while (const char *next = strchr(pos, ' ')) {
std::string name{pos, next};
addExtension(name.c_str());
addExtension(std::string{pos, next});
pos = next + 1;
}
addExtension(pos);
updateLegacyExtensionList();
}
void COpenGL3ExtensionHandler::initExtensionsNew()
@ -32,15 +32,21 @@ namespace video
int ext_count = GetInteger(GL_NUM_EXTENSIONS);
for (int k = 0; k < ext_count; k++)
addExtension(reinterpret_cast<const char *>(GL.GetStringi(GL_EXTENSIONS, k)));
updateLegacyExtensionList();
}
void COpenGL3ExtensionHandler::addExtension(const char *name) {
for (size_t j=0; j<IRR_OGLES_Feature_Count; ++j) {
if (!strcmp(getFeatureString(j), name)) {
FeatureAvailable[j] = true;
break;
}
}
void COpenGL3ExtensionHandler::addExtension(std::string name) {
Extensions.emplace(std::move(name));
}
bool COpenGL3ExtensionHandler::queryExtension(const std::string &name) const{
return Extensions.find(name) != Extensions.end();
}
void COpenGL3ExtensionHandler::updateLegacyExtensionList() {
for (size_t j = 0; j < IRR_OGLES_Feature_Count; ++j)
FeatureAvailable[j] = queryExtension(getFeatureString(j));
}
} // end namespace video
} // end namespace irr