The following two points with MSDN seem to suggest that this stream is not only unsafe, but also shortened when the HDC is outstanding.
You must free the device (they are HDC related) and call the IDXGISurface1 :: ReleaseDC method before you make any new Direct3D commands.
This method fails if an excellent DC has already been created using this method.
Getting HDC from DXGISurface inherently includes a superficial parent D3D11 DC. Multi-threaded access to the DC D3D11 is also not supported. From this MSDN page: if multiple threads must access the same ID3D11DeviceContext, they must use some kind of synchronization mechanism, such as critical sections, to synchronize access to this ID3D11DeviceContext.
I would try to prepare a GDI drawing on a separate thread, as you said, but put it in the system memory buffer. Then simply rinse the contents onto the surface of the DXGI.
Also note that most of these topics are related to immediate context behavior, D3D11 Delayed context may have different behavior.
Unknown1987
source share