我是否需要 CreateSharedHandle 将 ID3D11Texture2D 传递给另一个线程?
Do I need CreateSharedHandle to pass a ID3D11Texture2D to another thread?
正如标题所说:是否需要使用CreateSharedHandle
将一个线程中生成的ID3D11Texture2D
传递给同一进程中的另一个线程?
我的用例是每个线程将使用在同一适配器上创建的自己的设备的纹理。
引用 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.
您对 synchronized 的使用 surfaces/textures 使您能够在多线程并发执行环境中使用它们。但是,您不必启用此机制,只需在另一个线程上使用纹理即可。但是你必须这样做是出于另一个原因:
...each thread would use the texture with its own device created on the same adapter.
纹理属于它们的设备,因此您必须启用共享才能让多个设备使用共享纹理数据。
正如标题所说:是否需要使用CreateSharedHandle
将一个线程中生成的ID3D11Texture2D
传递给同一进程中的另一个线程?
我的用例是每个线程将使用在同一适配器上创建的自己的设备的纹理。
引用 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.
您对 synchronized 的使用 surfaces/textures 使您能够在多线程并发执行环境中使用它们。但是,您不必启用此机制,只需在另一个线程上使用纹理即可。但是你必须这样做是出于另一个原因:
...each thread would use the texture with its own device created on the same adapter.
纹理属于它们的设备,因此您必须启用共享才能让多个设备使用共享纹理数据。