Reputation: 6958
As the title says: do I need to use CreateSharedHandle
to pass a ID3D11Texture2D
generated in a thread to another thread in the same process?
My use case is that each thread would use the texture with its own device created on the same adapter.
Upvotes: 1
Views: 1325
Reputation: 69706
Quoting Surface Sharing Between Windows Graphics APIs:
Synchronized shared surfaces enable multi-threaded, in-process and out-of-process usage of multiple rendering devices used by Direct3D 10.1, Direct2D and Direct3D 11 APIs. [...]
DXGI 1.1 Synchronized Shared Surfaces
Direct3D 11, Direct3D 10.1 and Direct2D APIs all use DXGI 1.1, which provides the functionality to synchronize reading from and writing to the same video memory surface (DXGISurface1) by two or more Direct3D devices. The rendering devices using synchronized shared surfaces can be Direct3D 10.1 or Direct3D 11 devices, each running in the same process or cross-processes.
Your use of synchronized surfaces/textures enable you to use them in a multi-threaded concurrent execution environment. However, you don't have to enable this mechanism just use a texture on another thread. You have to do it for another reason though:
...each thread would use the texture with its own device created on the same adapter.
Textures belong to their devices so you have to enable sharing in order to have multiple devices working with shared texture data.
Upvotes: 2