Skip to main content
GameDev.net gamedev.net
🔒 Locked

How to properly copy an ID3D11Buffer to another ID3D11 buffer?

Started by Key_C0de Aug 8, 2022 at 6:57 AM 2 replies 7k views
Original Post
Key_C0de
Key_C0de

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

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.

NightCreature83
NightCreature83

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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.