Diligent Engine API Reference: D:/GitHub/DiligentEngine/DiligentCore/Graphics/GraphicsEngineD3D12/include/CommandQueueD3D12Impl.h Source File

Diligent Engine API Reference

CommandQueueD3D12Impl.h
1 /* Copyright 2015-2018 Egor Yusov
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
10 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
11 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS.
12 *
13 * In no event and under no legal theory, whether in tort (including negligence),
14 * contract, or otherwise, unless required by applicable law (such as deliberate
15 * and grossly negligent acts) or agreed to in writing, shall any Contributor be
16 * liable for any damages, including any direct, indirect, special, incidental,
17 * or consequential damages of any character arising as a result of this License or
18 * out of the use or inability to use the software (including but not limited to damages
19 * for loss of goodwill, work stoppage, computer failure or malfunction, or any and
20 * all other commercial damages or losses), even if such Contributor has been advised
21 * of the possibility of such damages.
22 */
23
24 #pragma once
25
28
29 #include "CommandQueueD3D12.h"
30 #include "ObjectBase.h"
31
32 namespace Diligent
33 {
34
36 class CommandQueueD3D12Impl : public ObjectBase<ICommandQueueD3D12>
37 {
38 public:
39 typedef ObjectBase<ICommandQueueD3D12> TBase;
40
41 CommandQueueD3D12Impl(IReferenceCounters *pRefCounters, ID3D12CommandQueue *pd3d12NativeCmdQueue, ID3D12Fence *pd3d12Fence);
42 ~CommandQueueD3D12Impl();
43
44 virtual void QueryInterface( const Diligent::INTERFACE_ID &IID, IObject **ppInterface )override;
45
46 // Returns the fence value that will be signaled next time
47 virtual UINT64 GetNextFenceValue()override final { return m_NextFenceValue; }
48
49 // Executes a given command list
50 virtual UINT64 ExecuteCommandList(ID3D12GraphicsCommandList* commandList)override final;
51
52 virtual ID3D12CommandQueue* GetD3D12CommandQueue()override final { return m_pd3d12CmdQueue; }
53
54 virtual void IdleGPU()override final;
55
56 virtual Uint64 GetCompletedFenceValue()override final;
57
58 private:
59 // A value that will be signaled by the command queue next
60 Atomics::AtomicInt64 m_NextFenceValue;
61
62 // Last fence value completed by the GPU
63 volatile Uint64 m_LastCompletedFenceValue = 0;
64
65 CComPtr<ID3D12CommandQueue> m_pd3d12CmdQueue;
66
67 // The fence is signaled right after the command list has been
68 // submitted to the command queue for execution.
69 // All command lists with fence value less or equal to the signaled value
70 // are guaranteed to be finished by the GPU
71 CComPtr<ID3D12Fence> m_d3d12Fence;
72
73 HANDLE m_WaitForGPUEventHandle = {};
74 };
75
76 }
Diligent::CommandQueueD3D12Impl::GetD3D12CommandQueue
virtual ID3D12CommandQueue * GetD3D12CommandQueue() override final
Returns D3D12 command queue. May return null if queue is anavailable.
Definition: CommandQueueD3D12Impl.h:52
Diligent::CommandQueueD3D12Impl::GetNextFenceValue
virtual UINT64 GetNextFenceValue() override final
Returns the fence value that will be signaled next time.
Definition: CommandQueueD3D12Impl.h:47
Diligent::CommandQueueD3D12Impl::GetCompletedFenceValue
virtual Uint64 GetCompletedFenceValue() override final
Returns value of the last completed fence.
Definition: CommandQueueD3D12Impl.cpp:73
Diligent::ObjectBase
Template class implementing base functionality for an object.
Definition: ObjectBase.h:62
Diligent::CommandQueueD3D12Impl::ExecuteCommandList
virtual UINT64 ExecuteCommandList(ID3D12GraphicsCommandList *commandList) override final
Executes a given command list.
Definition: CommandQueueD3D12Impl.cpp:48
Diligent
Namespace for the OpenGL implementation of the graphics engine.
Definition: BufferD3D11Impl.h:34
Diligent::CommandQueueD3D12Impl::IdleGPU
virtual void IdleGPU() override final
Blocks execution until all pending GPU commands are complete.
Definition: CommandQueueD3D12Impl.cpp:60
Diligent::CommandQueueD3D12Impl
Implementation of the Diligent::ICommandQueueD3D12 interface.
Definition: CommandQueueD3D12Impl.h:36