GPUOpen-LibrariesAndSDKs/AGS_SDK

agsDriverExtensionsDX11 and d3d11 deferred contexts

hodgman opened this issue · 3 comments

The agsDriverExtensionsDX11_* functions operate on a AGSContext, which is associated with the ID3D11Device. However, they insert commands into a ID3D11DeviceContext, of which there can be several in concurrent use. The context modified by these ags functions is not clear.
I assume that the agsDriverExtensionsDX11_* functions only affect the device's immediate context? Is it possible to use them with deferred contexts somehow as well? Is it safe to use agsDriverExtensionsDX11 in a multi-threaded, multi-context DX11 application?

The DX11 driver extension functions will not work for deferred contexts (#4). I'll make sure to mention this in the documentation.

For the AMD driver, deferred contexts don't buy you any additional performance and we recommend against using them! You are much better off multi-threading your rendering and writing each thread's output to a software command buffer which gets processed by the immediate context on the main thread.

Thanks for the clarification. So just to be clear, it should be safe to use them on the immediate context in the presence of deferred contexts though?

I currently use deferred contexts to easily offload a very sluggish bit of middleware from the rendering thread, and using the API-level command buffers seemed the best way to do that. I haven't bothered trying to emulate them, but this middleware only uses a small sub-set of possible D3D11 context functions, so it wouldn't be much work! Thanks, I'll give that a try.

Also, sorry for the duplicate issue!

Yes, that is correct.