Search code examples
c++texturesdirect3ddirect3d11

CopyResource from one D3D11 device to another


I can copy the content from a D3D11 texture to another one with ID3D11DeviceContext::CopyResource. The method belongs to the immediate context of a specific device, so I cannot copy a texture from one device to another one (I have tried it - it explodes as expected saying

"D3D11 CORRUPTION: ID3D11DeviceContext::CopyResource: First parameter does not match device. [ MISCELLANEOUS CORRUPTION #13: CORRUPTED_PARAMETER1]"

).

Is there any D3D11 built-in means for doing this or must I download the data via a staging texture and upload it to the other device?


Solution

  • To copy a resource from one device to another, you need to use DXGI Shared Surfaces. See Surface Sharing Between Windows Graphics APIs.

    Remember that in the general case, the devices may not have any physical memory or hardware in common.