ID3D11Device1::CreateDeferredContext1 Method

Creates a deferred context, which can record command lists.

Syntax

public:
HRESULT CreateDeferredContext1(
         UINT ContextFlags,
         ID3D11DeviceContext1 **ppDeferredContext
)  

Parameters

ContextFlags
Type: UINT 

Context flags. Pass 0 or one or more entries from D3D11_CREATE_DEFERRED_CONTEXT_FLAG.

ppDeferredContext
Type: ID3D11DeviceContext1 **

[out, optional] Upon completion of the method, the passed pointer to an ID3D11DeviceContext1 interface pointer is initialized.

Return value

Type: HRESULT 

Returns S_OK if successful; otherwise, returns one of the following:

Remarks

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 (this flag is supported for Windows only, not Xbox One) to create the device that is represented by ID3D11Device1, the CreateDeferredContext1 method will fail, and you will not be able to create a deferred context.

For more information about deferred contexts, see Immediate and Deferred Rendering.

To support the use of PIX with your title, use the context flag D3D11_CREATE_DEFERRED_CONTEXT_LONG_LIFE_COMMAND_LISTS when creating a deferred context that will be used to record long-running command lists. This flag provides a hint to PIX that command lists created on this deferred context may be used in a later frame, and PIX GPU captures may display an error if this flag is not used appropriately.

There is a small performance penalty during creation of the command list, but no penalty during execution; we recommend that you only create command lists that are created once and used over many frames.

D3D11_CREATE_DEFERRED_CONTEXT_LONG_LIFE_COMMAND_LISTS only has an effect when linking to the instrumented version of the Direct3D 11 library (D3D11i.lib), and it has no effect when linking to the release version of the library (D3D11.DLL).

Requirements

Header: Declared in d3d11_x.h (d3d11_1.h on other Windows platforms).

Library: Use d3d11_x.lib (d3d11.lib on other Windows platforms).

See also

ID3D11Device1

ID3D11Device1 Members