Jump to content

  • Log In with Google      Sign In   
  • Create Account

IDirect3DVertexBuffer9::Lock and Threads


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Tispe   Members   -  Reputation: 1047

Like
0Likes
Like

Posted 24 June 2013 - 01:34 AM

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?



Sponsor:

#2 RealNoname   Members   -  Reputation: 157

Like
0Likes
Like

Posted 24 June 2013 - 05:30 AM

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.



#3 Adam_42   Crossbones+   -  Reputation: 2619

Like
1Likes
Like

Posted 24 June 2013 - 04:19 PM

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.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS