Jump to content

  • Log In with Google      Sign In   
  • Create Account


Asynchronous IDirect3DVertexBuffer9::Lock() and memcpy


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: 1024

Like
0Likes
Like

Posted 15 January 2014 - 06:57 AM

Hello

 

I wanted to know if I can lock a resource such as a vertex buffer or a texture surface in the device memory, copy data to it asynchronously while I render a scene (without using the resources I am currently copying to obviously). When the backbuffer is presented, and the asynchronous transfer is finished and the resources are unlocked I want to draw a new scene, using the newly updated resources.

 

Much of my framerate is consumed in just updating instance buffers and huge textures containing skeletons. So I figured that instead of waiting I can draw the scene using twin resources.

 

I render from one twin while I copy to the other twin. And switch for the next frame. Is this supported in DX9 / SM3.0 and is it a good idea?

 

Cheers


Edited by Tispe, 15 January 2014 - 06:59 AM.


Sponsor:

#2 cgrant   Members   -  Reputation: 608

Like
0Likes
Like

Posted 15 January 2014 - 11:31 AM

That is most certainly possible and is possible and highly recommend for DX9/SM 3.0. The only catch is if the device wasn't created with the multhreaded flag( which I don't recommend ), the thread that created the device will have to do the locking and pass the pointer to the locked data to the loading thread. Then there is synchronization between the two which is up to you to handle like you alluded to.



#3 Tispe   Members   -  Reputation: 1024

Like
0Likes
Like

Posted 15 January 2014 - 03:20 PM

Is there any other technique besides passing the locked pointer to a worker thread to do the memcpy? I am thinking in the direction of how you can read files from disk asynchronously using an overlapped structure.

 

Is it wise to lock 1000 buffers at the same time?






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