HowTo do a Paralleled model loading?

Started by
10 comments, last by Tsumuji 17 years, 5 months ago
I'm here trying to do a paralleled model loading(load a model mesh and all his data by a thread to accelerate things), to use this in a OpenGL app. There's a good way to do that? A good approach? What I've tryied here, demonstrated that I can only load pure data from model file(ms3d). When I go to generate textures for this model, I must do this in the main thread, wich is the same wich draw things on screen. So I can only do that? Nothing more?
Advertisement
I think, that will slow down the speed. Read ONE file and after it the other.
Your Harddisk head could jump between two files loosing realy a lot of time.
Agreed, only read from one thread, so you don't drive your hard drive crazy. Now if there is any processing of the file you need to do, once its been read, you might pass it off to another thread, so the first thread can continue reading from the hard drive.

"I can't believe I'm defending logic to a turing machine." - Kent Woolworth [Other Space]

ok, but what I want to avoid here is the choppy thing that hapen when heavy models are loading. See Lineage 2. Even if you have a power computer running in RAID, Lineage continues choppy, no matter what.
How avoid this so?
look a bit into the future and let a second thread(with lower priority) do the loading of the modell
yes, simply use a dedicated disk I/O thread
Quote:Original post by Karadok
I think, that will slow down the speed. Read ONE file and after it the other.
Your Harddisk head could jump between two files loosing realy a lot of time.


the "jumping between the two files" doesn´t cut off your performance at all...
you can read from 512 files or more concurrently without loosing much (i just dont want to say "anything")


it´s more the fact that multithreading does not accelerate your harddisc at all (which should be pretty obvious)... i/o-routines are blocking .. so while reading/writing on your disk, nothing happens --- to avoid this idle-time you use threading

or non non-blocking I/O, but i haven´t searched (thus found) any library (except MPI, which isn´t suited for desktop computing) beeing able to do this
Tsujumi,
I think you'll find your answer there :
http://www.gamedev.net/community/forums/topic.asp?topic_id=395910&whichpage=1?

Basically, you need 2 contexts : 1 for rendering, and 1 for loading data (and creating the Textures, VBOs, etc, on GPU). Both contexts need to be created from the main thread, and then the loaded data has to be shared between the contexts through some OS specific methods (like wglShareLists, and such).

Another great source of info : http://zppz.homelinux.net/opengl/dataSharing/

Hope that helps.
oups!! double post...
Quote:Original post by hydroo
the "jumping between the two files" doesn´t cut off your performance at all...
you can read from 512 files or more concurrently without loosing much (i just dont want to say "anything")


Certainly it does. Even fast hard-disks have an average of 8-9 ms seek time. If you're moving the head more than one cylinder at a time in either direction it incurs some penalty. 9ms may not seem like a lot, but a fairly average drive (80mb/s read) can read ~768 bytes in that time. Its much better to do disk IO serially if you can.


I agree with Rattrap though, Read from one thread, process in another (decompress, calculate normals, etc.)

throw table_exception("(? ???)? ? ???");

This topic is closed to new replies.

Advertisement