ID3D12CommandQueue::Signal method (d3d12.h)

Updates a fence to a specified value.

Syntax

HRESULT Signal(
  ID3D12Fence *pFence,
  UINT64      Value
);

Parameters

pFence

Type: ID3D12Fence*

A pointer to the ID3D12Fence object.

Value

Type: UINT64

The value to set the fence to.

Return value

Type: HRESULT

This method returns one of the Direct3D 12 Return Codes.

Remarks

Use this method to set a fence value from the GPU side. Use ID3D12Fence::Signal to set a fence from the CPU side.

Examples

Adds a signal to the command queue, then waits for the compute shader to complete the simulation, finally signal and increment the fence value.

// Wait for the compute shader to complete the simulation.
UINT64 threadFenceValue = InterlockedIncrement(&m_threadFenceValues[threadIndex]);
ThrowIfFailed(pCommandQueue->Signal(pFence, threadFenceValue));
ThrowIfFailed(pFence->SetEventOnCompletion(threadFenceValue, m_threadFenceEvents[threadIndex]));
WaitForSingleObject(m_threadFenceEvents[threadIndex], INFINITE);

// Add a signal command to the queue.
ThrowIfFailed(m_commandQueue->Signal(m_renderContextFence.Get(), m_renderContextFenceValue));

// Signal and increment the fence value.
ThrowIfFailed(m_commandQueue->Signal(m_renderContextFence.Get(), m_renderContextFenceValue));
m_renderContextFenceValue++;

Refer to the Example Code in the D3D12 Reference.

Requirements

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

See also

ID3D12CommandQueue

Multi-engine synchronization