Graphics Reference
In-Depth Information
Determining Driver Support
The two main multithreading features provided by Direct3D 11, resource creation and
draw submission, are guaranteed to be safe to use in a multithreaded development environ-
ment. However, they also rely on the GPU driver to operate optimally. If the driver cannot
provide fully free-threaded resource creation, then the runtime will default to using its own
lightweight synchronization. Similarly, if the driver does not provide a native implementa-
tion for multithreaded command lists, then the runtime will emulate the feature itself and
provide a similar functionality. In both of these cases, the performance of the individual
implementations may vary slightly, but having an emulation mode still allows the multi-
threading features to be used, even when the driver doesn't support them. The benefits of
using multiple threads should far outweigh any discrepancy in performance between native
implementations and emulated ones.
The ID3DllDevice interface provides a facility that indicates the level of support for
these two multithreading features in the user's video card driver. The process for determin-
ing multithreading support requires an initialized device interface that can then be queried
for its level of support for multithreading. (The process for creating a device is described in
detail in Chapter 1.) When an application intends to use multithreading, it must initialize the
device without the D3D11_CREATE_DEVICE_SINGI_ETHREADED device creation flag. Once
the device has been successfully initialized, it can be queried for multithreading support
using the ID3D11Device::CheckFeatureSupport() method. Listing 7.1 demonstrates
how to do this. Once this method returns successfully, the passed-in D3D11_FEATURE_
DATA_THREADING structure contains two Boolean variables: DriverConcurrentCreates
and DriverCommandLists. These variables indicate the driver level support for resource
creation and command lists, respectively.
D3D11_FEATURE_DATA_THREADING ThreadingOptions;
m_pDevice->CheckFeatureSupport( D3D11_FEATURE_THREADING,
&ThreadingOptions, sizeof( ThreadingOptions ) );
Listing 7.1. Checking for driver support of multithreading features.
While it is not mandatory to check these flags to determine the level of multithreading
support (since emulation is available), doing so provides nice side benefit for previous-
generation GPU hardware. Since the D3D11 runtime can be used with down-level hard-
ware, it is possible for a GPU manufacturer to release updated driver implementations
for D3D10 hardware. This provides a potentially significant performance improvement by
allowing true multithreading on older hardware simply by having an updated driver and
using D3D11. In this case, having the ability to poll the driver for support can be extremely
beneficial for the end user.
Search WWH ::




Custom Search