• Advertisement
Sign in to follow this  

IDirect3DVertexBuffer9::Lock and Threads

This topic is 1670 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi

 

If I create a vertex buffer in the managed pool (or any other pool for that matter), and lock it; Can I pass the pBuffer to another thread and continue to rendering from other vertex buffers while a worker thread is writing data to pBuffer?

 

This is to minimize time spent by the main thread copying data around, and rather let a worker thread do it.

 

Or will a lock of any resource halt any further calls such as Draw and Present?

Share this post


Link to post
Share on other sites
Advertisement

As far as I know, the lock method just maps the buffer from graphic card to system memory. I didn't test it, but it shouldn't make problems to pass a simple pointer to system memory to another thread while you're rendering something else. At least not when that buffer isn't assigned to any input stream.

Share this post


Link to post
Share on other sites

That should work fine.

 

The other option, which saves keeping it locked and unusable for a long time is to have the worker threads allocate some memory and fill in the data. The main thread then checks for completed tasks once a frame and does Lock(); memcpy(); Unlock(); delete []; for each one.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement