Jump to content

View more

Image of the Day

The night is still, but the invasion brings chaos. #screenshotsaturday #hanako #indiegame #gameart #ue4 #samurai https://t.co/cgILXuokoS
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

IDirect3DVertexBuffer9::Lock and Threads

4: Adsense

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   

1468
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?



#2 RealNoname   Members   

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   Members   

3586
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.