Advertisement Jump to content
Sign in to follow this  

UpdateSubresource & Constant Buffer Perfomance

This topic is 1777 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 have a question about updaing contant buffer performance.

I would like to know how it works when I bind a constant buffer to let's say all shaders. ( it's VS, HS, DS, GS, PS, CS ).


Let's say, I will upload some per frame data and I am curious what steps it will do if I call UpdateSubresource function.


Microsoft says that UpdateSubresource does two copies. First copy goes to temporary storage and it's copied by CPU and second copy goes to non mappable memory and it's copied async by GPU. If I bind contant buffers to more shaders, does it mean, it will copy it multiple times for every shader ?


thank you very much.


Share this post

Link to post
Share on other sites

From what I read, you should use Map/Unmap with constant buffers.


And you should use multiple constant buffers, sorted by update frequency. You could have one buffer with view * projection matrix, camera position, SH and other stuff that doesn't change during a frame. Then on for things that change, but not that often, like material properties. Any decent engine will group your object when rendering by some common property, and material could be it. Then there is a buffer for per object constants, like the world matrix, relative light positions, etc...

Share this post

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

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. 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!