ID3D12Fence Interface

Namespace: Microsoft.DirectX.Graphics.D3D12

Represents a GPU-synchronized signal that allows the CPU to wait for the GPU to complete certain work.

Interface Definition


interface ID3D12Fence : ID3D12Object
{
    HRESULT SetEventOnCompletion(
        UINT64 Value,
        HANDLE Event
    );

    HRESULT Signal(
        UINT64 Value
    );

    UINT64 GetCompletedValue();
}
                

Members

Methods

SetEventOnCompletion

HRESULT SetEventOnCompletion( UINT64 Value, HANDLE Event );

Parameters

Return Value

If the method succeeds, the return value is S_OK. Otherwise, it is one of the Direct3D 12 return codes.

Signal

HRESULT Signal( UINT64 Value );

Parameters

Return Value

If the method succeeds, the return value is S_OK. Otherwise, it is one of the Direct3D 12 return codes.

GetCompletedValue

UINT64 GetCompletedValue();

Return Value

Returns the current completed value of the fence.

Remarks

Fences are essential for managing asynchronous operations between the CPU and the GPU. They provide a mechanism for the CPU to know when the GPU has finished processing a particular set of commands, allowing for proper synchronization and preventing race conditions.

You create a fence by calling ID3D12Device::CreateFence. Fences can be used for intra-adapter and inter-adapter synchronization.

See Also