Jump to content

Image of the Day

BL00DG0R3
#screenshotsaturday #gamedev #indiedev https://t.co/SytiLEa4G5
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net's newsletters to receive the latest updates and exclusive content.


Sign up now

DX11 : deferred context and flush.

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
1 reply to this topic

#1 Shnoutz   Members   

339
Like
0Likes
Like

Posted 20 May 2013 - 09:42 AM

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.



#2 Yourself   Members   

1880
Like
0Likes
Like

Posted 21 May 2013 - 12:21 AM

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.






Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.