diff options
| author | assiduous <assiduous@diligentgraphics.com> | 2021-03-14 02:42:10 +0000 |
|---|---|---|
| committer | assiduous <assiduous@diligentgraphics.com> | 2021-03-19 00:38:22 +0000 |
| commit | c8a2291bcf12adde60c42292903005b996b7a499 (patch) | |
| tree | 018d2b005e4e3d89653584f567f1937863d009a9 /Graphics | |
| parent | Renamed Align to AlignUp (diff) | |
| download | DiligentCore-c8a2291bcf12adde60c42292903005b996b7a499.tar.gz DiligentCore-c8a2291bcf12adde60c42292903005b996b7a499.zip | |
Reworked CommandListBase to use EngineImplTraits like the rest of the base classes
Diffstat (limited to 'Graphics')
9 files changed, 34 insertions, 22 deletions
diff --git a/Graphics/GraphicsEngine/include/CommandListBase.hpp b/Graphics/GraphicsEngine/include/CommandListBase.hpp index 0d4cea78..3dc83c08 100644 --- a/Graphics/GraphicsEngine/include/CommandListBase.hpp +++ b/Graphics/GraphicsEngine/include/CommandListBase.hpp @@ -43,15 +43,17 @@ struct CommandListDesc : public DeviceObjectAttribs /// Template class implementing base functionality of the command list object. -/// \tparam BaseInterface - Base interface that this class will inheret -/// (Diligent::ICommandListD3D11, Diligent::ICommandListD3D12 or Diligent::ICommandListVk). -/// \tparam RenderDeviceImplType - Type of the render device implementation -/// (Diligent::RenderDeviceD3D11Impl, Diligent::RenderDeviceD3D12Impl, -/// Diligent::RenderDeviceGLImpl, or Diligent::RenderDeviceVkImpl) -template <class BaseInterface, class RenderDeviceImplType> -class CommandListBase : public DeviceObjectBase<BaseInterface, RenderDeviceImplType, CommandListDesc> +/// \tparam EngineImplTraits - Engine implementation type traits. +template <typename EngineImplTraits> +class CommandListBase : public DeviceObjectBase<typename EngineImplTraits::CommandListInterface, typename EngineImplTraits::RenderDeviceImplType, CommandListDesc> { public: + // Base interface that this class inherits (ICommandList). + using BaseInterface = typename EngineImplTraits::CommandListInterface; + + // Render device implementation type (RenderDeviceD3D12Impl, RenderDeviceVkImpl, etc.). + using RenderDeviceImplType = typename EngineImplTraits::RenderDeviceImplType; + using TDeviceObjectBase = DeviceObjectBase<BaseInterface, RenderDeviceImplType, CommandListDesc>; /// \param pRefCounters - Reference counters object that controls the lifetime of this command list. diff --git a/Graphics/GraphicsEngineD3D11/CMakeLists.txt b/Graphics/GraphicsEngineD3D11/CMakeLists.txt index cd903d79..197aa86b 100644 --- a/Graphics/GraphicsEngineD3D11/CMakeLists.txt +++ b/Graphics/GraphicsEngineD3D11/CMakeLists.txt @@ -12,6 +12,7 @@ set(INCLUDE include/DeviceContextD3D11Impl.hpp include/DisjointQueryPool.hpp include/EngineD3D11Defines.h + include/EngineD3D11ImplTraits.hpp include/pch.h include/FenceD3D11Impl.hpp include/FramebufferD3D11Impl.hpp diff --git a/Graphics/GraphicsEngineD3D11/include/CommandListD3D11Impl.hpp b/Graphics/GraphicsEngineD3D11/include/CommandListD3D11Impl.hpp index cb1c3ec0..14a9b394 100644 --- a/Graphics/GraphicsEngineD3D11/include/CommandListD3D11Impl.hpp +++ b/Graphics/GraphicsEngineD3D11/include/CommandListD3D11Impl.hpp @@ -30,20 +30,17 @@ /// \file /// Declaration of Diligent::CommandListD3D11Impl class -#include "RenderDeviceD3D11.h" +#include "EngineD3D11ImplTraits.hpp" #include "CommandListBase.hpp" -#include "RenderDeviceD3D11Impl.hpp" namespace Diligent { -class FixedBlockMemoryAllocator; - /// Command list implementation in Direct3D11 backend. -class CommandListD3D11Impl final : public CommandListBase<ICommandList, RenderDeviceD3D11Impl> +class CommandListD3D11Impl final : public CommandListBase<EngineD3D11ImplTraits> { public: - using TCommandListBase = CommandListBase<ICommandList, RenderDeviceD3D11Impl>; + using TCommandListBase = CommandListBase<EngineD3D11ImplTraits>; CommandListD3D11Impl(IReferenceCounters* pRefCounters, RenderDeviceD3D11Impl* pDevice, diff --git a/Graphics/GraphicsEngineD3D11/include/EngineD3D11ImplTraits.hpp b/Graphics/GraphicsEngineD3D11/include/EngineD3D11ImplTraits.hpp index 87e3e0cb..907755fc 100644 --- a/Graphics/GraphicsEngineD3D11/include/EngineD3D11ImplTraits.hpp +++ b/Graphics/GraphicsEngineD3D11/include/EngineD3D11ImplTraits.hpp @@ -43,6 +43,7 @@ #include "QueryD3D11.h" #include "RenderPass.h" #include "Framebuffer.h" +#include "CommandList.h" #include "PipelineResourceSignature.h" #include "DeviceContextD3D11.h" @@ -63,6 +64,7 @@ class FenceD3D11Impl; class QueryD3D11Impl; class RenderPassD3D11Impl; class FramebufferD3D11Impl; +class CommandListD3D11Impl; class BottomLevelASD3D11Impl; class TopLevelASD3D11Impl; class ShaderBindingTableD3D11Impl; @@ -89,6 +91,7 @@ struct EngineD3D11ImplTraits using QueryInterface = IQueryD3D11; using RenderPassInterface = IRenderPass; using FramebufferInterface = IFramebuffer; + using CommandListInterface = ICommandList; using PipelineResourceSignatureInterface = IPipelineResourceSignature; using RenderDeviceImplType = RenderDeviceD3D11Impl; @@ -105,6 +108,7 @@ struct EngineD3D11ImplTraits using QueryImplType = QueryD3D11Impl; using RenderPassImplType = RenderPassD3D11Impl; using FramebufferImplType = FramebufferD3D11Impl; + using CommandListImplType = CommandListD3D11Impl; using BottomLevelASImplType = BottomLevelASD3D11Impl; using TopLevelASImplType = TopLevelASD3D11Impl; using ShaderBindingTableImplType = ShaderBindingTableD3D11Impl; diff --git a/Graphics/GraphicsEngineD3D11/src/CommandListD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/CommandListD3D11Impl.cpp index 30c7f425..bae5d4fb 100644 --- a/Graphics/GraphicsEngineD3D11/src/CommandListD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/CommandListD3D11Impl.cpp @@ -26,9 +26,12 @@ */ #include "pch.h" -#include <atlbase.h> #include "CommandListD3D11Impl.hpp" + +#include <atlbase.h> + +#include "RenderDeviceD3D11Impl.hpp" #include "EngineMemory.h" namespace Diligent diff --git a/Graphics/GraphicsEngineD3D12/include/CommandListD3D12Impl.hpp b/Graphics/GraphicsEngineD3D12/include/CommandListD3D12Impl.hpp index 57f3d0e5..cfeef26a 100644 --- a/Graphics/GraphicsEngineD3D12/include/CommandListD3D12Impl.hpp +++ b/Graphics/GraphicsEngineD3D12/include/CommandListD3D12Impl.hpp @@ -30,19 +30,17 @@ /// \file /// Declaration of Diligent::CommandListD3D12Impl class +#include "EngineD3D12ImplTraits.hpp" #include "CommandListBase.hpp" -#include "RenderDeviceD3D12Impl.hpp" namespace Diligent { -class DeviceContextD3D12Impl; - /// Command list implementation in Direct3D12 backend. -class CommandListD3D12Impl final : public CommandListBase<ICommandList, RenderDeviceD3D12Impl> +class CommandListD3D12Impl final : public CommandListBase<EngineD3D12ImplTraits> { public: - using TCommandListBase = CommandListBase<ICommandList, RenderDeviceD3D12Impl>; + using TCommandListBase = CommandListBase<EngineD3D12ImplTraits>; CommandListD3D12Impl(IReferenceCounters* pRefCounters, RenderDeviceD3D12Impl* pDevice, diff --git a/Graphics/GraphicsEngineD3D12/include/EngineD3D12ImplTraits.hpp b/Graphics/GraphicsEngineD3D12/include/EngineD3D12ImplTraits.hpp index a2ec044c..839afff9 100644 --- a/Graphics/GraphicsEngineD3D12/include/EngineD3D12ImplTraits.hpp +++ b/Graphics/GraphicsEngineD3D12/include/EngineD3D12ImplTraits.hpp @@ -43,6 +43,7 @@ #include "QueryD3D12.h" #include "RenderPass.h" #include "Framebuffer.h" +#include "CommandList.h" #include "BottomLevelASD3D12.h" #include "TopLevelASD3D12.h" #include "ShaderBindingTableD3D12.h" @@ -67,6 +68,7 @@ class FenceD3D12Impl; class QueryD3D12Impl; class RenderPassD3D12Impl; class FramebufferD3D12Impl; +class CommandListD3D12Impl; class BottomLevelASD3D12Impl; class TopLevelASD3D12Impl; class ShaderBindingTableD3D12Impl; @@ -93,6 +95,7 @@ struct EngineD3D12ImplTraits using QueryInterface = IQueryD3D12; using RenderPassInterface = IRenderPass; using FramebufferInterface = IFramebuffer; + using CommandListInterface = ICommandList; using BottomLevelASInterface = IBottomLevelASD3D12; using TopLevelASInterface = ITopLevelASD3D12; using ShaderBindingTableInterface = IShaderBindingTableD3D12; @@ -113,6 +116,7 @@ struct EngineD3D12ImplTraits using QueryImplType = QueryD3D12Impl; using RenderPassImplType = RenderPassD3D12Impl; using FramebufferImplType = FramebufferD3D12Impl; + using CommandListImplType = CommandListD3D12Impl; using BottomLevelASImplType = BottomLevelASD3D12Impl; using TopLevelASImplType = TopLevelASD3D12Impl; using ShaderBindingTableImplType = ShaderBindingTableD3D12Impl; diff --git a/Graphics/GraphicsEngineVulkan/include/CommandListVkImpl.hpp b/Graphics/GraphicsEngineVulkan/include/CommandListVkImpl.hpp index 2fff7842..50521913 100644 --- a/Graphics/GraphicsEngineVulkan/include/CommandListVkImpl.hpp +++ b/Graphics/GraphicsEngineVulkan/include/CommandListVkImpl.hpp @@ -33,16 +33,15 @@ #include "EngineVkImplTraits.hpp" #include "VulkanUtilities/VulkanHeaders.h" #include "CommandListBase.hpp" -#include "RenderDeviceVkImpl.hpp" namespace Diligent { /// Command list implementation in Vulkan backend. -class CommandListVkImpl final : public CommandListBase<ICommandList, RenderDeviceVkImpl> +class CommandListVkImpl final : public CommandListBase<EngineVkImplTraits> { public: - using TCommandListBase = CommandListBase<ICommandList, RenderDeviceVkImpl>; + using TCommandListBase = CommandListBase<EngineVkImplTraits>; CommandListVkImpl(IReferenceCounters* pRefCounters, RenderDeviceVkImpl* pDevice, diff --git a/Graphics/GraphicsEngineVulkan/include/EngineVkImplTraits.hpp b/Graphics/GraphicsEngineVulkan/include/EngineVkImplTraits.hpp index ff51c262..9f186265 100644 --- a/Graphics/GraphicsEngineVulkan/include/EngineVkImplTraits.hpp +++ b/Graphics/GraphicsEngineVulkan/include/EngineVkImplTraits.hpp @@ -43,6 +43,7 @@ #include "QueryVk.h" #include "RenderPassVk.h" #include "FramebufferVk.h" +#include "CommandList.h" #include "BottomLevelASVk.h" #include "TopLevelASVk.h" #include "ShaderBindingTableVk.h" @@ -67,6 +68,7 @@ class FenceVkImpl; class QueryVkImpl; class RenderPassVkImpl; class FramebufferVkImpl; +class CommandListVkImpl; class BottomLevelASVkImpl; class TopLevelASVkImpl; class ShaderBindingTableVkImpl; @@ -93,6 +95,7 @@ struct EngineVkImplTraits using QueryInterface = IQueryVk; using RenderPassInterface = IRenderPassVk; using FramebufferInterface = IFramebufferVk; + using CommandListInterface = ICommandList; using BottomLevelASInterface = IBottomLevelASVk; using TopLevelASInterface = ITopLevelASVk; using ShaderBindingTableInterface = IShaderBindingTableVk; @@ -113,6 +116,7 @@ struct EngineVkImplTraits using QueryImplType = QueryVkImpl; using RenderPassImplType = RenderPassVkImpl; using FramebufferImplType = FramebufferVkImpl; + using CommandListImplType = CommandListVkImpl; using BottomLevelASImplType = BottomLevelASVkImpl; using TopLevelASImplType = TopLevelASVkImpl; using ShaderBindingTableImplType = ShaderBindingTableVkImpl; |
