1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-11 17:51:04 +00:00

Drop fixed pipeline support code (#15421)

OpenGL 2.0 is now mandatory.
This commit is contained in:
sfan5 2024-11-13 14:24:01 +01:00 committed by GitHub
parent 0fde9ab7e8
commit 794aea8e92
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
35 changed files with 117 additions and 411 deletions

View file

@ -307,9 +307,6 @@ public:
private:
// Are shaders even enabled?
bool m_enabled;
// The id of the thread that is allowed to use irrlicht directly
std::thread::id m_main_thread;
@ -348,12 +345,6 @@ ShaderSource::ShaderSource()
// Add a dummy ShaderInfo as the first index, named ""
m_shaderinfo_cache.emplace_back();
m_enabled = g_settings->getBool("enable_shaders");
if (!m_enabled) {
warningstream << "You are running " PROJECT_NAME_C " with shaders disabled, "
"this is not a recommended configuration." << std::endl;
}
// Add main global constant setter
addShaderConstantSetterFactory(new MainShaderConstantSetterFactory());
}
@ -362,11 +353,9 @@ ShaderSource::~ShaderSource()
{
MutexAutoLock lock(m_shaderinfo_cache_mutex);
if (!m_enabled)
return;
// Delete materials
auto *gpu = RenderingEngine::get_video_driver()->getGPUProgrammingServices();
assert(gpu);
for (ShaderInfo &i : m_shaderinfo_cache) {
if (!i.name.empty())
gpu->deleteShaderMaterial(i.material);
@ -495,11 +484,9 @@ void ShaderSource::rebuildShaders()
{
MutexAutoLock lock(m_shaderinfo_cache_mutex);
if (!m_enabled)
return;
// Delete materials
auto *gpu = RenderingEngine::get_video_driver()->getGPUProgrammingServices();
assert(gpu);
for (ShaderInfo &i : m_shaderinfo_cache) {
if (!i.name.empty()) {
gpu->deleteShaderMaterial(i.material);
@ -546,14 +533,14 @@ ShaderInfo ShaderSource::generateShader(const std::string &name,
}
shaderinfo.material = shaderinfo.base_material;
if (!m_enabled)
video::IVideoDriver *driver = RenderingEngine::get_video_driver();
// The null driver doesn't support shaders (duh), but we can pretend it does.
if (driver->getDriverType() == video::EDT_NULL)
return shaderinfo;
video::IVideoDriver *driver = RenderingEngine::get_video_driver();
auto *gpu = driver->getGPUProgrammingServices();
if (!driver->queryFeature(video::EVDF_ARB_GLSL) || !gpu) {
throw ShaderException(gettext("Shaders are enabled but GLSL is not "
"supported by the driver."));
throw ShaderException(gettext("GLSL is not supported by the driver"));
}
// Create shaders header