Operating System: Windows 10
Render System: DirectX 11
I have 913 DDS DXT1 textures, totalling 215mb. Loading this all on startup currently takes around 30s on a somewhat fast PC, more on a slower PC, so I would like to bring that down and have better loading times. So I'm wondering: what's the fastest way of loading large numbers of textures in bulk on startup?
My current way to force Ogre to really load the textures into video memory (instead of just declaring the resource and not loading it until it's actually used, which causes hickups while playing) is roughly like this:
Code: Select all
// Create resourceGroup
auto& rGM = Ogre::ResourceGroupManager::getSingleton();
rGM.createResourceGroup(groupName, true);
rGM.addResourceLocation(folder, "FileSystem", groupName);
rGM.initialiseResourceGroup(groupName);
rGM.loadResourceGroup(groupName);
// Force Ogre to fully load each texture by temporarily applying it to an actual material
auto& tempMaterial = static_cast<Ogre::MaterialPtr>(Ogre::MaterialManager::getSingleton().getByName(materialName))
auto textureUnitState = tempMaterial->getTechnique(0)->getPass(0)->getTextureUnitState(0);
std::vector<std::string> files = Tools::listDirectory(textureFolder, "");
for (const auto& fileName : files)
textureUnitState->setTextureName(fileName);
Also, I tried running a profiler (on the non-ZIP version) and it turns out 42% of the time was spent in Ogre::PixelUtil::packColour. I had a look at the Ogre source and I think this means that Ogre is actually unpacking the DDS files instead of loading them in bulk. That wastes a lot of memory and a lot of loading time, how can I make Ogre actually use the DDS format internally? Is that maybe because my DDS files don't have mipmaps stored?
Based on experiences with Blightbound and Awesomenauts in our own engine I know such amounts can be loaded much faster than this, so I'm guessing I'm just not doing it the right way for Ogre. I'm guessing I need two things:
- Make Ogre load all textures from an archive (compressed or not) in order, for maximum disk access speed
- Make Ogre use DDS as DDS internally instead of unpacking it to uncompressed