Threading Differences between Direct3D Versions
Many multi-threaded programming models make use of synchronization primitives (such as mutexes) to create critical sections and prevent code from being accessed by more than one thread at a time.
However, the resource creation methods of the ID3D11Device interface were designed to be re-entrant, without requiring synchronization primitives and critical sections. As a result, the resource creation methods are efficient and easy to use.
Differences between Direct3D 11, 10 and 9: Direct3D 11 defaults to mostly thread-safe and continues to allow applications to opt-out using D3D11_CREATE_DEVICE_SINGLETHREADED. If applications opt-out of being thread-safe, they must adhere to threading rules. The runtime synchronizes threads on behalf of the application allowing concurrent threads to run. In fact, the synchronization in Direct3D 11 is more efficient than using the thread-safe layer in Direct3D 10. Direct3D 10 can support the execution of only one thread at a time. Direct3D 10 is fully thread safe and allows an application to opt-out of that behavior by using D3D10_CREATE_DEVICE_SINGLE_THREADED. Direct3D 9 does not default to thread safe. However, when you call CreateDevice or CreateDeviceEx to create a device, you can specify the D3DCREATE_MULTITHREADED flag to make the Direct3D 9 API thread safe. This causes significant synchronization overhead. Therefore, making the Direct3D 9 API thread safe is not recommended because performance can be degraded. |