UpdateSubresource & Constant Buffer Perfomance

Started by
0 comments, last by DwarvesH 10 years, 1 month ago

Hello,

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.

DirectX 11, C++

Advertisement

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

This topic is closed to new replies.

Advertisement