1

How can we convert ID3D11Texture2D into a memory buffer? I have ID3D11Texture2D* and need to read data from it to a memory buffer.

1 Answer 1

3

You need to create a second texture with the same format/size, but create it as staging.

Texture description

Cpu access flags needs to be set to D3D11_CPU_ACCESS_READ and usage needs to be set to D3D11_USAGE_STAGING.

Then you can call ID3D11DeviceContext::CopyResource to copy from the texture to the staging one.

And then you call Map to access data.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.