Jump to content
  • Advertisement
Sign in to follow this  
BrentMorris

DX11 GPU to CPU stalling questions in DX11.

This topic is 2163 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

When it comes to GPU->CPU read back in DX11, what is the main concern with stalling? If work gets finished and the results are copied over to a staging buffer that you read from, what is the main cause of stalling aside from the transfer latency?

 

I want to generate 2D/3D noise on the GPU and copy it back to the CPU for usage in the middle of a game loop, but I'm not sure what measures I should be taking to reduce stalling. Do I just have to wait some amount of time until I'm sure the work is done? Is there a callback function or some other means of telling that the data is ready to be read?

Share this post


Link to post
Share on other sites
Advertisement

The main issue is that the GPU runs behind the CPU. The CPU will generate command buffers, and then the GPU won't execute them until a later point. In cases where you're GPU-bound, the CPU can even get multiple frames ahead of the GPU. When you try to read back GPU data on the CPU, the CPU has to flush all pending command buffers and sit around and wait for the GPU to finish. Then after the data is available, the GPU has to sit around and wait for the CPU to buffer enough commands for the GPU to start executing again.

Share this post


Link to post
Share on other sites

Is it safe to trust that a result is done after 2 presents from the time that the work is issued, as tonemgub's link suggests?

 

 

The GPU has to sit around and wait for the CPU to buffer enough commands for the GPU to start executing again.

 

 

Can this be mitigated by having a deferred context command list ready to be queued up after the read is completed?

Share this post


Link to post
Share on other sites


Is it safe to trust that a result is done after 2 presents from the time that the work is issued, as tonemgub's link suggests?

 

In general, yes. You shouldn't have any stalls if you can defer 1 or 2 frames.

[/quote]


Can this be mitigated by having a deferred context command list ready to be queued up after the read is completed?


Possibly, but it depends a lot on the driver and how it handles deferred command lists. Typically the driver still needs to do a lot of work to convert a deferred command list to an actual command buffer that the GPU can consume, so I'm not sure how much it would help.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!