Forums
Asynchronous texture, model loading - Printable Version

+- Forums (https://www.vdrift.net/Forum)
+-- Forum: Project (https://www.vdrift.net/Forum/forumdisplay.php?fid=4)
+--- Forum: Development (https://www.vdrift.net/Forum/forumdisplay.php?fid=9)
+--- Thread: Asynchronous texture, model loading (/showthread.php?tid=1506)



Asynchronous texture, model loading - NaN - 06-02-2011

@joevenzon:
I'd like to run the track loader in a separate thread. The model and texture loaders are emitting opengl calls. This means I need a separate context for the loader next to the main drawing context. Any ideas, suggestions where to plug the implementation into(track loader, graphics)?


- NaN - 06-02-2011

And for threading in general. Should we use sdl_thread or pick boost::thread. Do you have any preferences?


- joevenzon - 06-06-2011

I like thread pools where you can send a self-contained task to a pool of worker threads and it automatically gets scheduled and executed. Does boost do that? I know OpenTBB does, but that's pretty heavy-weight.

I think we should strip the OpenGL calls out of the loader and just do the rest of the work (which is hopefully the heavy lifting) in the separate thread and then have the main thread do the OpenGL calls (with some kind of rate limit). Hopefully, the loader code is mostly free of side-effects once the OpenGL stuff is stripped out.

Why do you want to make the track loader run in a separate thread? I don't think it will speed up the loading, unless you run multiple loader threads and divide up the work. Is that your plan?


- NaN - 06-06-2011

No thread pools in boost. Looks like there is an implementation on sourceforge http://threadpool.sourceforge.net/. Not sure how usable it is.

Moving the OpenGL calls should work. This means GRAPHICS_INTERFACE would have AddBufferObject(...), AddTexture(..)?

I'd like to experiment with track object streaming.


- NaN - 06-06-2011

We can use asio. Would be a candidate for the network implementation too: http://think-async.com/Asio/Recipes?skin=clean.nat%2casio%2cpattern#A_thread_pool_for_executing_arbi


- joevenzon - 06-07-2011

Awesome, I like ASIO, I didn't realize it could do that.

I think the GRAPHICS_INTERFACE is the right place to put those functions.

Streaming would be really cool. We have some big tracks!