mirror of
https://github.com/minetest/irrlicht.git
synced 2025-06-28 06:20:21 +02:00
OpenGL3: New extension listing system
This commit is contained in:
@ -1504,16 +1504,14 @@ COpenGL3DriverBase::~COpenGL3DriverBase()
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef GL_EXT_texture_filter_anisotropic
|
||||
if (FeatureAvailable[COGLESCoreExtensionHandler::IRR_GL_EXT_texture_filter_anisotropic] &&
|
||||
if (AnisotropicFilterSupported &&
|
||||
(!tmpTexture->getStatesCache().IsCached || material.TextureLayer[i].AnisotropicFilter != tmpTexture->getStatesCache().AnisotropicFilter))
|
||||
{
|
||||
glTexParameteri(tmpTextureType, GL_TEXTURE_MAX_ANISOTROPY_EXT,
|
||||
glTexParameteri(tmpTextureType, GL.TEXTURE_MAX_ANISOTROPY,
|
||||
material.TextureLayer[i].AnisotropicFilter>1 ? core::min_(MaxAnisotropy, material.TextureLayer[i].AnisotropicFilter) : 1);
|
||||
|
||||
tmpTexture->getStatesCache().AnisotropicFilter = material.TextureLayer[i].AnisotropicFilter;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!tmpTexture->getStatesCache().IsCached || material.TextureLayer[i].TextureWrapU != tmpTexture->getStatesCache().WrapU)
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -6,6 +6,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <unordered_set>
|
||||
|
||||
#include "EDriverFeatures.h"
|
||||
#include "irrTypes.h"
|
||||
#include "os.h"
|
||||
@ -28,6 +30,9 @@ namespace video
|
||||
void initExtensionsOld();
|
||||
void initExtensionsNew();
|
||||
|
||||
/// Checks whether a named extension is present
|
||||
bool queryExtension(const std::string &name) const noexcept;
|
||||
|
||||
bool queryFeature(video::E_VIDEO_DRIVER_FEATURE feature) const
|
||||
{
|
||||
switch (feature)
|
||||
@ -160,8 +165,13 @@ namespace video
|
||||
glBlendEquation(mode);
|
||||
}
|
||||
|
||||
bool AnisotropicFilterSupported = false;
|
||||
|
||||
private:
|
||||
void addExtension(const char *name);
|
||||
void addExtension(std::string name);
|
||||
void updateLegacyExtensionList();
|
||||
|
||||
std::unordered_set<std::string> Extensions;
|
||||
};
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user