Advertisement Jump to content
Sign in to follow this  
Tispe

Asynchronous IDirect3DVertexBuffer9::Lock() and memcpy

This topic is 1830 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

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

Share this post


Link to post
Share on other sites
Advertisement

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.

Share this post


Link to post
Share on other sites

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?

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!