]> git.lizzy.rs Git - minetest.git/commitdiff
Drop ENABLE_GLES option
authorsfan5 <sfan5@live.de>
Sun, 5 Mar 2023 14:10:44 +0000 (15:10 +0100)
committersfan5 <sfan5@live.de>
Sat, 8 Apr 2023 18:19:35 +0000 (20:19 +0200)
ENABLE_GLES predates forking Irrlicht. Its primary use was to distinguish Irrlicht-ogles from upstream version as Minetest could be compiled with either.
That's not necessary anymore and gets in the way sometimes.

14 files changed:
README.md
android/native/jni/Android.mk
builtin/settingtypes.txt
src/CMakeLists.txt
src/client/camera.cpp
src/client/guiscalingfilter.cpp
src/client/renderingengine.cpp
src/client/shader.cpp
src/client/tile.cpp
src/client/tile.h
src/cmake_config.h.in
src/defaultsettings.cpp
src/gui/guiEngine.cpp
src/gui/guiEngine.h

index e3b752f9e7e152f7dc8fb2ead6e73538010596fe..62d97c846c9aeee3f6732326bfc55dc50b1074f3 100644 (file)
--- a/README.md
+++ b/README.md
@@ -256,7 +256,6 @@ General options and their default values:
     ENABLE_CURL=ON             - Build with cURL; Enables use of online mod repo, public serverlist and remote media fetching via http
     ENABLE_CURSES=ON           - Build with (n)curses; Enables a server side terminal (command line option: --terminal)
     ENABLE_GETTEXT=ON          - Build with Gettext; Allows using translations
-    ENABLE_GLES=OFF            - Enable extra support code for OpenGL ES (requires support by IrrlichtMt)
     ENABLE_LEVELDB=ON          - Build with LevelDB; Enables use of LevelDB map backend
     ENABLE_POSTGRESQL=ON       - Build with libpq; Enables use of PostgreSQL map backend (PostgreSQL 9.5 or greater recommended)
     ENABLE_REDIS=ON            - Build with libhiredis; Enables use of Redis map backend
index b2a8b3d6a00935292b4521f0593fdea3826f693d..474dbd50c314da98843ec479d8a6103324392862 100644 (file)
@@ -103,7 +103,6 @@ LOCAL_MODULE := Minetest
 LOCAL_CFLAGS += \
        -DJSONCPP_NO_LOCALE_SUPPORT     \
        -DHAVE_TOUCHSCREENGUI           \
-       -DENABLE_GLES=1                 \
        -DUSE_CURL=1                    \
        -DUSE_SOUND=1                   \
        -DUSE_LEVELDB=0                 \
index 9d4de64d9c57154cea0e0abd80e6f087a175071c..58168fa255c2353d4cfb89a73b2d895a81335e91 100644 (file)
@@ -230,12 +230,6 @@ fall_bobbing_amount (Fall bobbing factor) float 0.03 0.0 100.0
 
 [**Camera]
 
-#   Camera 'near clipping plane' distance in nodes, between 0 and 0.25
-#   Only works on GLES platforms. Most users will not need to change this.
-#   Increasing can reduce artifacting on weaker GPUs.
-#   0.1 = Default, 0.25 = Good value for weaker tablets.
-near_plane (Near plane) float 0.1 0 0.25
-
 #    Field of view in degrees.
 fov (Field of view) int 72 45 160
 
index afe0083951d2ac6836dab5ffffd5307c019db4f4..a00690b2867a85f450b8ea8cd214f51d80741aa3 100644 (file)
@@ -109,10 +109,6 @@ if(BUILD_CLIENT AND ENABLE_SOUND)
        endif()
 endif()
 
-# TODO: this should be removed one day, we can enable it unconditionally
-option(ENABLE_GLES "Enable extra support code for OpenGL ES" FALSE)
-mark_as_advanced(ENABLE_GLES)
-
 option(ENABLE_TOUCH "Enable Touchscreen support" FALSE)
 if(ENABLE_TOUCH)
        add_definitions(-DHAVE_TOUCHSCREENGUI)
index 13ca7aa5c42743c7458017ef98d930f24544aad4..dce94495b83add48abb7cdc21a7358e47840796b 100644 (file)
@@ -599,13 +599,7 @@ void Camera::updateViewingRange()
 {
        f32 viewing_range = g_settings->getFloat("viewing_range");
 
-       // Ignore near_plane setting on all other platforms to prevent abuse
-#if ENABLE_GLES
-       m_cameranode->setNearValue(rangelim(
-               g_settings->getFloat("near_plane"), 0.0f, 0.25f) * BS);
-#else
        m_cameranode->setNearValue(0.1f * BS);
-#endif
 
        m_draw_control.wanted_range = std::fmin(adjustDist(viewing_range, getFovMax()), 4000);
        if (m_draw_control.range_all) {
index 42508259f17ac7ada38ea2624472bcf1a5a5a7b9..fda525e3f20535e8e37beeb9eb7c49b8236326f6 100644 (file)
@@ -119,7 +119,6 @@ video::ITexture *guiScalingResizeCached(video::IVideoDriver *driver,
                        (u32)destrect.getHeight()));
        imageScaleNNAA(srcimg, srcrect, destimg);
 
-#if ENABLE_GLES
        // Some platforms are picky about textures being powers of 2, so expand
        // the image dimensions to the next power of 2, if necessary.
        if (!driver->queryFeature(video::EVDF_TEXTURE_NPOT)) {
@@ -131,7 +130,6 @@ video::ITexture *guiScalingResizeCached(video::IVideoDriver *driver,
                destimg->drop();
                destimg = po2img;
        }
-#endif
 
        // Convert the scaled image back into a texture.
        scaled = driver->addTexture(scalename, destimg);
index 1392b55670ebb6f7de8bc4b89a97c9ff38763d39..74151423f09b0e51d67aff269faf71ea96130602 100644 (file)
@@ -34,6 +34,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "render/factory.h"
 #include "inputhandler.h"
 #include "gettext.h"
+#include "filesys.h"
 #include "../gui/guiSkin.h"
 
 #if !defined(_WIN32) && !defined(__APPLE__) && !defined(__ANDROID__) && \
@@ -51,10 +52,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include <winuser.h>
 #endif
 
-#if ENABLE_GLES
-#include "filesys.h"
-#endif
-
 RenderingEngine *RenderingEngine::s_singleton = nullptr;
 const float RenderingEngine::BASE_BLOOM_STRENGTH = 1.0f;
 
@@ -136,12 +133,10 @@ RenderingEngine::RenderingEngine(IEventReceiver *receiver)
 #ifdef __ANDROID__
        params.PrivateData = porting::app_global;
 #endif
-#if ENABLE_GLES
        // there is no standardized path for these on desktop
        std::string rel_path = std::string("client") + DIR_DELIM
                        + "shaders" + DIR_DELIM + "Irrlicht";
        params.OGLES2ShaderPath = (porting::path_share + DIR_DELIM + rel_path + DIR_DELIM).c_str();
-#endif
 
        m_device = createDeviceEx(params);
        driver = m_device->getVideoDriver();
@@ -289,10 +284,8 @@ static bool getWindowHandle(irr::video::IVideoDriver *driver, HWND &hWnd)
        const video::SExposedVideoData exposedData = driver->getExposedVideoData();
 
        switch (driver->getDriverType()) {
-#if ENABLE_GLES
        case video::EDT_OGLES1:
        case video::EDT_OGLES2:
-#endif
        case video::EDT_OPENGL:
                hWnd = reinterpret_cast<HWND>(exposedData.OpenGLWin32.HWnd);
                break;
index ccecb22c3a72432aa198d9795e87bb62db05f09a..ce662b41d582ca7bfe4e6038b9bde678cc235b61 100644 (file)
@@ -229,14 +229,12 @@ class MainShaderConstantSetter : public IShaderConstantSetter
        CachedVertexShaderSetting<f32> m_perspective_zbias_vertex;
        CachedPixelShaderSetting<f32> m_perspective_zbias_pixel;
 
-#if ENABLE_GLES
        // Modelview matrix
        CachedVertexShaderSetting<float, 16> m_world_view;
        // Texture matrix
        CachedVertexShaderSetting<float, 16> m_texture;
        // Normal matrix
        CachedVertexShaderSetting<float, 9> m_normal;
-#endif
 
 public:
        MainShaderConstantSetter() :
@@ -256,11 +254,9 @@ class MainShaderConstantSetter : public IShaderConstantSetter
                , m_perspective_bias1_pixel("xyPerspectiveBias1")
                , m_perspective_zbias_vertex("zPerspectiveBias")
                , m_perspective_zbias_pixel("zPerspectiveBias")
-#if ENABLE_GLES
                , m_world_view("mWorldView")
                , m_texture("mTexture")
                , m_normal("mNormal")
-#endif
        {}
        ~MainShaderConstantSetter() = default;
 
@@ -283,21 +279,21 @@ class MainShaderConstantSetter : public IShaderConstantSetter
                worldViewProj *= worldView;
                m_world_view_proj.set(*reinterpret_cast<float(*)[16]>(worldViewProj.pointer()), services);
 
-#if ENABLE_GLES
-               core::matrix4 texture = driver->getTransform(video::ETS_TEXTURE_0);
-               m_world_view.set(*reinterpret_cast<float(*)[16]>(worldView.pointer()), services);
-               m_texture.set(*reinterpret_cast<float(*)[16]>(texture.pointer()), services);
-
-               core::matrix4 normal;
-               worldView.getTransposed(normal);
-               sanity_check(normal.makeInverse());
-               float m[9] = {
-                       normal[0], normal[1], normal[2],
-                       normal[4], normal[5], normal[6],
-                       normal[8], normal[9], normal[10],
-               };
-               m_normal.set(m, services);
-#endif
+               if (driver->getDriverType() == video::EDT_OGLES2) {
+                       core::matrix4 texture = driver->getTransform(video::ETS_TEXTURE_0);
+                       m_world_view.set(*reinterpret_cast<float(*)[16]>(worldView.pointer()), services);
+                       m_texture.set(*reinterpret_cast<float(*)[16]>(texture.pointer()), services);
+
+                       core::matrix4 normal;
+                       worldView.getTransposed(normal);
+                       sanity_check(normal.makeInverse());
+                       float m[9] = {
+                               normal[0], normal[1], normal[2],
+                               normal[4], normal[5], normal[6],
+                               normal[8], normal[9], normal[10],
+                       };
+                       m_normal.set(m, services);
+               }
 
                // Set uniforms for Shadow shader
                if (ShadowRenderer *shadow = RenderingEngine::get_shadow_renderer()) {
@@ -628,10 +624,7 @@ ShaderInfo ShaderSource::generateShader(const std::string &name,
        video::IGPUProgrammingServices *gpu = driver->getGPUProgrammingServices();
 
        // Create shaders header
-       bool use_gles = false;
-#if ENABLE_GLES
-       use_gles = driver->getDriverType() == video::EDT_OGLES2;
-#endif
+       bool use_gles = driver->getDriverType() == video::EDT_OGLES2;
        std::stringstream shaders_header;
        shaders_header
                << std::noboolalpha
index 14fc316e7e69fa8e1213f1816640252a5b5b1b87..8421465c4c2908f2b2bc91eb29b55ab3041c4739 100644 (file)
@@ -21,6 +21,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 
 #include <algorithm>
 #include <ICameraSceneNode.h>
+#include <IVideoDriver.h>
 #include "util/string.h"
 #include "util/container.h"
 #include "util/thread.h"
@@ -617,9 +618,7 @@ u32 TextureSource::generateTexture(const std::string &name)
        video::ITexture *tex = NULL;
 
        if (img != NULL) {
-#if ENABLE_GLES
                img = Align2Npot2(img, driver);
-#endif
                // Create texture from resulting image
                tex = driver->addTexture(name.c_str(), img);
                guiScalingCache(io::path(name.c_str()), driver, img);
@@ -819,9 +818,7 @@ void TextureSource::rebuildTexture(video::IVideoDriver *driver, TextureInfo &ti)
        // shouldn't really need to be done, but can't hurt
        std::set<std::string> source_image_names;
        video::IImage *img = generateImage(ti.name, source_image_names);
-#if ENABLE_GLES
        img = Align2Npot2(img, driver);
-#endif
        // Create texture from resulting image
        video::ITexture *t = NULL;
        if (img) {
@@ -1055,8 +1052,6 @@ video::IImage* TextureSource::generateImage(const std::string &name, std::set<st
        return baseimg;
 }
 
-#if ENABLE_GLES
-
 /**
  * Check and align image to npot2 if required by hardware
  * @param image image to check for npot2 alignment
@@ -1094,8 +1089,6 @@ video::IImage *Align2Npot2(video::IImage *image,
        return targetimage;
 }
 
-#endif
-
 static std::string unescape_string(const std::string &str, const char esc = '\\')
 {
        std::string out;
index c60418d12d4e4b204b8a7afc971068fb56ba65b5..0597d093e95ef6dd13a7aa24bd39b68877ba3b86 100644 (file)
@@ -28,14 +28,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "util/numeric.h"
 #include "config.h"
 
-#if ENABLE_GLES
-#include <IVideoDriver.h>
-#endif
-
 class IGameDef;
 struct TileSpec;
 struct TileDef;
 
+namespace irr { namespace video { class IVideoDriver; } }
+
 typedef std::vector<video::SColor> Palette;
 
 /*
@@ -133,9 +131,7 @@ class IWritableTextureSource : public ITextureSource
 
 IWritableTextureSource *createTextureSource();
 
-#if ENABLE_GLES
 video::IImage *Align2Npot2(video::IImage *image, video::IVideoDriver *driver);
-#endif
 
 enum MaterialType{
        TILE_MATERIAL_BASIC,
index 17b70e2680a9bbf2856c0be5f8af4b0e3a6f0b4f..19fb6d4a12d7aaf77317893927bbd33ebacb1198 100644 (file)
@@ -28,7 +28,6 @@
 #cmakedefine01 USE_SPATIAL
 #cmakedefine01 USE_SYSTEM_GMP
 #cmakedefine01 USE_REDIS
-#cmakedefine01 ENABLE_GLES
 #cmakedefine01 HAVE_ENDIAN_H
 #cmakedefine01 CURSES_HAVE_CURSES_H
 #cmakedefine01 CURSES_HAVE_NCURSES_H
index ed9363a722141a55d06b4e3d881751880cca1159..f7a32ee2e2a3602f8eb6e533c2f5095c1a63842e 100644 (file)
@@ -186,9 +186,6 @@ void set_default_settings()
        settings->setDefault("fps_max_unfocused", "20");
        settings->setDefault("viewing_range", "190");
        settings->setDefault("client_mesh_chunk", "1");
-#if ENABLE_GLES
-       settings->setDefault("near_plane", "0.1");
-#endif
        settings->setDefault("screen_w", "1024");
        settings->setDefault("screen_h", "600");
        settings->setDefault("autosave_screensize", "true");
index 54157c79276baaba95c12f60d5cb68768542b525..941ebe75470e5739479ec89377f6eee9168b631c 100644 (file)
@@ -38,10 +38,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "client/fontengine.h"
 #include "client/guiscalingfilter.h"
 #include "irrlicht_changes/static_text.h"
-
-#if ENABLE_GLES
 #include "client/tile.h"
-#endif
 
 
 /******************************************************************************/
@@ -59,11 +56,15 @@ void TextDestGuiEngine::gotText(const std::wstring &text)
 /******************************************************************************/
 MenuTextureSource::~MenuTextureSource()
 {
-       for (const std::string &texture_to_delete : m_to_delete) {
-               const char *tname = texture_to_delete.c_str();
-               video::ITexture *texture = m_driver->getTexture(tname);
-               m_driver->removeTexture(texture);
+       u32 before = m_driver->getTextureCount();
+
+       for (const auto &it: m_to_delete) {
+               m_driver->removeTexture(it);
        }
+       m_to_delete.clear();
+
+       infostream << "~MenuTextureSource() before cleanup: "<< before
+                       << " after: " << m_driver->getTextureCount() << std::endl;
 }
 
 /******************************************************************************/
@@ -75,7 +76,7 @@ video::ITexture *MenuTextureSource::getTexture(const std::string &name, u32 *id)
        if (name.empty())
                return NULL;
 
-#if ENABLE_GLES
+       // return if already loaded
        video::ITexture *retval = m_driver->findTexture(name.c_str());
        if (retval)
                return retval;
@@ -86,12 +87,11 @@ video::ITexture *MenuTextureSource::getTexture(const std::string &name, u32 *id)
 
        image = Align2Npot2(image, m_driver);
        retval = m_driver->addTexture(name.c_str(), image);
-       m_to_delete.insert(name);
        image->drop();
+
+       if (retval)
+               m_to_delete.push_back(retval);
        return retval;
-#else
-       return m_driver->getTexture(name.c_str());
-#endif
 }
 
 /******************************************************************************/
index 2f182ca810f051bd07ff7e4200b037dae897d53b..a95bb3085acf987e7963d29a556dca81d5d053b1 100644 (file)
@@ -111,8 +111,8 @@ class MenuTextureSource : public ISimpleTextureSource
 private:
        /** driver to get textures from */
        video::IVideoDriver *m_driver = nullptr;
-       /** set of texture names to delete */
-       std::set<std::string> m_to_delete;
+       /** set of textures to delete */
+       std::vector<video::ITexture*> m_to_delete;
 };
 
 /** GUIEngine specific implementation of OnDemandSoundFetcher */