Jump to content
  • Advertisement
Sign in to follow this  
Quat

DX11 UpdateSubresource

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

I noticed the Effects11 library uses UpdateSubresource to update constant buffers:


D3DX11INLINE void CheckAndUpdateCB_FX(ID3D11DeviceContext *pContext, SConstantBuffer *pCB)
{
if (pCB->IsDirty && !pCB->IsNonUpdatable)
{
// CB out of date; rebuild it
pContext->UpdateSubresource(pCB->pD3DObject, 0, NULL, pCB->pBackingStore, pCB->Size, pCB->Size);
pCB->IsDirty = FALSE;
}
}


My question is: Is it better to use UpdateSubresource, or to make the constant buffer dynamic and Map it?

Share this post


Link to post
Share on other sites
Advertisement
I have always used the mapping technique, but haven't heard anything about which is faster. My guess is that they would be equivalent, but it is just a guess...

I also seem to recall that there is potential issues with UpdateSubresource on a deferred context (check out the blog from Chuck Walbourn for details).

Share this post


Link to post
Share on other sites

I also seem to recall that there is potential issues with UpdateSubresource on a deferred context (check out the blog from Chuck Walbourn for details).

I believe that the issue you are referring to only happens when pDestBox parameter is used, so, since when updating shader-constant buffers pDestBox parameter must be NULL I don't think that this issue applies.

Also, as you can see on DirectX 11 documentation of the UpdateSubresource method there is source code to workaround that issue.

Anyway, I also use Map to update constant buffers, but if you want to know which is faster you can always try both methods and see which is faster, and post the results here.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!