How to properly copy an ID3D11Buffer to another ID3D11 buffer?

Started by
2 comments, last by NightCreature83 1 year, 9 months ago

As per title. How do you effectively copy or create an ID3D11 buffer by copying another ID3D11Buffer?

Specifically I would like to copy a Vertex Shader Constant Buffer.

Any help would be appreciated. Thank you.

None

Advertisement

You can use the ID3D11DeviceContext::CopyResource function, or do it manually with Map/memcpy.

Create the destination buffer and copy the data to it with one of the methods above.

What are you trying to achieve because map/memcpy and CopyResource work. But if you are just instancing some data and need the same working data as another object just setting that data might be better solution to begin with. The PCI-E bus transfer might incur some perfromance stalls you don't want.

Worked on titles: CMR:DiRT2, DiRT 3, DiRT: Showdown, GRID 2, theHunter, theHunter: Primal, Mad Max, Watch Dogs: Legion

This topic is closed to new replies.

Advertisement