Jump to content
  • Advertisement
Sign in to follow this  
Shnoutz

DX11 DX11 : deferred context and flush.

This topic is 1859 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 am trying out DirectX 11 deferred context and I see some "strange" behaviors... It's probably just that I missed something in the doc but I would like some clarification.

 

The test is as simple as it can be...

 

- On the immediate context, I fill a part of a staging buffer with some data (using Map/Unmap)

- I create a deferred context

- I use the deferred context to copy the data from the staging buffer to some other part of a default buffer.

- Again using the deferred context, I copy a part of the default buffer back to the staging buffer.

- I use FinishCommandList on the deferred context and grab the command list pointer

- I run the command list on the immediate context using ExecuteCommandList.

- On the immediate context, I map the staging buffer to check the results.

 

This seemed to be a way to go to copy some data to the gpu, run some gpu functions and copy back the result to cpu...

 

BUT... The first time I ran this it didnt work, the content of the staging buffer was not updated after ExecuteCommandList. I had to call Flush on the immediate context after ExecuteCommandList and before mapping the staging buffer for the second time and checking the result...

 

The thing that I find strange is that if I put more commands in the deferred context (a few more copysubresource) I don't have to call Flush to get the proper result...

 

Is this a driver specific thing or there is a rule to when its needed to call Flush or not?

 

Thanks,

 

Shnoutz.

 

P.s.: I know creating deferred context for very small command list is bad for performance, I am not concerned about this.

Share this post


Link to post
Share on other sites
Advertisement

looks like a scheduling issue.

you expecting all the commands from the deferred context to be completed by the time you map the staging buffer (on the immediate context).

The commands are probably queued-up but not executed yet (the flush make sure they are processed) when you map the staging buffer.

 

You should use queries to check if the GPU is done processing the commands in the deferred context.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!