diff --git a/src/race/race_manager.cpp b/src/race/race_manager.cpp index 32c7fd9bf..3e3b3f908 100644 --- a/src/race/race_manager.cpp +++ b/src/race/race_manager.cpp @@ -1031,6 +1031,8 @@ void RaceManager::exitRace(bool delete_world) World::deleteWorld(); } + // Reload track screenshot after delete_world (track textures are unloaded) + track_manager->onDemandLoadTrackScreenshots(); m_saved_gp = NULL; m_track_number = 0; diff --git a/src/tracks/track.cpp b/src/tracks/track.cpp index 7d96a8307..ed09bac38 100644 --- a/src/tracks/track.cpp +++ b/src/tracks/track.cpp @@ -190,6 +190,11 @@ Track::Track(const std::string &filename) /** Destructor, removes quad data structures etc. */ Track::~Track() { +#ifndef SERVER_ONLY + if (GE::getDriver()->getDriverType() == video::EDT_VULKAN) + GE::getGEConfig()->m_ondemand_load_texture_paths.erase(m_screenshot); +#endif + // Note that the music information in m_music is globally managed // by the music_manager, and is freed there. So no need to free it // here (esp. since various track might share the same music). @@ -614,6 +619,14 @@ void Track::loadTrackInfo() if (m_screenshot.length() > 0) { m_screenshot = m_root+m_screenshot; +#ifndef SERVER_ONLY + if (GE::getDriver()->getDriverType() == video::EDT_VULKAN) + { + m_screenshot = file_manager->getFileSystem() + ->getAbsolutePath(m_screenshot.c_str()).c_str(); + GE::getGEConfig()->m_ondemand_load_texture_paths.insert(m_screenshot); + } +#endif } delete root; diff --git a/src/tracks/track_manager.cpp b/src/tracks/track_manager.cpp index 47310d1d1..b5835c10c 100644 --- a/src/tracks/track_manager.cpp +++ b/src/tracks/track_manager.cpp @@ -175,6 +175,7 @@ void TrackManager::loadTrackList() loadTrack(dir+*subdir+"/"); } // for dir in dirs } // for i getVideoDriver()->getDriverType() != video::EDT_VULKAN) + return; + for (unsigned i = 0; i < m_tracks.size(); i++) + { + if (m_tracks[i]->isInternal()) + continue; + irr::video::ITexture* screenshot = irr_driver->getTexture( + m_tracks[i]->getScreenshotFile()); + if (screenshot && screenshot->useOnDemandLoad()) + screenshot->getTextureHandler(); + } +} // onDemandLoadTrackScreenshots diff --git a/src/tracks/track_manager.hpp b/src/tracks/track_manager.hpp index fe2f7de28..524907e39 100644 --- a/src/tracks/track_manager.hpp +++ b/src/tracks/track_manager.hpp @@ -136,6 +136,8 @@ public: { return soccer_arena ? m_soccer_arena_groups[g] : m_arena_groups[g]; } // getArenasInGroup + // ------------------------------------------------------------------------ + void onDemandLoadTrackScreenshots(); }; // TrackManager