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?
P.s.: I know creating deferred context for very small command list is bad for performance, I am not concerned about this.