Graphics Reference
In-Depth Information
The immediate context is available on the device through the following methods/properties:
F Managed: Device.ImmediateContext , Device1.ImmediateContext1 ,
and Device2.ImmediateContext2
F Unmanaged: ID3D11Device::GetImmediateContext , ID3D11Device1::GetI
mmediateContext1 , and ID3D11Device2::GetImmediateContext2
Deferred context
The same rendering methods are available on a deferred context as for an immediate context;
however, the commands are added to a queue called a command list for later execution upon
the immediate context.
Using deferred contexts results in some additional overhead, and only begins to see benefits
when parallelizing CPU-intensive tasks. For example, rendering the same simple scene for the
six sides of a cubic environment map will not immediately see any performance benefits,
and in fact will increase the time it takes to render a frame as compared to using the
immediate context directly. However, render the same scene again with enough CPU load
and it is possible to see some improvements over rendering directly on the immediate
context. The usage of deferred contexts is no substitute for a well written engine and
needs to be carefully evaluated to be correctly taken advantage of.
Multiple deferred context instances can be created and accessed from multiple threads;
however, each may only be accessed by one thread at a time. For example, with the
deferred contexts A and B, we can access both at the exact same time from threads 1
and 2 provided that thread 1 is only accessing deferred context A and thread 2 is only
accessing deferred context B (or vice versa). Any sharing of contexts between threads
requires thread synchronization.
The resulting command lists are not executed against the device until they are played back
by an immediate context.
If a device is created with the single-threaded device creation
flag, an error will occur if you attempt to create a deferred
context. The result of accessing Direct3D interfaces from
multiple threads is also undefined.
A deferred context is created with:
F Managed: new DeviceContext(device)
F Unmanaged: ID3D11Device::CreateDeferredContext
 
Search WWH ::




Custom Search