Creates a deferred context, which can record command lists.
public:
HRESULT CreateDeferredContext2(
UINT ContextFlags,
ID3D11DeviceContext2 **ppDeferredContext
)
ContextFlags
Type: UINT
Reserved for future use. Pass 0.
ppDeferredContext
Type: ID3D11DeviceContext2 **
[out] Upon completion of the method, the passed pointer to an ID3D11DeviceContext2 interface pointer is initialized.
Type: HRESULT
Returns S_OK if successful; otherwise, returns one of the following:
A deferred context is a thread-safe context that you can use to record graphics commands on a thread other than the main rendering thread. By using a deferred context, you can record graphics commands into a command list that is encapsulated by the ID3D11CommandList interface. After you record all scene items, you can then submit them to the main render thread for final rendering. In this manner, you can perform rendering tasks concurrently across multiple threads and potentially improve performance in multi-core CPU scenarios.
You can create multiple deferred contexts.
Note If you use the D3D11_CREATE_DEVICE_SINGLETHREADED value to create the device, CreateDeferredContext2 fails with DXGI_ERROR_INVALID_CALL, and you can’t create a deferred context.
For more information about deferred contexts, see Immediate and Deferred Rendering.
Header: Declared in d3d11_x.h (d3d11_2.h in other Windows platforms).
Library: Use d3d11_x.lib (d3d11.lib in other Windows platforms).