I created a ID3D11Texture2D texture on a thread with DirectX graphics and I passed its pointer to a worker thread. I'm assured that the creator thread will no longer reference nor use the texture. I now need the worker thread to copy the resource


What's the correct way of doing this in the worker thread?

In other frameworks like CUDA or OpenGL I would just push/restore the creator thread's context into the worker thread, but I'm not sure if that applies in DirectX.


Methods on the DirectX 11 Device are thread-safe, but methods on the DirectX 11 DeviceContext are not.

In other words, the application must manage the thread-safety when sharing the immediate context between threads.

See MSDN: Introduction to Multithreading in Direct3D 11

  • \$\begingroup\$ Would creating a shared handle to the resource underlying that texture work? i.e. CreateSharedHandle and pass that handle to the other thread with another context of its own \$\endgroup\$ – user3834459 May 15 '18 at 8:31
  • \$\begingroup\$ There's no automatic synchronization of shared handles either. Your application has to ensure the thread-safety directly. \$\endgroup\$ – Chuck Walbourn May 16 '18 at 5:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.