ID3D12CommandQueue::Wait method

Waits until the specified fence reaches or exceeds the specified value.

Syntax


HRESULT Wait(
   ID3D12Fence *pFence,
   UINT64      Value
);

Parameters

pFence

Type: ID3D12Fence*

A pointer to the ID3D12Fence object.

Value

Type: UINT64

The value that the command queue is waiting for the fence to reach or exceed. So when ID3D12Fence::GetCompletedValue is greater than or equal to Value, the wait is terminated.

Return value

Type: HRESULT

This method returns one of the Direct3D 12 Return Codes.

Examples

Wait for the render thread to be done with the SRV so that the next frame in the simulation can run.


// Wait for the render thread to be done with the SRV so that
// the next frame in the simulation can run.
UINT64 renderContextFenceValue = InterlockedGetValue(&m_renderContextFenceValues[threadIndex]);
if (m_renderContextFence->GetCompletedValue() < renderContextFenceValue)
{
    ThrowIfFailed(pCommandQueue->Wait(m_renderContextFence.Get(), renderContextFenceValue));
    InterlockedExchange(&m_renderContextFenceValues[threadIndex], 0);
}


Refer to the Example Code in the D3D12 Reference.

Requirements

Header

D3D12.h

Library

D3D12.lib

DLL

D3D12.dll

See also

ID3D12CommandQueue
Synchronization and Multi-Engine

 

 

Show: