Skip to main content
GameDev.net gamedev.net
🔒 Locked

Streaming Texture Data from Disc

Started by Funkymunky Mar 26, 2011 at 3:41 AM 0 replies 1k views
Original Post
Funkymunky
Funkymunky
So I've been thinking... if i have a separate thread that handles the loading of textures, allowing me to stream texture data in as needed... would it be less of a performance hit to only load a single line of the texture at a time, rather than just telling the thread to read the entire texture at once? As in, I could leave the file pointer open and meter out the reading of the file over a number of seconds. Or is it better to just have the thread read the entire file chunk that I need at once, trusting that my main thread which handles the rendering will not suffer any performance hits as a result?
Ohforf sake
Ohforf sake
IMO, you should always read it all at once.

While you are reading from file, the thread gets IO suspended by the OS so (apart from the OS parsing the filesystem and interacting with the hardware) there should be no CPU overhead as long as you have DMA enabled (which you seriously should have).
In other words, reading from file in one thread should have no effect on the other threads and splitting the file reads will only increase the OS overhead.

Even worse, if you seek to maximize the disk performance (rather than CPU performance) then you should prevent reading multiple files in parallel or interleaved at any cost, and reading texture rows from multiple files in an interleaved fashion will be pretty close to worst case.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.