title: What are the best practices for multithreading with Direct2D & DXGI (D3D interop)?
body: <p>Ideally I'd like to have multiple worker threads to be able to render to off-screen render targets and then 'transfer' the rendered content to the on-screen target. With hwnd render targets this does not seem to be a problem (msdn has an example of it).</p>
  
  <p>I'm not quite sure how to do it when the on-screen render target is based on DXGI swap chain.  As far as I know, I can only have one swap chain per window. Therefore I can only have a single render target based on the swap chain.  This implies that on-screen rendering can only be done through that single render target.</p>
  
  <p>If my above assumptions are correct, what is the best way to handle the multi-threaded rendering?  Do I need to serialize access to the on-screen target? Should worker threads share a single multi-threaded d2d factory? Can on-screen target's BeginDraw/EndDraw/Present be executed on worker threads (i.e. threads that did not create the on-screen target) if a proper locking mechanism is in place?</p>
  
  <p>I'd appreciate <em>any</em> suggestions.
  Thanks.</p>