ID3D12Device::CreateFence method

Creates a fence object.

Syntax


HRESULT CreateFence(
        UINT64            InitialValue,
        D3D12_FENCE_FLAGS Flags,
        REFIID            riid,
  [out] void              **ppFence
);

Parameters

InitialValue

Type: UINT64

The initial value for the fence.

Flags

Type: D3D12_FENCE_FLAGS

A combination of D3D12_FENCE_FLAGS-typed values that are combined by using a bitwise OR operation. The resulting value specifies options for the fence.

riid

Type: REFIID

The globally unique identifier (GUID) for the fence interface (ID3D12Fence). The REFIID, or GUID, of the interface to the fence can be obtained by using the __uuidof() macro. For example, __uuidof(ID3D12Fence) will get the GUID of the interface to a fence.

ppFence [out]

Type: void**

A pointer to a memory block that receives a pointer to the ID3D12Fence interface that is used to access the fence.

Return value

Type: HRESULT

Returns S_OK if successful; otherwise, returns one of the Direct3D 12 Return Codes.

Examples

The D3D12Bundles sample uses ID3D12Device::CreateFence as follows:

Create and initialize a fence.


ThrowIfFailed(m_device->CreateFence(m_fenceValue, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(&m_fence)));
m_fenceValue++;


Refer to the Example Code in the D3D12 Reference.

Requirements

Header

D3D12.h

Library

D3D12.lib

DLL

D3D12.dll

See also

ID3D12Device

 

 

Show: