Sign in to follow this  

[dx9] Multi-threaded mesh loading

Recommended Posts

Hi All,

Im trying to implement chuncked level scene for my 3d level where nodes are loaded on a background process, but i cannot seem to make this work because
the backgroun thread (the one that loads the mesh) cannot load the mesh using D3DXLoadMeshFromX and texture for the mesh was load using D3DXCreateTextureFromFile.

the application freeze up.

ive search all over the inter net and found suggestions from other people to use D3DCREATE_MULTITHREADED, but i also found somebody that said it does not work
with the d3dx library and its slows down the application. Some tells that loading of the texture is the main cause of the problem.

so how do I proceed with this? What is the correct way of doing this?
Is there any sample source or resource for this?


Share this post

Link to post
Share on other sites
Page the file into memory using ReadFile or what-have-you, then use D3DXCreateTextureFromMemory and friends on the main thread before you draw your scene. You'll obviously need to hand offthe data pointer, and for that I'd suggest something like Boost's circular_buffer protected by a CRITICAL_SECTION for thread safety purposes.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this