From 677dc2c1558420a1d105a5f33b5c14a1d43503bb Mon Sep 17 00:00:00 2001 From: paradust7 <102263465+paradust7@users.noreply.github.com> Date: Thu, 28 Apr 2022 09:52:19 -0700 Subject: [PATCH] Remove HW_buffer_counter after IrrlichtMt fix to remove HWBufferMap (#12232) Keep code and use version check instead, for backwards compatibility --- src/client/game.cpp | 5 +++++ src/client/mapblock_mesh.cpp | 2 ++ 2 files changed, 7 insertions(+) diff --git a/src/client/game.cpp b/src/client/game.cpp index 4337d308e..9bbe36adf 100644 --- a/src/client/game.cpp +++ b/src/client/game.cpp @@ -907,7 +907,10 @@ private: bool m_does_lost_focus_pause_game = false; +#if IRRLICHT_VERSION_MT_REVISION < 5 int m_reset_HW_buffer_counter = 0; +#endif + #ifdef HAVE_TOUCHSCREENGUI bool m_cache_hold_aux1; #endif @@ -3988,6 +3991,7 @@ void Game::updateFrame(ProfilerGraph *graph, RunStats *stats, f32 dtime, /* ==================== End scene ==================== */ +#if IRRLICHT_VERSION_MT_REVISION < 5 if (++m_reset_HW_buffer_counter > 500) { /* Periodically remove all mesh HW buffers. @@ -4009,6 +4013,7 @@ void Game::updateFrame(ProfilerGraph *graph, RunStats *stats, f32 dtime, driver->removeAllHardwareBuffers(); m_reset_HW_buffer_counter = 0; } +#endif driver->endScene(); diff --git a/src/client/mapblock_mesh.cpp b/src/client/mapblock_mesh.cpp index 249a56087..e077011cc 100644 --- a/src/client/mapblock_mesh.cpp +++ b/src/client/mapblock_mesh.cpp @@ -1198,12 +1198,14 @@ MapBlockMesh::MapBlockMesh(MeshMakeData *data, v3s16 camera_offset): MapBlockMesh::~MapBlockMesh() { for (scene::IMesh *m : m_mesh) { +#if IRRLICHT_VERSION_MT_REVISION < 5 if (m_enable_vbo) { for (u32 i = 0; i < m->getMeshBufferCount(); i++) { scene::IMeshBuffer *buf = m->getMeshBuffer(i); RenderingEngine::get_video_driver()->removeHardwareBuffer(buf); } } +#endif m->drop(); } delete m_minimap_mapblock;