ID3D12CommandQueue interface
Provides methods for submitting command lists, synchronizing command list execution, instrumenting the command queue, and updating resource tile mappings.
Members
The ID3D12CommandQueue interface inherits from ID3D12Pageable. ID3D12CommandQueue also has these types of members:
Methods
The ID3D12CommandQueue interface has these methods.
| Method | Description |
|---|---|
| BeginEvent |
Not intended to be called directly. Use the PIX event runtime to insert events into a command queue. |
| CopyTileMappings |
Copies mappings from a source reserved resource to a destination reserved resource. |
| EndEvent |
Not intended to be called directly. Use the PIX event runtime to insert events into a command queue. |
| ExecuteCommandLists |
Submits an array of command lists for execution. |
| GetClockCalibration |
This method samples the CPU and GPU timestamp counters at the same moment in time. |
| GetDesc |
Gets the description of the command queue. |
| GetTimestampFrequency |
This method is used to determine the rate at which the GPU timestamp counter increments. |
| SetMarker |
Not intended to be called directly. Use the PIX event runtime to insert events into a command queue. |
| Signal |
Updates a fence to a specified value. |
| UpdateTileMappings |
Updates mappings of tile locations in reserved resources to memory locations in a resource heap. |
| Wait |
Waits until the specified fence reaches or exceeds the specified value. |
Remarks
Use ID3D12Device::CreateCommandQueue to create a command queue object.
Examples
The D3D12nBodyGravity sample uses ID3D12CommandQueue as follows:
Header file declarations.
// Compute objects.
ComPtr<ID3D12CommandAllocator> m_computeAllocator[ThreadCount];
ComPtr<ID3D12CommandQueue> m_computeCommandQueue[ThreadCount];
ComPtr<ID3D12GraphicsCommandList> m_computeCommandList[ThreadCount];
Asynchronous compute thread.
DWORD D3D12nBodyGravity::AsyncComputeThreadProc(int threadIndex) { ID3D12CommandQueue* pCommandQueue = m_computeCommandQueue[threadIndex].Get(); ID3D12CommandAllocator* pCommandAllocator = m_computeAllocator[threadIndex].Get(); ID3D12GraphicsCommandList* pCommandList = m_computeCommandList[threadIndex].Get(); ID3D12Fence* pFence = m_threadFences[threadIndex].Get(); while (0 == InterlockedGetValue(&m_terminating)) { // Run the particle simulation. Simulate(threadIndex); // Close and execute the command list. ThrowIfFailed(pCommandList->Close()); ID3D12CommandList* ppCommandLists[] = { pCommandList }; pCommandQueue->ExecuteCommandLists(1, ppCommandLists); // 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); // 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); } // Swap the indices to the SRV and UAV. m_srvIndex[threadIndex] = 1 - m_srvIndex[threadIndex]; // Prepare for the next frame. ThrowIfFailed(pCommandAllocator->Reset()); ThrowIfFailed(pCommandList->Reset(pCommandAllocator, m_computeState.Get())); } return 0; }
Refer to the Example Code in the D3D12 Reference.
Requirements
|
Header |
|
|---|---|
|
Library |
|
|
DLL |
|
See also