Sign in to follow this  

Computations with DirectCompute. How to get data back?

This topic is 821 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello,

 

I'm trying to use my gpu for computations only (I don't even create a swap chain). But I'm not sure how to retrieve a data after shader do it's job. I want to modify the same data I passed. For this I'm using single structured buffer binded as D3D11_BIND_UNORDERED_ACCESS.

 

As far as I know I need to use D3D11_CPU_ACCESS_READ together with D3D11_USAGE_STAGING. But in this case I have an error:

A D3D11_USAGE_STAGING Resource cannot be bound to any parts of the graphics pipeline, so therefore cannot have any BindFlags bits set.

My next approach was to create a structured unordered buffer with D3D11_USAGE_DEFAULT usage. I applied calculations on it, next I called 

ID3D11DeviceContext::CopyResource()

to copy this buffer to the one with D3D11_CPU_ACCESS_READ and finally read the data. But I'm not sure this is a correct way - I don't like this extra copying between resources.

Share this post


Link to post
Share on other sites

This topic is 821 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this