Graphics Reference
In-Depth Information
The device context is implemented in the ID3DllDeviceContext interface. To help
in the introduction of multithreaded rendering support, two different flavors of contexts
are provided. The first is referred to as an immediate context, and the second is called a
deferred context. While both of these types implement the same device context interface,
their usage has very different semantics. We will discuss the concepts behind these two
contexts below.
Immediate Contexts
The immediate context is more or less a direct link to the pipeline. When a method is called
from this context, it is submitted immediately by the Direct3D 11 runtime for execution in
the driver. Only a single immediate context is allowed, and it is created at the same time
that the device is created. This context can be seen as the interface for directly interacting
with all of the components of the pipeline. This context must be used as the main rendering
thread, and serves as the primary interface to the GPU.
Deferred Contexts
The deferred context is a secondary type of context that provides a thread-safe mechanism
for recording a series of commands from secondary threads other than the main rendering
thread. This is used to produce a command list object which can be "played" back on the im-
mediate context at a later time. Allowing the command list to be generated from other threads
provides some potential that a performance improvement could be found on multi-core CPU
systems. In addition, Direct3D 11 also allows asynchronous resource creation to be carried
out on multiple threads, which provides the ability to simplify multithreaded loading situa-
tions. These are important concepts when considering the current and future PC hardware en-
vironment, in which we can expect more and more CPU cores to be available in a given PC.
The topic of multithreaded rendering is discussed in more detail in Chapter 7,
"Multithreaded Rendering." The topic is itself worthy of a complete topic, but in the inter-
ests of providing a well-rounded discussion of Direct3D 11, we have attempted to provide
design-level information about how and when to use multithreading, rather than trying to
explain all of the details of multithreaded programming in general.
1.5 Getting Started
This portion of the chapter is devoted to giving the reader a crash course in how to get a
basic Direct3D 11 application running. The description provided here introduces a num-
ber of basic concepts used to interact with Direct3D 11 and introduces the basic program
Search WWH ::




Custom Search