aboutsummaryrefslogtreecommitdiff
path: root/src/client/renderingengine.cpp
diff options
context:
space:
mode:
authorhecks <42101236+hecktest@users.noreply.github.com>2021-07-11 09:50:34 +0200
committerGitHub <noreply@github.com>2021-07-11 09:50:34 +0200
commit1d25d1f7ad35f739e8a64c2bdb44105998aed19b (patch)
tree34af48bb94a2e464e6c7c775b353f64777bd650a /src/client/renderingengine.cpp
parent29522017a3c06f16a2fe2ef484ed3088b42748ea (diff)
downloadminetest-1d25d1f7ad35f739e8a64c2bdb44105998aed19b.tar.gz
minetest-1d25d1f7ad35f739e8a64c2bdb44105998aed19b.tar.bz2
minetest-1d25d1f7ad35f739e8a64c2bdb44105998aed19b.zip
Refactor video driver name retrieval (#11413)
Co-authored-by: hecktest <>
Diffstat (limited to 'src/client/renderingengine.cpp')
-rw-r--r--src/client/renderingengine.cpp29
1 files changed, 8 insertions, 21 deletions
diff --git a/src/client/renderingengine.cpp b/src/client/renderingengine.cpp
index 558a9dd7a..037ede074 100644
--- a/src/client/renderingengine.cpp
+++ b/src/client/renderingengine.cpp
@@ -105,7 +105,7 @@ RenderingEngine::RenderingEngine(IEventReceiver *receiver)
u32 i;
for (i = 0; i != drivers.size(); i++) {
if (!strcasecmp(driverstring.c_str(),
- RenderingEngine::getVideoDriverName(drivers[i]))) {
+ RenderingEngine::getVideoDriverInfo(drivers[i]).name.c_str())) {
driverType = drivers[i];
break;
}
@@ -555,28 +555,15 @@ void RenderingEngine::draw_scene(video::SColor skycolor, bool show_hud,
core->draw(skycolor, show_hud, show_minimap, draw_wield_tool, draw_crosshair);
}
-const char *RenderingEngine::getVideoDriverName(irr::video::E_DRIVER_TYPE type)
+const VideoDriverInfo &RenderingEngine::getVideoDriverInfo(irr::video::E_DRIVER_TYPE type)
{
- static const std::unordered_map<irr::video::E_DRIVER_TYPE,const std::string> driver_ids = {
- {irr::video::EDT_NULL, "null"},
- {irr::video::EDT_OPENGL, "opengl"},
- {irr::video::EDT_OGLES1, "ogles1"},
- {irr::video::EDT_OGLES2, "ogles2"},
+ static const std::unordered_map<irr::video::E_DRIVER_TYPE,VideoDriverInfo> driver_info_map = {
+ {irr::video::EDT_NULL, {"null", "NULL Driver"}},
+ {irr::video::EDT_OPENGL, {"opengl", "OpenGL"}},
+ {irr::video::EDT_OGLES1, {"ogles1", "OpenGL ES1"}},
+ {irr::video::EDT_OGLES2, {"ogles2", "OpenGL ES2"}},
};
-
- return driver_ids.at(type).c_str();
-}
-
-const char *RenderingEngine::getVideoDriverFriendlyName(irr::video::E_DRIVER_TYPE type)
-{
- static const std::unordered_map<irr::video::E_DRIVER_TYPE,const std::string> driver_names = {
- {irr::video::EDT_NULL, "NULL Driver"},
- {irr::video::EDT_OPENGL, "OpenGL"},
- {irr::video::EDT_OGLES1, "OpenGL ES1"},
- {irr::video::EDT_OGLES2, "OpenGL ES2"},
- };
-
- return driver_names.at(type).c_str();
+ return driver_info_map.at(type);
}
#ifndef __ANDROID__