From edf098db637bf74d4675ce900dc9c0b8ee528a03 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Tue, 15 Jun 2021 19:11:56 +0200 Subject: Drop --videomodes, fullscreen_bpp and high_precision_fpu settings These have been pointless for a while. --- src/client/renderingengine.cpp | 78 +----------------------------------------- 1 file changed, 1 insertion(+), 77 deletions(-) (limited to 'src/client/renderingengine.cpp') diff --git a/src/client/renderingengine.cpp b/src/client/renderingengine.cpp index 4f96a6e37..9015fb82a 100644 --- a/src/client/renderingengine.cpp +++ b/src/client/renderingengine.cpp @@ -92,7 +92,6 @@ RenderingEngine::RenderingEngine(IEventReceiver *receiver) // bpp, fsaa, vsync bool vsync = g_settings->getBool("vsync"); - u16 bits = g_settings->getU16("fullscreen_bpp"); u16 fsaa = g_settings->getU16("fsaa"); // stereo buffer required for pageflip stereo @@ -122,15 +121,13 @@ RenderingEngine::RenderingEngine(IEventReceiver *receiver) params.LoggingLevel = irr::ELL_DEBUG; params.DriverType = driverType; params.WindowSize = core::dimension2d(screen_w, screen_h); - params.Bits = bits; params.AntiAlias = fsaa; params.Fullscreen = fullscreen; params.Stencilbuffer = false; params.Stereobuffer = stereo_buffer; params.Vsync = vsync; params.EventReceiver = receiver; - params.HighPrecisionFPU = g_settings->getBool("high_precision_fpu"); - params.ZBufferBits = 24; + params.HighPrecisionFPU = true; #ifdef __ANDROID__ params.PrivateData = porting::app_global; #endif @@ -171,60 +168,6 @@ void RenderingEngine::setResizable(bool resize) m_device->setResizable(resize); } -bool RenderingEngine::print_video_modes() -{ - IrrlichtDevice *nulldevice; - - bool vsync = g_settings->getBool("vsync"); - u16 fsaa = g_settings->getU16("fsaa"); - MyEventReceiver *receiver = new MyEventReceiver(); - - SIrrlichtCreationParameters params = SIrrlichtCreationParameters(); - params.DriverType = video::EDT_NULL; - params.WindowSize = core::dimension2d(640, 480); - params.Bits = 24; - params.AntiAlias = fsaa; - params.Fullscreen = false; - params.Stencilbuffer = false; - params.Vsync = vsync; - params.EventReceiver = receiver; - params.HighPrecisionFPU = g_settings->getBool("high_precision_fpu"); - - nulldevice = createDeviceEx(params); - - if (!nulldevice) { - delete receiver; - return false; - } - - std::cout << _("Available video modes (WxHxD):") << std::endl; - - video::IVideoModeList *videomode_list = nulldevice->getVideoModeList(); - - if (videomode_list != NULL) { - s32 videomode_count = videomode_list->getVideoModeCount(); - core::dimension2d videomode_res; - s32 videomode_depth; - for (s32 i = 0; i < videomode_count; ++i) { - videomode_res = videomode_list->getVideoModeResolution(i); - videomode_depth = videomode_list->getVideoModeDepth(i); - std::cout << videomode_res.Width << "x" << videomode_res.Height - << "x" << videomode_depth << std::endl; - } - - std::cout << _("Active video mode (WxHxD):") << std::endl; - videomode_res = videomode_list->getDesktopResolution(); - videomode_depth = videomode_list->getDesktopDepth(); - std::cout << videomode_res.Width << "x" << videomode_res.Height << "x" - << videomode_depth << std::endl; - } - - nulldevice->drop(); - delete receiver; - - return videomode_list != NULL; -} - void RenderingEngine::removeMesh(const scene::IMesh* mesh) { m_device->getSceneManager()->getMeshCache()->removeMesh(mesh); @@ -582,25 +525,6 @@ void RenderingEngine::draw_menu_scene(gui::IGUIEnvironment *guienv, get_video_driver()->endScene(); } -std::vector> RenderingEngine::getSupportedVideoModes() -{ - IrrlichtDevice *nulldevice = createDevice(video::EDT_NULL); - sanity_check(nulldevice); - - std::vector> mlist; - video::IVideoModeList *modelist = nulldevice->getVideoModeList(); - - s32 num_modes = modelist->getVideoModeCount(); - for (s32 i = 0; i != num_modes; i++) { - core::dimension2d mode_res = modelist->getVideoModeResolution(i); - u32 mode_depth = (u32)modelist->getVideoModeDepth(i); - mlist.emplace_back(mode_res.Width, mode_res.Height, mode_depth); - } - - nulldevice->drop(); - return mlist; -} - std::vector RenderingEngine::getSupportedVideoDrivers() { std::vector drivers; -- cgit v1.2.3 From 827a7852e2ac4abfe548fe193b8ed380d5c46d86 Mon Sep 17 00:00:00 2001 From: hecks <42101236+hecktest@users.noreply.github.com> Date: Wed, 30 Jun 2021 20:42:15 +0200 Subject: Remove unsupported video drivers (#11395) This completely removes any mention of the software and D3D drivers from MT, preventing the user from accidentally attempting to use them. Users who need a software renderer should be asked to install Mesa drivers which offer superior fidelity and performance over the 'burningsvideo' driver. --- builtin/settingtypes.txt | 2 +- src/client/renderingengine.cpp | 54 ++++++++++++++++++------------------------ 2 files changed, 24 insertions(+), 32 deletions(-) (limited to 'src/client/renderingengine.cpp') diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt index 648c8c674..17843fac8 100644 --- a/builtin/settingtypes.txt +++ b/builtin/settingtypes.txt @@ -715,7 +715,7 @@ texture_path (Texture path) path # Note: On Android, stick with OGLES1 if unsure! App may fail to start otherwise. # On other platforms, OpenGL is recommended. # Shaders are supported by OpenGL (desktop only) and OGLES2 (experimental) -video_driver (Video driver) enum opengl null,software,burningsvideo,direct3d8,direct3d9,opengl,ogles1,ogles2 +video_driver (Video driver) enum opengl opengl,ogles1,ogles2 # Radius of cloud area stated in number of 64 node cloud squares. # Values larger than 26 will start to produce sharp cutoffs at cloud area corners. diff --git a/src/client/renderingengine.cpp b/src/client/renderingengine.cpp index 9015fb82a..558a9dd7a 100644 --- a/src/client/renderingengine.cpp +++ b/src/client/renderingengine.cpp @@ -284,14 +284,6 @@ static bool getWindowHandle(irr::video::IVideoDriver *driver, HWND &hWnd) const video::SExposedVideoData exposedData = driver->getExposedVideoData(); switch (driver->getDriverType()) { -#if IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR < 9 - case video::EDT_DIRECT3D8: - hWnd = reinterpret_cast(exposedData.D3D8.HWnd); - break; -#endif - case video::EDT_DIRECT3D9: - hWnd = reinterpret_cast(exposedData.D3D9.HWnd); - break; #if ENABLE_GLES case video::EDT_OGLES1: case video::EDT_OGLES2: @@ -527,11 +519,19 @@ void RenderingEngine::draw_menu_scene(gui::IGUIEnvironment *guienv, std::vector RenderingEngine::getSupportedVideoDrivers() { + // Only check these drivers. + // We do not support software and D3D in any capacity. + static const irr::video::E_DRIVER_TYPE glDrivers[4] = { + irr::video::EDT_NULL, + irr::video::EDT_OPENGL, + irr::video::EDT_OGLES1, + irr::video::EDT_OGLES2, + }; std::vector drivers; - for (int i = 0; i != irr::video::EDT_COUNT; i++) { - if (irr::IrrlichtDevice::isDriverSupported((irr::video::E_DRIVER_TYPE)i)) - drivers.push_back((irr::video::E_DRIVER_TYPE)i); + for (int i = 0; i < 4; i++) { + if (irr::IrrlichtDevice::isDriverSupported(glDrivers[i])) + drivers.push_back(glDrivers[i]); } return drivers; @@ -557,34 +557,26 @@ void RenderingEngine::draw_scene(video::SColor skycolor, bool show_hud, const char *RenderingEngine::getVideoDriverName(irr::video::E_DRIVER_TYPE type) { - static const char *driver_ids[] = { - "null", - "software", - "burningsvideo", - "direct3d8", - "direct3d9", - "opengl", - "ogles1", - "ogles2", + static const std::unordered_map driver_ids = { + {irr::video::EDT_NULL, "null"}, + {irr::video::EDT_OPENGL, "opengl"}, + {irr::video::EDT_OGLES1, "ogles1"}, + {irr::video::EDT_OGLES2, "ogles2"}, }; - return driver_ids[type]; + return driver_ids.at(type).c_str(); } const char *RenderingEngine::getVideoDriverFriendlyName(irr::video::E_DRIVER_TYPE type) { - static const char *driver_names[] = { - "NULL Driver", - "Software Renderer", - "Burning's Video", - "Direct3D 8", - "Direct3D 9", - "OpenGL", - "OpenGL ES1", - "OpenGL ES2", + static const std::unordered_map 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[type]; + return driver_names.at(type).c_str(); } #ifndef __ANDROID__ -- cgit v1.2.3 From 1d25d1f7ad35f739e8a64c2bdb44105998aed19b Mon Sep 17 00:00:00 2001 From: hecks <42101236+hecktest@users.noreply.github.com> Date: Sun, 11 Jul 2021 09:50:34 +0200 Subject: Refactor video driver name retrieval (#11413) Co-authored-by: hecktest <> --- src/client/renderingengine.cpp | 29 ++++++++--------------------- src/client/renderingengine.h | 7 +++++-- src/script/lua_api/l_mainmenu.cpp | 7 +++---- 3 files changed, 16 insertions(+), 27 deletions(-) (limited to 'src/client/renderingengine.cpp') 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 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 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 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__ diff --git a/src/client/renderingengine.h b/src/client/renderingengine.h index 5299222e2..6f104bba9 100644 --- a/src/client/renderingengine.h +++ b/src/client/renderingengine.h @@ -29,6 +29,10 @@ with this program; if not, write to the Free Software Foundation, Inc., // include the shadow mapper classes too #include "client/shadows/dynamicshadowsrender.h" +struct VideoDriverInfo { + std::string name; + std::string friendly_name; +}; class ITextureSource; class Camera; @@ -49,8 +53,7 @@ public: video::IVideoDriver *getVideoDriver() { return driver; } - static const char *getVideoDriverName(irr::video::E_DRIVER_TYPE type); - static const char *getVideoDriverFriendlyName(irr::video::E_DRIVER_TYPE type); + static const VideoDriverInfo &getVideoDriverInfo(irr::video::E_DRIVER_TYPE type); static float getDisplayDensity(); static v2u32 getDisplaySize(); diff --git a/src/script/lua_api/l_mainmenu.cpp b/src/script/lua_api/l_mainmenu.cpp index 788557460..ad00de1c4 100644 --- a/src/script/lua_api/l_mainmenu.cpp +++ b/src/script/lua_api/l_mainmenu.cpp @@ -737,13 +737,12 @@ int ModApiMainMenu::l_get_video_drivers(lua_State *L) lua_newtable(L); for (u32 i = 0; i != drivers.size(); i++) { - const char *name = RenderingEngine::getVideoDriverName(drivers[i]); - const char *fname = RenderingEngine::getVideoDriverFriendlyName(drivers[i]); + auto &info = RenderingEngine::getVideoDriverInfo(drivers[i]); lua_newtable(L); - lua_pushstring(L, name); + lua_pushstring(L, info.name.c_str()); lua_setfield(L, -2, "name"); - lua_pushstring(L, fname); + lua_pushstring(L, info.friendly_name.c_str()); lua_setfield(L, -2, "friendly_name"); lua_rawseti(L, -2, i + 1); -- cgit v1.2.3 From 5c89a0e12a1e679180b14bf92bdcdb1614e3982e Mon Sep 17 00:00:00 2001 From: sfan5 Date: Mon, 12 Jul 2021 11:53:05 +0200 Subject: Fix build on Ubuntu 16.04 and macOS Apparently the C++ standard library is supposed to provide specializations of std::hash for enums (even in C++11) but those don't always work for whatever reason. --- src/client/renderingengine.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/client/renderingengine.cpp') diff --git a/src/client/renderingengine.cpp b/src/client/renderingengine.cpp index 037ede074..ead4c7e21 100644 --- a/src/client/renderingengine.cpp +++ b/src/client/renderingengine.cpp @@ -557,13 +557,13 @@ void RenderingEngine::draw_scene(video::SColor skycolor, bool show_hud, const VideoDriverInfo &RenderingEngine::getVideoDriverInfo(irr::video::E_DRIVER_TYPE type) { - static const std::unordered_map 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"}}, + static const std::unordered_map driver_info_map = { + {(int)video::EDT_NULL, {"null", "NULL Driver"}}, + {(int)video::EDT_OPENGL, {"opengl", "OpenGL"}}, + {(int)video::EDT_OGLES1, {"ogles1", "OpenGL ES1"}}, + {(int)video::EDT_OGLES2, {"ogles2", "OpenGL ES2"}}, }; - return driver_info_map.at(type); + return driver_info_map.at((int)type); } #ifndef __ANDROID__ -- cgit v1.2.3 From 850293bae6013fe020c454541d61af2c816b3204 Mon Sep 17 00:00:00 2001 From: hecks <42101236+hecktest@users.noreply.github.com> Date: Wed, 21 Jul 2021 22:07:13 +0200 Subject: Remove unused header includes --- src/client/renderingengine.cpp | 1 - src/gui/guiScene.cpp | 1 - src/gui/touchscreengui.cpp | 2 -- 3 files changed, 4 deletions(-) (limited to 'src/client/renderingengine.cpp') diff --git a/src/client/renderingengine.cpp b/src/client/renderingengine.cpp index ead4c7e21..8491dda04 100644 --- a/src/client/renderingengine.cpp +++ b/src/client/renderingengine.cpp @@ -19,7 +19,6 @@ with this program; if not, write to the Free Software Foundation, Inc., */ #include -#include #include "fontengine.h" #include "client.h" #include "clouds.h" diff --git a/src/gui/guiScene.cpp b/src/gui/guiScene.cpp index f0cfbec5e..ee2556b03 100644 --- a/src/gui/guiScene.cpp +++ b/src/gui/guiScene.cpp @@ -21,7 +21,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include -#include #include "porting.h" GUIScene::GUIScene(gui::IGUIEnvironment *env, scene::ISceneManager *smgr, diff --git a/src/gui/touchscreengui.cpp b/src/gui/touchscreengui.cpp index 78b18c2d9..eb20b7e70 100644 --- a/src/gui/touchscreengui.cpp +++ b/src/gui/touchscreengui.cpp @@ -32,8 +32,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include -#include - using namespace irr::core; const char **button_imagenames = (const char *[]) { -- cgit v1.2.3 From e0529da5c84f224c380e6d5e063392cb01f85683 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Sun, 19 Sep 2021 13:46:56 +0200 Subject: Fix trivial typos --- src/client/client.h | 2 +- src/client/renderingengine.cpp | 2 +- src/network/clientpackethandler.cpp | 4 ++-- src/script/cpp_api/s_mainmenu.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/client/renderingengine.cpp') diff --git a/src/client/client.h b/src/client/client.h index f6030b022..b0324ee90 100644 --- a/src/client/client.h +++ b/src/client/client.h @@ -327,7 +327,7 @@ public: } inline void setFatalError(const LuaError &e) { - setFatalError(std::string("Lua :") + e.what()); + setFatalError(std::string("Lua: ") + e.what()); } // Renaming accessDeniedReason to better name could be good as it's used to diff --git a/src/client/renderingengine.cpp b/src/client/renderingengine.cpp index 8491dda04..0fdbc95dc 100644 --- a/src/client/renderingengine.cpp +++ b/src/client/renderingengine.cpp @@ -252,7 +252,7 @@ void RenderingEngine::setupTopLevelXorgWindow(const std::string &name) // force a shutdown of an application if it doesn't respond to the destroy // window message. - verbosestream << "Client: Setting Xorg _NET_WM_PID extened window manager property" + verbosestream << "Client: Setting Xorg _NET_WM_PID extended window manager property" << std::endl; Atom NET_WM_PID = XInternAtom(x11_dpl, "_NET_WM_PID", false); diff --git a/src/network/clientpackethandler.cpp b/src/network/clientpackethandler.cpp index b2965c23d..d20a80fb7 100644 --- a/src/network/clientpackethandler.cpp +++ b/src/network/clientpackethandler.cpp @@ -88,7 +88,7 @@ void Client::handleCommand_Hello(NetworkPacket* pkt) // This is only neccessary though when we actually want to add casing support if (m_chosen_auth_mech != AUTH_MECHANISM_NONE) { - // we recieved a TOCLIENT_HELLO while auth was already going on + // we received a TOCLIENT_HELLO while auth was already going on errorstream << "Client: TOCLIENT_HELLO while auth was already going on" << "(chosen_mech=" << m_chosen_auth_mech << ")." << std::endl; if (m_chosen_auth_mech == AUTH_MECHANISM_SRP || @@ -156,7 +156,7 @@ void Client::handleCommand_AcceptSudoMode(NetworkPacket* pkt) m_password = m_new_password; - verbosestream << "Client: Recieved TOCLIENT_ACCEPT_SUDO_MODE." << std::endl; + verbosestream << "Client: Received TOCLIENT_ACCEPT_SUDO_MODE." << std::endl; // send packet to actually set the password startAuth(AUTH_MECHANISM_FIRST_SRP); diff --git a/src/script/cpp_api/s_mainmenu.h b/src/script/cpp_api/s_mainmenu.h index aef36ce39..470577a29 100644 --- a/src/script/cpp_api/s_mainmenu.h +++ b/src/script/cpp_api/s_mainmenu.h @@ -38,7 +38,7 @@ public: void handleMainMenuEvent(std::string text); /** - * process field data recieved from formspec + * process field data received from formspec * @param fields data in field format */ void handleMainMenuButtons(const StringMap &fields); -- cgit v1.2.3