Object Creation with Multithreading

Use the ID3D11Device interface to create resources and objects, use the ID3D11DeviceContext for rendering.

Here are some examples of how to create resources:

Multithreading Considerations

The amount of concurrency of resource creation and rendering that your application can achieve depends on the level of multithreading support that the driver implements. If the driver supports concurrent creates, then the application should have much less concurrency concerns. However, if the driver does not support concurrent object creation, the amount of concurrency is extremely limited. To understand the amount of support available in a driver, query the driver for the value of the DriverConcurrentCreates member of the D3D11_FEATURE_DATA_THREADING structure. For more information about checking for driver support of multithreading, see How To: Check for Driver Support.

Concurrent operations do not necessarily lead to better performance. For example, creating and loading a texture is typically limited by memory bandwidth. Attempting to create and load multiple textures might be no faster than doing one texture at a time, even if this leaves multiple CPU cores idle. However, creating multiple shaders using multiple threads can increase performance as this operation is less dependent on system resources such as memory bandwidth.

When the driver and graphics hardware support multithreading, you can typically initialize newly created resources more efficiently by passing a pointer to initial data in the pInitialData parameter (for example, in a call to the ID3D11Device::CreateTexture2D method).