0

I've written a game engine using C++ and OpenGL, and at the start of the application, I load a couple of thousand textures with DevIL. This causes a long initial load.

I'm wondering if anyone can give me tips on optimizing these DevIL loads as they are currently the slowest part of my initialization.

The DevIL docs mention Multithreading in relation to file streams but doesn't expound upon them. So I don't understand what they entail.

I'm wondering if maybe I could start a thread every time I need to load. Then in the background when the load is finished allocate the image data as an OpenGL texture.

JHall
  • 41
  • 2
  • 6
  • 1
    Creating a thread per load will results in wasted computing resources and higher latency. Please consider using a *thread pool* with a SPMC thread-safe queue (MPMC for a multithreaded load which is quite unusual). Note that some specific formats can be decoded directly on the GPU so it can be much faster (see DXT compression which is frequent in games). Some format are known to be slow to decode like PNG for example (due to deflate). – Jérôme Richard Aug 21 '22 at 00:13
  • DXT has made a big difference already! Thanks for the response, I really appreciate it! – JHall Aug 21 '22 at 16:42

0 Answers0