ID3D12Fence::SetEventOnCompletion method

Specifies an event that should be fired when the fence reaches a certain value.

Syntax

HRESULT SetEventOnCompletion(
  UINT64 Value,
  HANDLE hEvent
);

Parameters

Value

Type: UINT64

The fence value when the event is to be signaled.

hEvent

Type: HANDLE

A handle to the event object.

Return Value

Type: HRESULT

This method returns E_OUTOFMEMORY if the kernel components don’t have sufficient memory to store the event in a list. See Direct3D 12 Return Codes for other possible return values.

Remarks

To specify multiple fences before an event is triggered, refer to SetEventOnMultipleFenceCompletion.

Examples

The D3D12Multithreading sample uses ID3D12Fence::SetEventOnCompletion as follows:

// Wait for the command list to execute; we are reusing the same command 
// list in our main loop but for now, we just want to wait for setup to 
// complete before continuing.

// Signal and increment the fence value.
const UINT64 fenceToWaitFor = m_fenceValue;
ThrowIfFailed(m_commandQueue->Signal(m_fence.Get(), fenceToWaitFor));
m_fenceValue++;

// Wait until the fence is completed.
ThrowIfFailed(m_fence->SetEventOnCompletion(fenceToWaitFor, m_fenceEvent));
WaitForSingleObject(m_fenceEvent, INFINITE);

Refer to the Example Code in the D3D12 Reference.

Requirements

   
Target Platform Windows
Header d3d12.h
Library D3D12.lib
DLL D3D12.dll

See Also

ID3D12Fence

Synchronization and Multi-Engine