Graphics Reference
In-Depth Information
5.1.1 DirectCompute
DirectCompute introduces a new processing paradigm that attempts to make the massively
parallel computational power of the GPU available for tasks outside of the normal raster-
based rendering domain. Since the GPU is comprised of a large number of small processors
working in parallel, it is especially well suited for computational tasks that allow for strong
parallelization. In fact, this is not the first time that GPUs have been used for purposes other
than rendering. An entire field of application development, named general purpose GPU
computations (GPGPU), has sprung up, which uses existing rendering APIs to implement
support for a desired algorithm.
This process has been effective, but it is not without its drawbacks. Although applica-
tion developers started to use the 3D rendering API to perform calculations it wasn't origi-
nally designed for, the process of implementing an algorithm is significantly more difficult
than it is when using a traditional programming language such as C++. In addition, there
are certain operations which were not even possible to perform on the GPU through the
rendering API, such as scattered writing to resources. The GPU manufacturers were well
aware of this situation, and several new APIs have been developed to allow more flexible
use of the GPU's power. APIs such as CUDA and OpenCL provide a more general process-
ing environment than trying to use a 3D API. These solutions are an improvement over the
do-it-yourself frameworks.
DirectCompute takes this improved flexibility a step further. DirectCompute is
squarely embedded in the Direct3D 11 processing environment, and it shares much of
the existing framework from the rendering portion of the API. Within this context, an ap-
plication developer familiar with Direct3D 10 and/or Direct3D 11 already knows how
to perform many of the normal interactions with the API code to get an application up
and running. Furthermore, the resource models, execution paradigms, and general debug-
ging process all leverage existing knowledge. These are all reasons that DirectCompute
is an attractive technology to use. However, perhaps the single most important benefit
that DirectCompute provides is that it is so close to the rest of the rendering pipeline and
can easily be used directly to supply input to rendering operations. This makes the API
instantly useable by a wide variety of Direct3D programmers, who can use it in their ap-
plications almost immediately. DirectCompute uses the exact same resources that are used
in rendering, making interoperation between the two very simple. With general-purpose
processing available with rendering, we have a very potent combination for use in a wide
variety of applications.
Another great benefit of using DirectCompute is that the performance of a particular
algorithm can easily scale with a user's hardware. If a user has a high-end gaming PC with
two or more high-end GPUs, then an algorithm can easily provide additional complexity to
a game without the need to rewrite any code. The threading model of the compute shader
inherently supports parallel processing of resources, so adding additional work when more
Search WWH ::




Custom Search