diff options
| author | assiduous <assiduous@diligentgraphics.com> | 2021-03-07 23:22:38 +0000 |
|---|---|---|
| committer | assiduous <assiduous@diligentgraphics.com> | 2021-03-19 00:38:17 +0000 |
| commit | 59bcca99a11243873bf259385705dacd6bb70fea (patch) | |
| tree | fcc6ac67cbbf29a27385ac4f865fe778c8fa429a /Graphics/GraphicsEngineD3D12 | |
| parent | Replaced duplicate CacheContentType enums with the common ResourceCacheConten... (diff) | |
| download | DiligentCore-59bcca99a11243873bf259385705dacd6bb70fea.tar.gz DiligentCore-59bcca99a11243873bf259385705dacd6bb70fea.zip | |
Implemented common PRS methods directly in PipelineResourceSignatureBase; refactored include dependencies in D3D12 backend
Diffstat (limited to 'Graphics/GraphicsEngineD3D12')
45 files changed, 263 insertions, 199 deletions
diff --git a/Graphics/GraphicsEngineD3D12/CMakeLists.txt b/Graphics/GraphicsEngineD3D12/CMakeLists.txt index a497ad68..87262891 100644 --- a/Graphics/GraphicsEngineD3D12/CMakeLists.txt +++ b/Graphics/GraphicsEngineD3D12/CMakeLists.txt @@ -34,7 +34,7 @@ set(INCLUDE include/ShaderResourceBindingD3D12Impl.hpp include/ShaderResourceCacheD3D12.hpp include/ShaderResourcesD3D12.hpp - include/ShaderVariableD3D12.hpp + include/ShaderVariableManagerD3D12.hpp include/SwapChainD3D12Impl.hpp include/TextureD3D12Impl.hpp include/TextureViewD3D12Impl.hpp @@ -42,6 +42,7 @@ set(INCLUDE include/TopLevelASD3D12Impl.hpp include/ShaderBindingTableD3D12Impl.hpp include/PipelineResourceSignatureD3D12Impl.hpp + include/PipelineResourceAttribsD3D12.hpp ) set(INTERFACE @@ -93,7 +94,7 @@ set(SRC src/ShaderResourceBindingD3D12Impl.cpp src/ShaderResourceCacheD3D12.cpp src/ShaderResourcesD3D12.cpp - src/ShaderVariableD3D12.cpp + src/ShaderVariableManagerD3D12.cpp src/SwapChainD3D12Impl.cpp src/TextureD3D12Impl.cpp src/TextureViewD3D12Impl.cpp diff --git a/Graphics/GraphicsEngineD3D12/include/BottomLevelASD3D12Impl.hpp b/Graphics/GraphicsEngineD3D12/include/BottomLevelASD3D12Impl.hpp index 9ffba139..4ab720e7 100644 --- a/Graphics/GraphicsEngineD3D12/include/BottomLevelASD3D12Impl.hpp +++ b/Graphics/GraphicsEngineD3D12/include/BottomLevelASD3D12Impl.hpp @@ -30,11 +30,11 @@ /// \file /// Declaration of Diligent::BottomLevelASD3D12Impl class +#include "EngineD3D12ImplTraits.hpp" #include "BottomLevelASD3D12.h" #include "RenderDeviceD3D12.h" #include "BottomLevelASBase.hpp" #include "D3D12ResourceBase.hpp" -#include "RenderDeviceD3D12Impl.hpp" namespace Diligent { diff --git a/Graphics/GraphicsEngineD3D12/include/BufferD3D12Impl.hpp b/Graphics/GraphicsEngineD3D12/include/BufferD3D12Impl.hpp index 49dbb25b..c2053c03 100644 --- a/Graphics/GraphicsEngineD3D12/include/BufferD3D12Impl.hpp +++ b/Graphics/GraphicsEngineD3D12/include/BufferD3D12Impl.hpp @@ -30,13 +30,13 @@ /// \file /// Declaration of Diligent::BufferD3D12Impl class +#include "EngineD3D12ImplTraits.hpp" #include "BufferD3D12.h" #include "RenderDeviceD3D12.h" #include "BufferBase.hpp" -#include "BufferViewD3D12Impl.hpp" #include "D3D12ResourceBase.hpp" #include "D3D12DynamicHeap.hpp" -#include "RenderDeviceD3D12Impl.hpp" +#include "BufferViewD3D12Impl.hpp" namespace Diligent { diff --git a/Graphics/GraphicsEngineD3D12/include/BufferViewD3D12Impl.hpp b/Graphics/GraphicsEngineD3D12/include/BufferViewD3D12Impl.hpp index beeeeb49..d9bdc9b1 100644 --- a/Graphics/GraphicsEngineD3D12/include/BufferViewD3D12Impl.hpp +++ b/Graphics/GraphicsEngineD3D12/include/BufferViewD3D12Impl.hpp @@ -30,11 +30,11 @@ /// \file /// Declaration of Diligent::BufferViewD3D12Impl class +#include "EngineD3D12ImplTraits.hpp" #include "BufferViewD3D12.h" #include "RenderDeviceD3D12.h" #include "BufferViewBase.hpp" #include "DescriptorHeap.hpp" -#include "RenderDeviceD3D12Impl.hpp" namespace Diligent { @@ -52,6 +52,8 @@ public: DescriptorHeapAllocation&& HandleAlloc, bool bIsDefaultView); + ~BufferViewD3D12Impl(); + IMPLEMENT_QUERY_INTERFACE_IN_PLACE(IID_BufferViewD3D12, TBufferViewBase) /// Implementation of IBufferViewD3D12::GetCPUDescriptorHandle(). diff --git a/Graphics/GraphicsEngineD3D12/include/CommandListD3D12Impl.hpp b/Graphics/GraphicsEngineD3D12/include/CommandListD3D12Impl.hpp index 76f264d8..57f3d0e5 100644 --- a/Graphics/GraphicsEngineD3D12/include/CommandListD3D12Impl.hpp +++ b/Graphics/GraphicsEngineD3D12/include/CommandListD3D12Impl.hpp @@ -37,7 +37,6 @@ namespace Diligent { class DeviceContextD3D12Impl; -class CommandContext; /// Command list implementation in Direct3D12 backend. class CommandListD3D12Impl final : public CommandListBase<ICommandList, RenderDeviceD3D12Impl> diff --git a/Graphics/GraphicsEngineD3D12/include/CommandQueueD3D12Impl.hpp b/Graphics/GraphicsEngineD3D12/include/CommandQueueD3D12Impl.hpp index bc1e2a67..a3652103 100644 --- a/Graphics/GraphicsEngineD3D12/include/CommandQueueD3D12Impl.hpp +++ b/Graphics/GraphicsEngineD3D12/include/CommandQueueD3D12Impl.hpp @@ -30,11 +30,12 @@ /// \file /// Declaration of Diligent::CommandQueueD3D12Impl class -#include "CommandQueueD3D12.h" -#include "ObjectBase.hpp" #include <mutex> #include <atomic> +#include "CommandQueueD3D12.h" +#include "ObjectBase.hpp" + namespace Diligent { diff --git a/Graphics/GraphicsEngineD3D12/include/D3D12Utils.h b/Graphics/GraphicsEngineD3D12/include/D3D12Utils.h index e162c969..8b3ba7e4 100644 --- a/Graphics/GraphicsEngineD3D12/include/D3D12Utils.h +++ b/Graphics/GraphicsEngineD3D12/include/D3D12Utils.h @@ -28,6 +28,7 @@ #pragma once #include "BasicTypes.h" + namespace Diligent { diff --git a/Graphics/GraphicsEngineD3D12/include/DescriptorHeap.hpp b/Graphics/GraphicsEngineD3D12/include/DescriptorHeap.hpp index 3cf8d702..aaa9c0a7 100644 --- a/Graphics/GraphicsEngineD3D12/include/DescriptorHeap.hpp +++ b/Graphics/GraphicsEngineD3D12/include/DescriptorHeap.hpp @@ -36,7 +36,7 @@ #include <string> #include <unordered_set> #include <atomic> -#include "ObjectBase.hpp" + #include "VariableSizeAllocationsManager.hpp" namespace Diligent diff --git a/Graphics/GraphicsEngineD3D12/include/DeviceContextD3D12Impl.hpp b/Graphics/GraphicsEngineD3D12/include/DeviceContextD3D12Impl.hpp index 7fb46e60..06d2e117 100644 --- a/Graphics/GraphicsEngineD3D12/include/DeviceContextD3D12Impl.hpp +++ b/Graphics/GraphicsEngineD3D12/include/DeviceContextD3D12Impl.hpp @@ -45,9 +45,14 @@ #include "BottomLevelASD3D12Impl.hpp" #include "TopLevelASD3D12Impl.hpp" + namespace Diligent { +class CommandContext; +class GraphicsContext; +class ComputeContext; + /// Device context implementation in Direct3D12 backend. class DeviceContextD3D12Impl final : public DeviceContextNextGenBase<EngineD3D12ImplTraits> { @@ -326,10 +331,10 @@ public: private: void CommitD3D12IndexBuffer(GraphicsContext& GraphCtx, VALUE_TYPE IndexType); - void CommitD3D12VertexBuffers(class GraphicsContext& GraphCtx); + void CommitD3D12VertexBuffers(GraphicsContext& GraphCtx); void CommitRenderTargets(RESOURCE_STATE_TRANSITION_MODE StateTransitionMode); void CommitViewports(); - void CommitScissorRects(class GraphicsContext& GraphCtx, bool ScissorEnable); + void CommitScissorRects(GraphicsContext& GraphCtx, bool ScissorEnable); void TransitionSubpassAttachments(Uint32 NextSubpass); void CommitSubpassRenderTargets(); void Flush(bool RequestNewCmdCtx, @@ -417,7 +422,7 @@ private: friend class SwapChainD3D12Impl; - inline class CommandContext& GetCmdContext() + inline CommandContext& GetCmdContext() { // Make sure that the number of commands in the context is at least one, // so that the context cannot be disposed by Flush() diff --git a/Graphics/GraphicsEngineD3D12/include/FenceD3D12Impl.hpp b/Graphics/GraphicsEngineD3D12/include/FenceD3D12Impl.hpp index 81437a65..28a9c1f3 100644 --- a/Graphics/GraphicsEngineD3D12/include/FenceD3D12Impl.hpp +++ b/Graphics/GraphicsEngineD3D12/include/FenceD3D12Impl.hpp @@ -30,10 +30,10 @@ /// \file /// Declaration of Diligent::FenceD3D12Impl class +#include "EngineD3D12ImplTraits.hpp" #include "FenceD3D12.h" #include "RenderDeviceD3D12.h" #include "FenceBase.hpp" -#include "RenderDeviceD3D12Impl.hpp" namespace Diligent { diff --git a/Graphics/GraphicsEngineD3D12/include/FramebufferD3D12Impl.hpp b/Graphics/GraphicsEngineD3D12/include/FramebufferD3D12Impl.hpp index 243107e4..43be86ff 100644 --- a/Graphics/GraphicsEngineD3D12/include/FramebufferD3D12Impl.hpp +++ b/Graphics/GraphicsEngineD3D12/include/FramebufferD3D12Impl.hpp @@ -30,9 +30,9 @@ /// \file /// Declaration of Diligent::FramebufferD3D12Impl class +#include "EngineD3D12ImplTraits.hpp" #include "RenderDeviceD3D12.h" #include "FramebufferBase.hpp" -#include "RenderDeviceD3D12Impl.hpp" namespace Diligent { diff --git a/Graphics/GraphicsEngineD3D12/include/GenerateMips.hpp b/Graphics/GraphicsEngineD3D12/include/GenerateMips.hpp index a2c43444..6ab189aa 100644 --- a/Graphics/GraphicsEngineD3D12/include/GenerateMips.hpp +++ b/Graphics/GraphicsEngineD3D12/include/GenerateMips.hpp @@ -51,6 +51,7 @@ namespace Diligent { + class GenerateMipsHelper { public: @@ -63,4 +64,5 @@ private: CComPtr<ID3D12PipelineState> m_pGenerateMipsLinearPSO[4]; CComPtr<ID3D12PipelineState> m_pGenerateMipsGammaPSO[4]; }; + } // namespace Diligent diff --git a/Graphics/GraphicsEngineD3D12/include/PipelineResourceAttribsD3D12.hpp b/Graphics/GraphicsEngineD3D12/include/PipelineResourceAttribsD3D12.hpp new file mode 100644 index 00000000..7f7daad5 --- /dev/null +++ b/Graphics/GraphicsEngineD3D12/include/PipelineResourceAttribsD3D12.hpp @@ -0,0 +1,135 @@ +/* + * Copyright 2019-2021 Diligent Graphics LLC + * Copyright 2015-2019 Egor Yusov + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * In no event and under no legal theory, whether in tort (including negligence), + * contract, or otherwise, unless required by applicable law (such as deliberate + * and grossly negligent acts) or agreed to in writing, shall any Contributor be + * liable for any damages, including any direct, indirect, special, incidental, + * or consequential damages of any character arising as a result of this License or + * out of the use or inability to use the software (including but not limited to damages + * for loss of goodwill, work stoppage, computer failure or malfunction, or any and + * all other commercial damages or losses), even if such Contributor has been advised + * of the possibility of such damages. + */ + +#pragma once + +/// \file +/// Declaration of Diligent::PipelineResourceAttribsD3D12 struct + +#include "BasicTypes.h" +#include "PrivateConstants.h" +#include "ShaderResourceCacheCommon.hpp" +#include "DebugUtilities.hpp" + +namespace Diligent +{ +// sizeof(ResourceAttribs) == 16, x64 +struct PipelineResourceAttribsD3D12 +{ +private: + static constexpr Uint32 _RegisterBits = 16; + static constexpr Uint32 _SRBRootIndexBits = 16; + static constexpr Uint32 _SamplerIndBits = 16; + static constexpr Uint32 _SpaceBits = 8; + static constexpr Uint32 _SigRootIndexBits = 3; + static constexpr Uint32 _SamplerAssignedBits = 1; + static constexpr Uint32 _RootParamTypeBits = 3; + + // clang-format off + static_assert((1u << _RegisterBits) >= MAX_RESOURCES_IN_SIGNATURE, "Not enough bits to store shader register"); + static_assert((1u << _SamplerIndBits) >= MAX_RESOURCES_IN_SIGNATURE, "Not enough bits to store sampler resource index"); + static_assert((1u << _RootParamTypeBits) > D3D12_ROOT_PARAMETER_TYPE_UAV + 1, "Not enough bits to store D3D12_ROOT_PARAMETER_TYPE"); + // clang-format on + +public: + static constexpr Uint32 InvalidSamplerInd = (1u << _SamplerIndBits) - 1; + static constexpr Uint32 InvalidSRBRootIndex = (1u << _SRBRootIndexBits) - 1; + static constexpr Uint32 InvalidSigRootIndex = (1u << _SigRootIndexBits) - 1; + static constexpr Uint32 InvalidRegister = (1u << _RegisterBits) - 1; + static constexpr Uint32 InvalidOffset = ~0u; + + // clang-format off +/* 0 */const Uint32 Register : _RegisterBits; // Shader register +/* 2 */const Uint32 SRBRootIndex : _SRBRootIndexBits; // Root view/table index in the SRB +/* 4 */const Uint32 SamplerInd : _SamplerIndBits; // Assigned sampler index in m_Desc.Resources and m_pResourceAttribs +/* 6 */const Uint32 Space : _SpaceBits; // Shader register space +/* 7.0*/const Uint32 SigRootIndex : _SigRootIndexBits; // Root table index for signature (static resources only) +/* 7.3*/const Uint32 ImtblSamplerAssigned : _SamplerAssignedBits; // Immutable sampler flag +/* 7.4*/const Uint32 RootParamType : _RootParamTypeBits; // Root parameter type (D3D12_ROOT_PARAMETER_TYPE) +/* 8 */const Uint32 SigOffsetFromTableStart; // Offset in the root table for signature (static only) +/* 12 */const Uint32 SRBOffsetFromTableStart; // Offset in the root table for SRB +/* 16 */ + // clang-format on + + PipelineResourceAttribsD3D12(Uint32 _Register, + Uint32 _Space, + Uint32 _SamplerInd, + Uint32 _SRBRootIndex, + Uint32 _SRBOffsetFromTableStart, + Uint32 _SigRootIndex, + Uint32 _SigOffsetFromTableStart, + bool _ImtblSamplerAssigned, + D3D12_ROOT_PARAMETER_TYPE _RootParamType) noexcept : + // clang-format off + Register {_Register }, + SRBRootIndex {_SRBRootIndex }, + SamplerInd {_SamplerInd }, + SigRootIndex {_SigRootIndex }, + Space {_Space }, + ImtblSamplerAssigned {_ImtblSamplerAssigned ? 1u : 0u }, + RootParamType {static_cast<Uint32>(_RootParamType)}, + SigOffsetFromTableStart{_SigOffsetFromTableStart }, + SRBOffsetFromTableStart{_SRBOffsetFromTableStart } + // clang-format on + { + VERIFY(Register == _Register, "Shader register (", _Register, ") exceeds maximum representable value"); + VERIFY(SRBRootIndex == _SRBRootIndex, "SRB Root index (", _SRBRootIndex, ") exceeds maximum representable value"); + VERIFY(SigRootIndex == _SigRootIndex, "Signature Root index (", _SigRootIndex, ") exceeds maximum representable value"); + VERIFY(SamplerInd == _SamplerInd, "Sampler index (", _SamplerInd, ") exceeds maximum representable value"); + VERIFY(Space == _Space, "Space (", _Space, ") exceeds maximum representable value"); + VERIFY(GetD3D12RootParamType() == _RootParamType, "Not enough bits to represent root parameter type"); + } + + bool IsImmutableSamplerAssigned() const + { + return ImtblSamplerAssigned != 0; + } + bool IsCombinedWithSampler() const + { + return SamplerInd != InvalidSamplerInd; + } + + Uint32 RootIndex(ResourceCacheContentType Type) const + { + return Type == ResourceCacheContentType::SRB ? SRBRootIndex : SigRootIndex; + } + Uint32 OffsetFromTableStart(ResourceCacheContentType Type) const + { + return Type == ResourceCacheContentType::SRB ? SRBOffsetFromTableStart : SigOffsetFromTableStart; + } + + D3D12_ROOT_PARAMETER_TYPE GetD3D12RootParamType() const { return static_cast<D3D12_ROOT_PARAMETER_TYPE>(RootParamType); } + + bool IsRootView() const + { + return (GetD3D12RootParamType() == D3D12_ROOT_PARAMETER_TYPE_CBV || + GetD3D12RootParamType() == D3D12_ROOT_PARAMETER_TYPE_SRV || + GetD3D12RootParamType() == D3D12_ROOT_PARAMETER_TYPE_UAV); + } +}; + +} // namespace Diligent diff --git a/Graphics/GraphicsEngineD3D12/include/PipelineResourceSignatureD3D12Impl.hpp b/Graphics/GraphicsEngineD3D12/include/PipelineResourceSignatureD3D12Impl.hpp index d68385f3..fba59c35 100644 --- a/Graphics/GraphicsEngineD3D12/include/PipelineResourceSignatureD3D12Impl.hpp +++ b/Graphics/GraphicsEngineD3D12/include/PipelineResourceSignatureD3D12Impl.hpp @@ -33,17 +33,22 @@ #include <array> #include "EngineD3D12ImplTraits.hpp" +#include "PipelineResourceAttribsD3D12.hpp" #include "PipelineResourceSignatureBase.hpp" #include "SRBMemoryAllocator.hpp" #include "RootParamsManager.hpp" -#include "ShaderResourceCacheD3D12.hpp" #include "ResourceBindingMap.hpp" +// ShaderVariableManagerD3D12, ShaderResourceCacheD3D12, and ShaderResourceBindingD3D12Impl +// are required by PipelineResourceSignatureBase +#include "ShaderResourceCacheD3D12.hpp" +#include "ShaderVariableManagerD3D12.hpp" +#include "ShaderResourceBindingD3D12Impl.hpp" + namespace Diligent { class CommandContext; -class ShaderVariableManagerD3D12; struct D3DShaderResourceAttribs; /// Implementation of the Diligent::PipelineResourceSignatureD3D12Impl class @@ -58,92 +63,7 @@ public: bool bIsDeviceInternal = false); ~PipelineResourceSignatureD3D12Impl(); - // sizeof(ResourceAttribs) == 16, x64 - struct ResourceAttribs - { - private: - static constexpr Uint32 _RegisterBits = 16; - static constexpr Uint32 _SRBRootIndexBits = 16; - static constexpr Uint32 _SamplerIndBits = 16; - static constexpr Uint32 _SpaceBits = 8; - static constexpr Uint32 _SigRootIndexBits = 3; - static constexpr Uint32 _SamplerAssignedBits = 1; - static constexpr Uint32 _RootParamTypeBits = 3; - - static_assert((1u << _RegisterBits) >= MAX_RESOURCES_IN_SIGNATURE, "Not enough bits to store shader register"); - static_assert((1u << _SamplerIndBits) >= MAX_RESOURCES_IN_SIGNATURE, "Not enough bits to store sampler resource index"); - static_assert((1u << _RootParamTypeBits) > D3D12_ROOT_PARAMETER_TYPE_UAV + 1, "Not enough bits to store D3D12_ROOT_PARAMETER_TYPE"); - - public: - static constexpr Uint32 InvalidSamplerInd = (1u << _SamplerIndBits) - 1; - static constexpr Uint32 InvalidSRBRootIndex = (1u << _SRBRootIndexBits) - 1; - static constexpr Uint32 InvalidSigRootIndex = (1u << _SigRootIndexBits) - 1; - static constexpr Uint32 InvalidRegister = (1u << _RegisterBits) - 1; - static constexpr Uint32 InvalidOffset = ~0u; - - // clang-format off -/* 0 */const Uint32 Register : _RegisterBits; // Shader register -/* 2 */const Uint32 SRBRootIndex : _SRBRootIndexBits; // Root view/table index in the SRB -/* 4 */const Uint32 SamplerInd : _SamplerIndBits; // Assigned sampler index in m_Desc.Resources and m_pResourceAttribs -/* 6 */const Uint32 Space : _SpaceBits; // Shader register space -/* 7.0*/const Uint32 SigRootIndex : _SigRootIndexBits; // Root table index for signature (static resources only) -/* 7.3*/const Uint32 ImtblSamplerAssigned : _SamplerAssignedBits; // Immutable sampler flag -/* 7.4*/const Uint32 RootParamType : _RootParamTypeBits; // Root parameter type (D3D12_ROOT_PARAMETER_TYPE) -/* 8 */const Uint32 SigOffsetFromTableStart; // Offset in the root table for signature (static only) -/* 12 */const Uint32 SRBOffsetFromTableStart; // Offset in the root table for SRB -/* 16 */ - // clang-format on - - ResourceAttribs(Uint32 _Register, - Uint32 _Space, - Uint32 _SamplerInd, - Uint32 _SRBRootIndex, - Uint32 _SRBOffsetFromTableStart, - Uint32 _SigRootIndex, - Uint32 _SigOffsetFromTableStart, - bool _ImtblSamplerAssigned, - D3D12_ROOT_PARAMETER_TYPE _RootParamType) noexcept : - // clang-format off - Register {_Register }, - SRBRootIndex {_SRBRootIndex }, - SamplerInd {_SamplerInd }, - SigRootIndex {_SigRootIndex }, - Space {_Space }, - ImtblSamplerAssigned {_ImtblSamplerAssigned ? 1u : 0u }, - RootParamType {static_cast<Uint32>(_RootParamType)}, - SigOffsetFromTableStart{_SigOffsetFromTableStart }, - SRBOffsetFromTableStart{_SRBOffsetFromTableStart } - // clang-format on - { - VERIFY(Register == _Register, "Shader register (", _Register, ") exceeds maximum representable value"); - VERIFY(SRBRootIndex == _SRBRootIndex, "SRB Root index (", _SRBRootIndex, ") exceeds maximum representable value"); - VERIFY(SigRootIndex == _SigRootIndex, "Signature Root index (", _SigRootIndex, ") exceeds maximum representable value"); - VERIFY(SamplerInd == _SamplerInd, "Sampler index (", _SamplerInd, ") exceeds maximum representable value"); - VERIFY(Space == _Space, "Space (", _Space, ") exceeds maximum representable value"); - VERIFY(GetD3D12RootParamType() == _RootParamType, "Not enough bits to represent root parameter type"); - } - - bool IsImmutableSamplerAssigned() const { return ImtblSamplerAssigned != 0; } - bool IsCombinedWithSampler() const { return SamplerInd != InvalidSamplerInd; } - - Uint32 RootIndex(ResourceCacheContentType Type) const - { - return Type == ResourceCacheContentType::SRB ? SRBRootIndex : SigRootIndex; - } - Uint32 OffsetFromTableStart(ResourceCacheContentType Type) const - { - return Type == ResourceCacheContentType::SRB ? SRBOffsetFromTableStart : SigOffsetFromTableStart; - } - - D3D12_ROOT_PARAMETER_TYPE GetD3D12RootParamType() const { return static_cast<D3D12_ROOT_PARAMETER_TYPE>(RootParamType); } - - bool IsRootView() const - { - return (GetD3D12RootParamType() == D3D12_ROOT_PARAMETER_TYPE_CBV || - GetD3D12RootParamType() == D3D12_ROOT_PARAMETER_TYPE_SRV || - GetD3D12RootParamType() == D3D12_ROOT_PARAMETER_TYPE_UAV); - } - }; + using ResourceAttribs = PipelineResourceAttribsD3D12; const ResourceAttribs& GetResourceAttribs(Uint32 ResIndex) const { @@ -210,19 +130,6 @@ public: return m_RootParams.GetNumRootViews(); } - virtual void DILIGENT_CALL_TYPE CreateShaderResourceBinding(IShaderResourceBinding** ppShaderResourceBinding, - bool InitStaticResources) override final; - - virtual IShaderResourceVariable* DILIGENT_CALL_TYPE GetStaticVariableByName(SHADER_TYPE ShaderType, const Char* Name) override final; - - virtual IShaderResourceVariable* DILIGENT_CALL_TYPE GetStaticVariableByIndex(SHADER_TYPE ShaderType, Uint32 Index) override final; - - virtual Uint32 DILIGENT_CALL_TYPE GetStaticVariableCount(SHADER_TYPE ShaderType) const override final; - - virtual void DILIGENT_CALL_TYPE BindStaticResources(Uint32 ShaderFlags, - IResourceMapping* pResourceMapping, - Uint32 Flags) override final; - virtual bool DILIGENT_CALL_TYPE IsCompatibleWith(const IPipelineResourceSignature* pPRS) const override final { if (pPRS == nullptr) diff --git a/Graphics/GraphicsEngineD3D12/include/PipelineStateD3D12Impl.hpp b/Graphics/GraphicsEngineD3D12/include/PipelineStateD3D12Impl.hpp index c8f35d36..8f8ee1cc 100644 --- a/Graphics/GraphicsEngineD3D12/include/PipelineStateD3D12Impl.hpp +++ b/Graphics/GraphicsEngineD3D12/include/PipelineStateD3D12Impl.hpp @@ -32,12 +32,12 @@ #include <vector> +#include "EngineD3D12ImplTraits.hpp" #include "RenderDeviceD3D12.h" #include "PipelineStateD3D12.h" -#include "PipelineResourceSignatureD3D12Impl.hpp" #include "PipelineStateBase.hpp" #include "RootSignature.hpp" -#include "RenderDeviceD3D12Impl.hpp" +#include "PipelineResourceSignatureD3D12Impl.hpp" // Requiured by PipelineStateBase namespace Diligent { diff --git a/Graphics/GraphicsEngineD3D12/include/QueryD3D12Impl.hpp b/Graphics/GraphicsEngineD3D12/include/QueryD3D12Impl.hpp index b39b37c5..2be65eaf 100644 --- a/Graphics/GraphicsEngineD3D12/include/QueryD3D12Impl.hpp +++ b/Graphics/GraphicsEngineD3D12/include/QueryD3D12Impl.hpp @@ -32,9 +32,10 @@ #include <array> +#include "EngineD3D12ImplTraits.hpp" #include "QueryD3D12.h" #include "QueryBase.hpp" -#include "RenderDeviceD3D12Impl.hpp" +#include "QueryManagerD3D12.hpp" namespace Diligent { @@ -58,10 +59,7 @@ public: virtual bool DILIGENT_CALL_TYPE GetData(void* pData, Uint32 DataSize, bool AutoInvalidate) override final; /// Implementation of IQueryD3D12::GetD3D12QueryHeap(). - virtual ID3D12QueryHeap* DILIGENT_CALL_TYPE GetD3D12QueryHeap() override final - { - return m_pDevice->GetQueryManager().GetQueryHeap(m_Desc.Type); - } + virtual ID3D12QueryHeap* DILIGENT_CALL_TYPE GetD3D12QueryHeap() override final; /// Implementation of IQueryD3D12::GetQueryHeapIndex(). virtual Uint32 DILIGENT_CALL_TYPE GetQueryHeapIndex(Uint32 QueryId) const override final diff --git a/Graphics/GraphicsEngineD3D12/include/RenderPassD3D12Impl.hpp b/Graphics/GraphicsEngineD3D12/include/RenderPassD3D12Impl.hpp index 750a3381..e8967046 100644 --- a/Graphics/GraphicsEngineD3D12/include/RenderPassD3D12Impl.hpp +++ b/Graphics/GraphicsEngineD3D12/include/RenderPassD3D12Impl.hpp @@ -30,9 +30,9 @@ /// \file /// Declaration of Diligent::RenderPassD3D12Impl class +#include "EngineD3D12ImplTraits.hpp" #include "RenderDeviceD3D12.h" #include "RenderPassBase.hpp" -#include "RenderDeviceD3D12Impl.hpp" namespace Diligent { diff --git a/Graphics/GraphicsEngineD3D12/include/RootSignature.hpp b/Graphics/GraphicsEngineD3D12/include/RootSignature.hpp index 497cf11d..45ec655b 100644 --- a/Graphics/GraphicsEngineD3D12/include/RootSignature.hpp +++ b/Graphics/GraphicsEngineD3D12/include/RootSignature.hpp @@ -51,9 +51,9 @@ #include <unordered_map> #include <memory> -#include "PipelineResourceSignatureD3D12Impl.hpp" #include "PrivateConstants.h" #include "ShaderResources.hpp" +#include "ObjectBase.hpp" #include "ResourceBindingMap.hpp" namespace Diligent @@ -61,6 +61,7 @@ namespace Diligent class RenderDeviceD3D12Impl; class RootSignatureCacheD3D12; +class PipelineResourceSignatureD3D12Impl; /// Implementation of the Diligent::RootSignature class class RootSignatureD3D12 final : public ObjectBase<IObject> diff --git a/Graphics/GraphicsEngineD3D12/include/SamplerD3D12Impl.hpp b/Graphics/GraphicsEngineD3D12/include/SamplerD3D12Impl.hpp index 19c11df9..46940a78 100644 --- a/Graphics/GraphicsEngineD3D12/include/SamplerD3D12Impl.hpp +++ b/Graphics/GraphicsEngineD3D12/include/SamplerD3D12Impl.hpp @@ -30,11 +30,11 @@ /// \file /// Declaration of Diligent::SamplerD3D12Impl class +#include "EngineD3D12ImplTraits.hpp" #include "SamplerD3D12.h" #include "RenderDeviceD3D12.h" #include "SamplerBase.hpp" #include "DescriptorHeap.hpp" -#include "RenderDeviceD3D12Impl.hpp" namespace Diligent { diff --git a/Graphics/GraphicsEngineD3D12/include/ShaderBindingTableD3D12Impl.hpp b/Graphics/GraphicsEngineD3D12/include/ShaderBindingTableD3D12Impl.hpp index ced783ba..960e69e7 100644 --- a/Graphics/GraphicsEngineD3D12/include/ShaderBindingTableD3D12Impl.hpp +++ b/Graphics/GraphicsEngineD3D12/include/ShaderBindingTableD3D12Impl.hpp @@ -30,13 +30,11 @@ /// \file /// Declaration of Diligent::ShaderBindingTableD3D12Impl class +#include "EngineD3D12ImplTraits.hpp" #include "ShaderBindingTableD3D12.h" -#include "RenderDeviceD3D12.h" #include "ShaderBindingTableBase.hpp" #include "TopLevelASD3D12Impl.hpp" #include "D3D12ResourceBase.hpp" -#include "RenderDeviceD3D12Impl.hpp" -#include "PipelineStateD3D12Impl.hpp" namespace Diligent { diff --git a/Graphics/GraphicsEngineD3D12/include/ShaderD3D12Impl.hpp b/Graphics/GraphicsEngineD3D12/include/ShaderD3D12Impl.hpp index cbdb0df3..711b1543 100644 --- a/Graphics/GraphicsEngineD3D12/include/ShaderD3D12Impl.hpp +++ b/Graphics/GraphicsEngineD3D12/include/ShaderD3D12Impl.hpp @@ -30,11 +30,11 @@ /// \file /// Declaration of Diligent::ShaderD3D12Impl class +#include "EngineD3D12ImplTraits.hpp" #include "RenderDeviceD3D12.h" #include "ShaderD3D12.h" #include "ShaderBase.hpp" #include "ShaderD3DBase.hpp" -#include "RenderDeviceD3D12Impl.hpp" #include "ShaderResourcesD3D12.hpp" namespace Diligent diff --git a/Graphics/GraphicsEngineD3D12/include/ShaderResourceBindingD3D12Impl.hpp b/Graphics/GraphicsEngineD3D12/include/ShaderResourceBindingD3D12Impl.hpp index 105f6e8d..75009356 100644 --- a/Graphics/GraphicsEngineD3D12/include/ShaderResourceBindingD3D12Impl.hpp +++ b/Graphics/GraphicsEngineD3D12/include/ShaderResourceBindingD3D12Impl.hpp @@ -30,16 +30,19 @@ /// \file /// Declaration of Diligent::ShaderResourceBindingD3D12Impl class -#include "ShaderResourceBindingD3D12.h" -#include "RenderDeviceD3D12.h" +#include "EngineD3D12ImplTraits.hpp" #include "ShaderResourceBindingBase.hpp" +#include "ShaderResourceBindingD3D12.h" + +// ShaderVariableManagerD3D12 and ShaderResourceCacheD3D12 are required by ShaderResourceBindingBase +#include "ShaderVariableManagerD3D12.hpp" #include "ShaderResourceCacheD3D12.hpp" -#include "ShaderVariableD3D12.hpp" -#include "PipelineResourceSignatureD3D12Impl.hpp" namespace Diligent { +class PipelineResourceSignatureD3D12Impl; + /// Implementation of the Diligent::IShaderResourceBindingD3D12 interface // sizeof(ShaderResourceBindingD3D12Impl) == 96 (x64, msvc, Release) class ShaderResourceBindingD3D12Impl final : public ShaderResourceBindingBase<EngineD3D12ImplTraits> diff --git a/Graphics/GraphicsEngineD3D12/include/ShaderResourceCacheD3D12.hpp b/Graphics/GraphicsEngineD3D12/include/ShaderResourceCacheD3D12.hpp index 4177fcc1..683846c9 100644 --- a/Graphics/GraphicsEngineD3D12/include/ShaderResourceCacheD3D12.hpp +++ b/Graphics/GraphicsEngineD3D12/include/ShaderResourceCacheD3D12.hpp @@ -105,8 +105,8 @@ #include <array> #include <memory> -#include "DescriptorHeap.hpp" #include "Shader.h" +#include "DescriptorHeap.hpp" #include "RootParamsManager.hpp" #include "ShaderResourceCacheCommon.hpp" diff --git a/Graphics/GraphicsEngineD3D12/include/ShaderVariableD3D12.hpp b/Graphics/GraphicsEngineD3D12/include/ShaderVariableManagerD3D12.hpp index ddcb29bf..a67b977c 100644 --- a/Graphics/GraphicsEngineD3D12/include/ShaderVariableD3D12.hpp +++ b/Graphics/GraphicsEngineD3D12/include/ShaderVariableManagerD3D12.hpp @@ -60,13 +60,14 @@ #include "ShaderResourceVariableD3D.h" #include "ShaderResourceVariableBase.hpp" -#include "ShaderResourceCacheD3D12.hpp" -#include "PipelineResourceSignatureD3D12Impl.hpp" +#include "PipelineResourceAttribsD3D12.hpp" namespace Diligent { class ShaderVariableD3D12Impl; +class ShaderResourceCacheD3D12; +class PipelineResourceSignatureD3D12Impl; // sizeof(ShaderVariableManagerD3D12) == 40 (x64, msvc, Release) class ShaderVariableManagerD3D12 @@ -111,20 +112,13 @@ public: private: friend ShaderVariableD3D12Impl; - using ResourceAttribs = PipelineResourceSignatureD3D12Impl::ResourceAttribs; + using ResourceAttribs = PipelineResourceAttribsD3D12; Uint32 GetVariableIndex(const ShaderVariableD3D12Impl& Variable); - const PipelineResourceDesc& GetResourceDesc(Uint32 Index) const - { - VERIFY_EXPR(m_pSignature != nullptr); - return m_pSignature->GetResourceDesc(Index); - } - const ResourceAttribs& GetResourceAttribs(Uint32 Index) const - { - VERIFY_EXPR(m_pSignature != nullptr); - return m_pSignature->GetResourceAttribs(Index); - } + // These methods can't be defined in the header due to dependency on PipelineResourceSignatureD3D12Impl + const PipelineResourceDesc& GetResourceDesc(Uint32 Index) const; + const ResourceAttribs& GetResourceAttribs(Uint32 Index) const; template <typename HandlerType> static void ProcessSignatureResources(const PipelineResourceSignatureD3D12Impl& Signature, @@ -211,10 +205,8 @@ public: return m_ParentManager.GetVariableIndex(*this); } - virtual bool DILIGENT_CALL_TYPE IsBound(Uint32 ArrayIndex) const override final - { - return m_ParentManager.m_pSignature->IsBound(ArrayIndex, m_ResIndex, m_ParentManager.m_ResourceCache); - } + // This method can't be defined in the header due to dependency on PipelineResourceSignatureD3D12Impl + virtual bool DILIGENT_CALL_TYPE IsBound(Uint32 ArrayIndex) const override final; virtual void DILIGENT_CALL_TYPE GetHLSLResourceDesc(HLSLShaderResourceDesc& HLSLResDesc) const override final { @@ -224,13 +216,11 @@ public: const PipelineResourceDesc& GetDesc() const { return m_ParentManager.GetResourceDesc(m_ResIndex); } - void BindResource(IDeviceObject* pObj, Uint32 ArrayIndex) const - { - m_ParentManager.m_pSignature->BindResource(pObj, ArrayIndex, m_ResIndex, m_ParentManager.m_ResourceCache); - } + // This method can't be defined in the header due to dependency on PipelineResourceSignatureD3D12Impl + void BindResource(IDeviceObject* pObj, Uint32 ArrayIndex) const; private: - using ResourceAttribs = PipelineResourceSignatureD3D12Impl::ResourceAttribs; + using ResourceAttribs = PipelineResourceAttribsD3D12; const ResourceAttribs& GetAttribs() const { return m_ParentManager.GetResourceAttribs(m_ResIndex); } private: diff --git a/Graphics/GraphicsEngineD3D12/include/TextureD3D12Impl.hpp b/Graphics/GraphicsEngineD3D12/include/TextureD3D12Impl.hpp index 8a911fd3..526a7610 100644 --- a/Graphics/GraphicsEngineD3D12/include/TextureD3D12Impl.hpp +++ b/Graphics/GraphicsEngineD3D12/include/TextureD3D12Impl.hpp @@ -30,12 +30,11 @@ /// \file /// Declaration of Diligent::TextureD3D12Impl class +#include "EngineD3D12ImplTraits.hpp" #include "TextureD3D12.h" -#include "RenderDeviceD3D12.h" #include "TextureBase.hpp" #include "TextureViewD3D12Impl.hpp" #include "D3D12ResourceBase.hpp" -#include "RenderDeviceD3D12Impl.hpp" namespace Diligent { diff --git a/Graphics/GraphicsEngineD3D12/include/TextureViewD3D12Impl.hpp b/Graphics/GraphicsEngineD3D12/include/TextureViewD3D12Impl.hpp index 6fa2bdb2..08a48045 100644 --- a/Graphics/GraphicsEngineD3D12/include/TextureViewD3D12Impl.hpp +++ b/Graphics/GraphicsEngineD3D12/include/TextureViewD3D12Impl.hpp @@ -30,11 +30,10 @@ /// \file /// Declaration of Diligent::TextureViewD3D12Impl class +#include "EngineD3D12ImplTraits.hpp" #include "TextureViewD3D12.h" -#include "RenderDeviceD3D12.h" #include "TextureViewBase.hpp" #include "DescriptorHeap.hpp" -#include "RenderDeviceD3D12Impl.hpp" namespace Diligent { diff --git a/Graphics/GraphicsEngineD3D12/include/TopLevelASD3D12Impl.hpp b/Graphics/GraphicsEngineD3D12/include/TopLevelASD3D12Impl.hpp index a62bd7ce..8c45e87f 100644 --- a/Graphics/GraphicsEngineD3D12/include/TopLevelASD3D12Impl.hpp +++ b/Graphics/GraphicsEngineD3D12/include/TopLevelASD3D12Impl.hpp @@ -30,12 +30,12 @@ /// \file /// Declaration of Diligent::TopLevelASD3D12Impl class +#include "EngineD3D12ImplTraits.hpp" #include "TopLevelASD3D12.h" -#include "RenderDeviceD3D12.h" #include "TopLevelASBase.hpp" -#include "BottomLevelASD3D12Impl.hpp" #include "D3D12ResourceBase.hpp" -#include "RenderDeviceD3D12Impl.hpp" +#include "DescriptorHeap.hpp" +#include "BottomLevelASD3D12Impl.hpp" // Required by TopLevelASBase namespace Diligent { diff --git a/Graphics/GraphicsEngineD3D12/src/BottomLevelASD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/BottomLevelASD3D12Impl.cpp index bb8e2293..8f23a7e9 100644 --- a/Graphics/GraphicsEngineD3D12/src/BottomLevelASD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/BottomLevelASD3D12Impl.cpp @@ -26,6 +26,7 @@ */ #include "pch.h" + #include "BottomLevelASD3D12Impl.hpp" #include "RenderDeviceD3D12Impl.hpp" #include "D3D12TypeConversions.hpp" diff --git a/Graphics/GraphicsEngineD3D12/src/BufferD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/BufferD3D12Impl.cpp index db86297d..1ac066fc 100644 --- a/Graphics/GraphicsEngineD3D12/src/BufferD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/BufferD3D12Impl.cpp @@ -26,11 +26,11 @@ */ #include "pch.h" + #include "BufferD3D12Impl.hpp" #include "RenderDeviceD3D12Impl.hpp" #include "DeviceContextD3D12Impl.hpp" #include "D3D12TypeConversions.hpp" -#include "BufferViewD3D12Impl.hpp" #include "GraphicsAccessories.hpp" #include "DXGITypeConversions.hpp" #include "EngineMemory.h" diff --git a/Graphics/GraphicsEngineD3D12/src/BufferViewD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/BufferViewD3D12Impl.cpp index ee40368c..51edfbc3 100644 --- a/Graphics/GraphicsEngineD3D12/src/BufferViewD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/BufferViewD3D12Impl.cpp @@ -28,6 +28,7 @@ #include "pch.h" #include "BufferViewD3D12Impl.hpp" #include "BufferD3D12Impl.hpp" +#include "RenderDeviceD3D12Impl.hpp" namespace Diligent { @@ -52,4 +53,8 @@ BufferViewD3D12Impl::BufferViewD3D12Impl(IReferenceCounters* pRefCounters { } +BufferViewD3D12Impl::~BufferViewD3D12Impl() +{ +} + } // namespace Diligent diff --git a/Graphics/GraphicsEngineD3D12/src/CommandContext.cpp b/Graphics/GraphicsEngineD3D12/src/CommandContext.cpp index e8617466..8104bcd8 100644 --- a/Graphics/GraphicsEngineD3D12/src/CommandContext.cpp +++ b/Graphics/GraphicsEngineD3D12/src/CommandContext.cpp @@ -26,8 +26,11 @@ */ #include "pch.h" + #include "d3dx12_win.h" + #include "CommandContext.hpp" +#include "RenderDeviceD3D12Impl.hpp" #include "TextureD3D12Impl.hpp" #include "BufferD3D12Impl.hpp" #include "BottomLevelASD3D12Impl.hpp" diff --git a/Graphics/GraphicsEngineD3D12/src/FramebufferD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/FramebufferD3D12Impl.cpp index 486e1913..d99a34fa 100644 --- a/Graphics/GraphicsEngineD3D12/src/FramebufferD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/FramebufferD3D12Impl.cpp @@ -28,6 +28,7 @@ #include "pch.h" #include "FramebufferD3D12Impl.hpp" +#include "RenderDeviceD3D12Impl.hpp" namespace Diligent { diff --git a/Graphics/GraphicsEngineD3D12/src/PipelineResourceSignatureD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/PipelineResourceSignatureD3D12Impl.cpp index 27e51fae..79e82979 100644 --- a/Graphics/GraphicsEngineD3D12/src/PipelineResourceSignatureD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/PipelineResourceSignatureD3D12Impl.cpp @@ -31,7 +31,6 @@ #include "PipelineResourceSignatureD3D12Impl.hpp" #include "ShaderResourceCacheD3D12.hpp" -#include "ShaderVariableD3D12.hpp" #include "RenderDeviceD3D12Impl.hpp" #include "ShaderResourceBindingD3D12Impl.hpp" #include "BufferD3D12Impl.hpp" @@ -419,34 +418,6 @@ bool PipelineResourceSignatureD3D12Impl::IsCompatibleWith(const PipelineResource return true; } -void PipelineResourceSignatureD3D12Impl::CreateShaderResourceBinding(IShaderResourceBinding** ppShaderResourceBinding, - bool InitStaticResources) -{ - CreateShaderResourceBindingImpl(ppShaderResourceBinding, InitStaticResources); -} - -Uint32 PipelineResourceSignatureD3D12Impl::GetStaticVariableCount(SHADER_TYPE ShaderType) const -{ - return GetStaticVariableCountImpl(ShaderType); -} - -IShaderResourceVariable* PipelineResourceSignatureD3D12Impl::GetStaticVariableByName(SHADER_TYPE ShaderType, const Char* Name) -{ - return GetStaticVariableByNameImpl(ShaderType, Name); -} - -IShaderResourceVariable* PipelineResourceSignatureD3D12Impl::GetStaticVariableByIndex(SHADER_TYPE ShaderType, Uint32 Index) -{ - return GetStaticVariableByIndexImpl(ShaderType, Index); -} - -void PipelineResourceSignatureD3D12Impl::BindStaticResources(Uint32 ShaderFlags, - IResourceMapping* pResMapping, - Uint32 Flags) -{ - BindStaticResourcesImpl(ShaderFlags, pResMapping, Flags); -} - size_t PipelineResourceSignatureD3D12Impl::CalculateHash() const { if (m_Desc.NumResources == 0 && m_Desc.NumImmutableSamplers == 0) diff --git a/Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp index 94e8b8b4..2a23c89e 100644 --- a/Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp @@ -39,14 +39,14 @@ #include "PipelineStateD3D12Impl.hpp" #include "ShaderD3D12Impl.hpp" -#include "D3D12TypeConversions.hpp" #include "RenderDeviceD3D12Impl.hpp" +#include "ShaderResourceBindingD3D12Impl.hpp" +#include "D3D12TypeConversions.hpp" #include "DXGITypeConversions.hpp" #include "CommandContext.hpp" #include "EngineMemory.h" #include "StringTools.hpp" #include "DynamicLinearAllocator.hpp" -#include "ShaderResourceBindingD3D12Impl.hpp" #include "DXBCUtils.hpp" #include "DXCompiler.hpp" #include "dxc/dxcapi.h" diff --git a/Graphics/GraphicsEngineD3D12/src/QueryD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/QueryD3D12Impl.cpp index bf5ed6dd..236a2026 100644 --- a/Graphics/GraphicsEngineD3D12/src/QueryD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/QueryD3D12Impl.cpp @@ -194,4 +194,11 @@ bool QueryD3D12Impl::GetData(void* pData, Uint32 DataSize, bool AutoInvalidate) } } +ID3D12QueryHeap* QueryD3D12Impl::GetD3D12QueryHeap() +{ + // This implementation can't be in the header because it requires + // definition of RenderDeviceD3D12Impl + return m_pDevice->GetQueryManager().GetQueryHeap(m_Desc.Type); +} + } // namespace Diligent diff --git a/Graphics/GraphicsEngineD3D12/src/RenderPassD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/RenderPassD3D12Impl.cpp index 3991ab97..30e7e038 100644 --- a/Graphics/GraphicsEngineD3D12/src/RenderPassD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/RenderPassD3D12Impl.cpp @@ -28,6 +28,7 @@ #include "pch.h" #include "RenderPassD3D12Impl.hpp" +#include "RenderDeviceD3D12Impl.hpp" namespace Diligent { diff --git a/Graphics/GraphicsEngineD3D12/src/RootSignature.cpp b/Graphics/GraphicsEngineD3D12/src/RootSignature.cpp index 44105f16..3f8ce2b6 100644 --- a/Graphics/GraphicsEngineD3D12/src/RootSignature.cpp +++ b/Graphics/GraphicsEngineD3D12/src/RootSignature.cpp @@ -32,6 +32,7 @@ #include "RenderDeviceD3D12Impl.hpp" #include "D3D12TypeConversions.hpp" #include "HashUtils.hpp" +#include "PipelineResourceSignatureD3D12Impl.hpp" namespace Diligent { diff --git a/Graphics/GraphicsEngineD3D12/src/SamplerD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/SamplerD3D12Impl.cpp index 0821787b..887dc7b6 100644 --- a/Graphics/GraphicsEngineD3D12/src/SamplerD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/SamplerD3D12Impl.cpp @@ -26,6 +26,7 @@ */ #include "pch.h" + #include "SamplerD3D12Impl.hpp" #include "RenderDeviceD3D12Impl.hpp" #include "D3D12TypeConversions.hpp" diff --git a/Graphics/GraphicsEngineD3D12/src/ShaderBindingTableD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/ShaderBindingTableD3D12Impl.cpp index ed04481f..2f5b89a4 100644 --- a/Graphics/GraphicsEngineD3D12/src/ShaderBindingTableD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/ShaderBindingTableD3D12Impl.cpp @@ -26,6 +26,7 @@ */ #include "pch.h" + #include "ShaderBindingTableD3D12Impl.hpp" #include "RenderDeviceD3D12Impl.hpp" #include "DeviceContextD3D12Impl.hpp" diff --git a/Graphics/GraphicsEngineD3D12/src/ShaderResourceBindingD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/ShaderResourceBindingD3D12Impl.cpp index 0b6adc73..69d95100 100644 --- a/Graphics/GraphicsEngineD3D12/src/ShaderResourceBindingD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/ShaderResourceBindingD3D12Impl.cpp @@ -26,9 +26,11 @@ */ #include "pch.h" + #include "ShaderResourceBindingD3D12Impl.hpp" #include "RenderDeviceD3D12Impl.hpp" #include "FixedLinearAllocator.hpp" +#include "PipelineResourceSignatureD3D12Impl.hpp" namespace Diligent { diff --git a/Graphics/GraphicsEngineD3D12/src/ShaderResourceCacheD3D12.cpp b/Graphics/GraphicsEngineD3D12/src/ShaderResourceCacheD3D12.cpp index c1cbe819..30c10b54 100644 --- a/Graphics/GraphicsEngineD3D12/src/ShaderResourceCacheD3D12.cpp +++ b/Graphics/GraphicsEngineD3D12/src/ShaderResourceCacheD3D12.cpp @@ -28,13 +28,13 @@ #include "pch.h" #include "ShaderResourceCacheD3D12.hpp" -#include "BufferD3D12Impl.hpp" -#include "CommandContext.hpp" +#include "RenderDeviceD3D12Impl.hpp" #include "BufferD3D12Impl.hpp" #include "BufferViewD3D12Impl.hpp" #include "TextureD3D12Impl.hpp" #include "TextureViewD3D12Impl.hpp" #include "TopLevelASD3D12Impl.hpp" +#include "CommandContext.hpp" namespace Diligent { diff --git a/Graphics/GraphicsEngineD3D12/src/ShaderVariableD3D12.cpp b/Graphics/GraphicsEngineD3D12/src/ShaderVariableManagerD3D12.cpp index af9ba39a..1e201a4a 100644 --- a/Graphics/GraphicsEngineD3D12/src/ShaderVariableD3D12.cpp +++ b/Graphics/GraphicsEngineD3D12/src/ShaderVariableManagerD3D12.cpp @@ -27,8 +27,10 @@ #include "pch.h" -#include "ShaderVariableD3D12.hpp" +#include "ShaderVariableManagerD3D12.hpp" #include "RenderDeviceD3D12Impl.hpp" +#include "ShaderResourceCacheD3D12.hpp" +#include "PipelineResourceSignatureD3D12Impl.hpp" namespace Diligent { @@ -137,6 +139,19 @@ void ShaderVariableManagerD3D12::Destroy(IMemoryAllocator& Allocator) } } +const PipelineResourceDesc& ShaderVariableManagerD3D12::GetResourceDesc(Uint32 Index) const +{ + VERIFY_EXPR(m_pSignature != nullptr); + return m_pSignature->GetResourceDesc(Index); +} + +const ShaderVariableManagerD3D12::ResourceAttribs& ShaderVariableManagerD3D12::GetResourceAttribs(Uint32 Index) const +{ + VERIFY_EXPR(m_pSignature != nullptr); + return m_pSignature->GetResourceAttribs(Index); +} + + ShaderVariableD3D12Impl* ShaderVariableManagerD3D12::GetVariable(const Char* Name) const { for (Uint32 v = 0; v < m_NumVariables; ++v) @@ -202,4 +217,14 @@ void ShaderVariableD3D12Impl::SetArray(IDeviceObject* const* ppObjects, Uint32 F BindResource(ppObjects[Elem], FirstElement + Elem); } +bool ShaderVariableD3D12Impl::IsBound(Uint32 ArrayIndex) const +{ + return m_ParentManager.m_pSignature->IsBound(ArrayIndex, m_ResIndex, m_ParentManager.m_ResourceCache); +} + +void ShaderVariableD3D12Impl::BindResource(IDeviceObject* pObj, Uint32 ArrayIndex) const +{ + m_ParentManager.m_pSignature->BindResource(pObj, ArrayIndex, m_ResIndex, m_ParentManager.m_ResourceCache); +} + } // namespace Diligent diff --git a/Graphics/GraphicsEngineD3D12/src/TextureD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/TextureD3D12Impl.cpp index 9958d158..f01eb476 100644 --- a/Graphics/GraphicsEngineD3D12/src/TextureD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/TextureD3D12Impl.cpp @@ -26,6 +26,7 @@ */ #include "pch.h" + #include "TextureD3D12Impl.hpp" #include "RenderDeviceD3D12Impl.hpp" #include "DeviceContextD3D12Impl.hpp" diff --git a/Graphics/GraphicsEngineD3D12/src/TextureViewD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/TextureViewD3D12Impl.cpp index 78b519ba..925d5d2f 100644 --- a/Graphics/GraphicsEngineD3D12/src/TextureViewD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/TextureViewD3D12Impl.cpp @@ -26,8 +26,10 @@ */ #include "pch.h" + #include "TextureViewD3D12Impl.hpp" #include "DeviceContextD3D12Impl.hpp" +#include "RenderDeviceD3D12Impl.hpp" namespace Diligent { diff --git a/Graphics/GraphicsEngineD3D12/src/TopLevelASD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/TopLevelASD3D12Impl.cpp index 9ee26ff4..3c7ab4e2 100644 --- a/Graphics/GraphicsEngineD3D12/src/TopLevelASD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/TopLevelASD3D12Impl.cpp @@ -26,6 +26,7 @@ */ #include "pch.h" + #include "TopLevelASD3D12Impl.hpp" #include "RenderDeviceD3D12Impl.hpp" #include "D3D12TypeConversions.hpp" |
