diff options
| author | assiduous <assiduous@diligentgraphics.com> | 2020-07-23 22:58:46 +0000 |
|---|---|---|
| committer | assiduous <assiduous@diligentgraphics.com> | 2020-08-02 19:21:33 +0000 |
| commit | 8a7504ff49c357ad86d547a35bdfd3258bea72df (patch) | |
| tree | bb60a5848ac4046b66dfa3197423a60bec185613 /Graphics | |
| parent | Added Render pass interface stub (diff) | |
| download | DiligentCore-8a7504ff49c357ad86d547a35bdfd3258bea72df.tar.gz DiligentCore-8a7504ff49c357ad86d547a35bdfd3258bea72df.zip | |
Added render pass object implementation stubs in all backends
Diffstat (limited to 'Graphics')
22 files changed, 652 insertions, 57 deletions
diff --git a/Graphics/GraphicsEngine/CMakeLists.txt b/Graphics/GraphicsEngine/CMakeLists.txt index c3dd8678..0c522bed 100644 --- a/Graphics/GraphicsEngine/CMakeLists.txt +++ b/Graphics/GraphicsEngine/CMakeLists.txt @@ -17,6 +17,7 @@ set(INCLUDE include/PipelineStateBase.hpp include/QueryBase.hpp include/RenderDeviceBase.hpp + include/RenderPassBase.hpp include/ResourceMappingImpl.hpp include/SamplerBase.hpp include/ShaderBase.hpp diff --git a/Graphics/GraphicsEngine/include/RenderDeviceBase.hpp b/Graphics/GraphicsEngine/include/RenderDeviceBase.hpp index 49e54d12..854e5ec9 100644 --- a/Graphics/GraphicsEngine/include/RenderDeviceBase.hpp +++ b/Graphics/GraphicsEngine/include/RenderDeviceBase.hpp @@ -220,6 +220,9 @@ public: /// Size of the query object (QueryD3D12Impl, QueryVkImpl, etc.), in bytes const size_t QuerySize; + + /// Size of the render pass object (RenderPassD3D12Impl, RenderPassVkImpl, etc.), in bytes + const size_t RenderPassObjSize; }; /// \param pRefCounters - reference counters object that controls the lifetime of this render device @@ -243,17 +246,18 @@ public: m_TexFmtInfoInitFlags (TEX_FORMAT_NUM_FORMATS, false, STD_ALLOCATOR_RAW_MEM(bool, RawMemAllocator, "Allocator for vector<bool>")), m_wpDeferredContexts (NumDeferredContexts, RefCntWeakPtr<IDeviceContext>(), STD_ALLOCATOR_RAW_MEM(RefCntWeakPtr<IDeviceContext>, RawMemAllocator, "Allocator for vector< RefCntWeakPtr<IDeviceContext> >")), m_RawMemAllocator {RawMemAllocator}, - m_TexObjAllocator {RawMemAllocator, ObjectSizes.TextureObjSize, 64 }, - m_TexViewObjAllocator {RawMemAllocator, ObjectSizes.TexViewObjSize, 64 }, - m_BufObjAllocator {RawMemAllocator, ObjectSizes.BufferObjSize, 128 }, - m_BuffViewObjAllocator {RawMemAllocator, ObjectSizes.BuffViewObjSize, 128 }, - m_ShaderObjAllocator {RawMemAllocator, ObjectSizes.ShaderObjSize, 32 }, - m_SamplerObjAllocator {RawMemAllocator, ObjectSizes.SamplerObjSize, 32 }, - m_PSOAllocator {RawMemAllocator, ObjectSizes.PSOSize, 128 }, - m_SRBAllocator {RawMemAllocator, ObjectSizes.SRBSize, 1024}, - m_ResMappingAllocator {RawMemAllocator, sizeof(ResourceMappingImpl), 16 }, - m_FenceAllocator {RawMemAllocator, ObjectSizes.FenceSize, 16 }, - m_QueryAllocator {RawMemAllocator, ObjectSizes.QuerySize, 16 } + m_TexObjAllocator {RawMemAllocator, ObjectSizes.TextureObjSize, 64 }, + m_TexViewObjAllocator {RawMemAllocator, ObjectSizes.TexViewObjSize, 64 }, + m_BufObjAllocator {RawMemAllocator, ObjectSizes.BufferObjSize, 128 }, + m_BuffViewObjAllocator {RawMemAllocator, ObjectSizes.BuffViewObjSize, 128 }, + m_ShaderObjAllocator {RawMemAllocator, ObjectSizes.ShaderObjSize, 32 }, + m_SamplerObjAllocator {RawMemAllocator, ObjectSizes.SamplerObjSize, 32 }, + m_PSOAllocator {RawMemAllocator, ObjectSizes.PSOSize, 128 }, + m_SRBAllocator {RawMemAllocator, ObjectSizes.SRBSize, 1024}, + m_ResMappingAllocator {RawMemAllocator, sizeof(ResourceMappingImpl), 16 }, + m_FenceAllocator {RawMemAllocator, ObjectSizes.FenceSize, 16 }, + m_QueryAllocator {RawMemAllocator, ObjectSizes.QuerySize, 16 }, + m_RenderPassAllocator {RawMemAllocator, ObjectSizes.RenderPassObjSize, 16 } // clang-format on { // Initialize texture format info @@ -426,6 +430,7 @@ protected: FixedBlockMemoryAllocator m_ResMappingAllocator; ///< Allocator for resource mapping objects FixedBlockMemoryAllocator m_FenceAllocator; ///< Allocator for fence objects FixedBlockMemoryAllocator m_QueryAllocator; ///< Allocator for query objects + FixedBlockMemoryAllocator m_RenderPassAllocator; ///< Allocator for render pass objects }; diff --git a/Graphics/GraphicsEngine/include/RenderPassBase.hpp b/Graphics/GraphicsEngine/include/RenderPassBase.hpp new file mode 100644 index 00000000..c10f39a1 --- /dev/null +++ b/Graphics/GraphicsEngine/include/RenderPassBase.hpp @@ -0,0 +1,72 @@ +/* + * Copyright 2019-2020 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 +/// Implementation of the Diligent::RenderPassBase template class + +#include "RenderPass.h" +#include "DeviceObjectBase.hpp" +#include "RenderDeviceBase.hpp" + +namespace Diligent +{ + +/// Template class implementing base functionality for the render pass object. + +/// \tparam BaseInterface - base interface that this class will inheret +/// (Diligent::IRenderPassVk). +/// \tparam RenderDeviceImplType - type of the render device implementation +/// (Diligent::RenderDeviceD3D11Impl, Diligent::RenderDeviceD3D12Impl, +/// Diligent::RenderDeviceGLImpl, or Diligent::RenderDeviceVkImpl) +template <class BaseInterface, class RenderDeviceImplType> +class RenderPassBase : public DeviceObjectBase<BaseInterface, RenderDeviceImplType, RenderPassDesc> +{ +public: + using TDeviceObjectBase = DeviceObjectBase<BaseInterface, RenderDeviceImplType, RenderPassDesc>; + + /// \param pRefCounters - reference counters object that controls the lifetime of this render pass. + /// \param pDevice - pointer to the device. + /// \param Desc - Render pass description. + /// \param bIsDeviceInternal - flag indicating if the RenderPass is an internal device object and + /// must not keep a strong reference to the device. + RenderPassBase(IReferenceCounters* pRefCounters, + RenderDeviceImplType* pDevice, + const RenderPassDesc& Desc, + bool bIsDeviceInternal = false) : + TDeviceObjectBase{pRefCounters, pDevice, Desc, bIsDeviceInternal} + {} + + ~RenderPassBase() + { + } + + IMPLEMENT_QUERY_INTERFACE_IN_PLACE(IID_RenderPass, TDeviceObjectBase) +}; + +} // namespace Diligent diff --git a/Graphics/GraphicsEngineD3D11/CMakeLists.txt b/Graphics/GraphicsEngineD3D11/CMakeLists.txt index 9ec7e370..30a48152 100644 --- a/Graphics/GraphicsEngineD3D11/CMakeLists.txt +++ b/Graphics/GraphicsEngineD3D11/CMakeLists.txt @@ -17,6 +17,7 @@ set(INCLUDE include/PipelineStateD3D11Impl.hpp include/QueryD3D11Impl.hpp include/RenderDeviceD3D11Impl.hpp + include/RenderPassD3D11Impl.hpp include/SamplerD3D11Impl.hpp include/ShaderD3D11Impl.hpp include/ShaderResourceBindingD3D11Impl.hpp @@ -62,6 +63,7 @@ set(SRC src/PipelineStateD3D11Impl.cpp src/QueryD3D11Impl.cpp src/RenderDeviceD3D11Impl.cpp + src/RenderPassD3D11Impl.cpp src/SamplerD3D11Impl.cpp src/ShaderD3D11Impl.cpp src/ShaderResourceBindingD3D11Impl.cpp diff --git a/Graphics/GraphicsEngineD3D11/include/RenderPassD3D11Impl.hpp b/Graphics/GraphicsEngineD3D11/include/RenderPassD3D11Impl.hpp new file mode 100644 index 00000000..d90d67ac --- /dev/null +++ b/Graphics/GraphicsEngineD3D11/include/RenderPassD3D11Impl.hpp @@ -0,0 +1,54 @@ +/* + * Copyright 2019-2020 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::RenderPassD3D11Impl class + +#include "RenderDeviceD3D11.h" +#include "RenderPassBase.hpp" +#include "RenderDeviceD3D11Impl.hpp" + +namespace Diligent +{ + +class FixedBlockMemoryAllocator; + +/// Render pass implementation in Direct3D11 backend. +class RenderPassD3D11Impl final : public RenderPassBase<IRenderPass, RenderDeviceD3D11Impl> +{ +public: + using TRenderPassBase = RenderPassBase<IRenderPass, RenderDeviceD3D11Impl>; + + RenderPassD3D11Impl(IReferenceCounters* pRefCounters, + RenderDeviceD3D11Impl* pDevice, + const RenderPassDesc& Desc); + ~RenderPassD3D11Impl(); +}; + +} // namespace Diligent diff --git a/Graphics/GraphicsEngineD3D11/src/RenderDeviceD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/RenderDeviceD3D11Impl.cpp index ce0dc402..729eb687 100644 --- a/Graphics/GraphicsEngineD3D11/src/RenderDeviceD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/RenderDeviceD3D11Impl.cpp @@ -40,6 +40,7 @@ #include "ShaderResourceBindingD3D11Impl.hpp" #include "FenceD3D11Impl.hpp" #include "QueryD3D11Impl.hpp" +#include "RenderPassD3D11Impl.hpp" #include "EngineMemory.h" namespace Diligent @@ -97,7 +98,8 @@ RenderDeviceD3D11Impl::RenderDeviceD3D11Impl(IReferenceCounters* pRefCo sizeof(PipelineStateD3D11Impl), sizeof(ShaderResourceBindingD3D11Impl), sizeof(FenceD3D11Impl), - sizeof(QueryD3D11Impl) + sizeof(QueryD3D11Impl), + sizeof(RenderPassD3D11Impl) } }, m_EngineAttribs{EngineAttribs}, @@ -374,13 +376,13 @@ void RenderDeviceD3D11Impl::CreateQuery(const QueryDesc& Desc, IQuery** ppQuery) void RenderDeviceD3D11Impl::CreateRenderPass(const RenderPassDesc& Desc, IRenderPass** ppRenderPass) { - //CreateDeviceObject("RenderPass", Desc, ppRenderPass, - // [&]() // - // { - // RenderPassD3D11Impl* pRenderPassD3D11(NEW_RC_OBJ(m_RenderPassAllocator, "RenderPassD3D11Impl instance", RenderPassD3D11Impl)(this, Desc)); - // pRenderPassD3D11->RenderPassInterface(IID_RenderPass, reinterpret_cast<IObject**>(ppRenderPass)); - // OnCreateDeviceObject(pRenderPassD3D11); - // }); + CreateDeviceObject("RenderPass", Desc, ppRenderPass, + [&]() // + { + RenderPassD3D11Impl* pRenderPassD3D11(NEW_RC_OBJ(m_RenderPassAllocator, "RenderPassD3D11Impl instance", RenderPassD3D11Impl)(this, Desc)); + pRenderPassD3D11->QueryInterface(IID_RenderPass, reinterpret_cast<IObject**>(ppRenderPass)); + OnCreateDeviceObject(pRenderPassD3D11); + }); } void RenderDeviceD3D11Impl::IdleGPU() diff --git a/Graphics/GraphicsEngineD3D11/src/RenderPassD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/RenderPassD3D11Impl.cpp new file mode 100644 index 00000000..d30fd368 --- /dev/null +++ b/Graphics/GraphicsEngineD3D11/src/RenderPassD3D11Impl.cpp @@ -0,0 +1,47 @@ +/* + * Copyright 2019-2020 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. + */ + +#include "pch.h" + +#include "RenderPassD3D11Impl.hpp" +#include "EngineMemory.h" + +namespace Diligent +{ + +RenderPassD3D11Impl::RenderPassD3D11Impl(IReferenceCounters* pRefCounters, + RenderDeviceD3D11Impl* pDevice, + const RenderPassDesc& Desc) : + TRenderPassBase{pRefCounters, pDevice, Desc} +{ +} + +RenderPassD3D11Impl::~RenderPassD3D11Impl() +{ +} + +} // namespace Diligent diff --git a/Graphics/GraphicsEngineD3D12/CMakeLists.txt b/Graphics/GraphicsEngineD3D12/CMakeLists.txt index 6ea2fc22..06c2bfcf 100644 --- a/Graphics/GraphicsEngineD3D12/CMakeLists.txt +++ b/Graphics/GraphicsEngineD3D12/CMakeLists.txt @@ -24,6 +24,7 @@ set(INCLUDE include/QueryD3D12Impl.hpp include/QueryManagerD3D12.hpp include/RenderDeviceD3D12Impl.hpp + include/RenderPassD3D12Impl.hpp include/RootSignature.hpp include/SamplerD3D12Impl.hpp include/ShaderD3D12Impl.hpp @@ -74,6 +75,7 @@ set(SRC src/QueryD3D12Impl.cpp src/QueryManagerD3D12.cpp src/RenderDeviceD3D12Impl.cpp + src/RenderPassD3D12Impl.cpp src/RootSignature.cpp src/SamplerD3D12Impl.cpp src/ShaderD3D12Impl.cpp diff --git a/Graphics/GraphicsEngineD3D12/include/RenderPassD3D12Impl.hpp b/Graphics/GraphicsEngineD3D12/include/RenderPassD3D12Impl.hpp new file mode 100644 index 00000000..501e62df --- /dev/null +++ b/Graphics/GraphicsEngineD3D12/include/RenderPassD3D12Impl.hpp @@ -0,0 +1,54 @@ +/* + * Copyright 2019-2020 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::RenderPassD3D12Impl class + +#include "RenderDeviceD3D12.h" +#include "RenderPassBase.hpp" +#include "RenderDeviceD3D12Impl.hpp" + +namespace Diligent +{ + +class FixedBlockMemoryAllocator; + +/// Render pass implementation in Direct3D11 backend. +class RenderPassD3D12Impl final : public RenderPassBase<IRenderPass, RenderDeviceD3D12Impl> +{ +public: + using TRenderPassBase = RenderPassBase<IRenderPass, RenderDeviceD3D12Impl>; + + RenderPassD3D12Impl(IReferenceCounters* pRefCounters, + RenderDeviceD3D12Impl* pDevice, + const RenderPassDesc& Desc); + ~RenderPassD3D12Impl(); +}; + +} // namespace Diligent diff --git a/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp index a37f32cf..f1d00587 100644 --- a/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp @@ -38,6 +38,7 @@ #include "DeviceContextD3D12Impl.hpp" #include "FenceD3D12Impl.hpp" #include "QueryD3D12Impl.hpp" +#include "RenderPassD3D12Impl.hpp" #include "EngineMemory.h" namespace Diligent @@ -109,7 +110,8 @@ RenderDeviceD3D12Impl::RenderDeviceD3D12Impl(IReferenceCounters* pRefCo sizeof(PipelineStateD3D12Impl), sizeof(ShaderResourceBindingD3D12Impl), sizeof(FenceD3D12Impl), - sizeof(QueryD3D12Impl) + sizeof(QueryD3D12Impl), + sizeof(RenderPassD3D12Impl) } }, m_pd3d12Device {pd3d12Device}, @@ -524,13 +526,13 @@ void RenderDeviceD3D12Impl::CreateQuery(const QueryDesc& Desc, IQuery** ppQuery) void RenderDeviceD3D12Impl::CreateRenderPass(const RenderPassDesc& Desc, IRenderPass** ppRenderPass) { - //CreateDeviceObject("RenderPass", Desc, ppRenderPass, - // [&]() // - // { - // RenderPassD3D12Impl* pRenderPassD3D12(NEW_RC_OBJ(m_RenderPassAllocator, "RenderPassD3D12Impl instance", RenderPassD3D12Impl)(this, Desc)); - // pRenderPassD3D12->RenderPassInterface(IID_RenderPass, reinterpret_cast<IObject**>(ppRenderPass)); - // OnCreateDeviceObject(pRenderPassD3D12); - // }); + CreateDeviceObject("RenderPass", Desc, ppRenderPass, + [&]() // + { + RenderPassD3D12Impl* pRenderPassD3D12(NEW_RC_OBJ(m_RenderPassAllocator, "RenderPassD3D12Impl instance", RenderPassD3D12Impl)(this, Desc)); + pRenderPassD3D12->QueryInterface(IID_RenderPass, reinterpret_cast<IObject**>(ppRenderPass)); + OnCreateDeviceObject(pRenderPassD3D12); + }); } DescriptorHeapAllocation RenderDeviceD3D12Impl::AllocateDescriptor(D3D12_DESCRIPTOR_HEAP_TYPE Type, UINT Count /*= 1*/) diff --git a/Graphics/GraphicsEngineD3D12/src/RenderPassD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/RenderPassD3D12Impl.cpp new file mode 100644 index 00000000..88d4fad2 --- /dev/null +++ b/Graphics/GraphicsEngineD3D12/src/RenderPassD3D12Impl.cpp @@ -0,0 +1,47 @@ +/* + * Copyright 2019-2020 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. + */ + +#include "pch.h" + +#include "RenderPassD3D12Impl.hpp" +#include "EngineMemory.h" + +namespace Diligent +{ + +RenderPassD3D12Impl::RenderPassD3D12Impl(IReferenceCounters* pRefCounters, + RenderDeviceD3D12Impl* pDevice, + const RenderPassDesc& Desc) : + TRenderPassBase{pRefCounters, pDevice, Desc} +{ +} + +RenderPassD3D12Impl::~RenderPassD3D12Impl() +{ +} + +} // namespace Diligent diff --git a/Graphics/GraphicsEngineMetal/include/RenderPassMtlImpl.hpp b/Graphics/GraphicsEngineMetal/include/RenderPassMtlImpl.hpp new file mode 100644 index 00000000..2c900713 --- /dev/null +++ b/Graphics/GraphicsEngineMetal/include/RenderPassMtlImpl.hpp @@ -0,0 +1,54 @@ +/* + * Copyright 2019-2020 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::RenderPassMtlImpl class + +#include "RenderDeviceMtl.h" +#include "RenderPassBase.hpp" +#include "RenderDeviceMtlImpl.hpp" + +namespace Diligent +{ + +class FixedBlockMemoryAllocator; + +/// Render pass implementation in Direct3D11 backend. +class RenderPassMtlImpl final : public RenderPassBase<IRenderPass, RenderDeviceMtlImpl> +{ +public: + using TRenderPassBase = RenderPassBase<IRenderPass, RenderDeviceMtlImpl>; + + RenderPassMtlImpl(IReferenceCounters* pRefCounters, + RenderDeviceMtlImpl* pDevice, + const RenderPassDesc& Desc); + ~RenderPassMtlImpl(); +}; + +} // namespace Diligent diff --git a/Graphics/GraphicsEngineMetal/src/RenderDeviceMtlImpl.mm b/Graphics/GraphicsEngineMetal/src/RenderDeviceMtlImpl.mm index b137c0f6..7e7e57c5 100644 --- a/Graphics/GraphicsEngineMetal/src/RenderDeviceMtlImpl.mm +++ b/Graphics/GraphicsEngineMetal/src/RenderDeviceMtlImpl.mm @@ -32,6 +32,7 @@ #include "PipelineStateMtlImpl.h" #include "ShaderResourceBindingMtlImpl.h" #include "FenceMtlImpl.h" +#include "RenderPassMtlImpl.h" #include "EngineMemory.h" namespace Diligent @@ -58,7 +59,8 @@ RenderDeviceMtlImpl :: RenderDeviceMtlImpl(IReferenceCounters* pRefCounte sizeof(SamplerMtlImpl), sizeof(PipelineStateMtlImpl), sizeof(ShaderResourceBindingMtlImpl), - sizeof(FenceMtlImpl) + sizeof(FenceMtlImpl), + sizeof(RenderPassMtlImpl) } }, m_EngineAttribs(EngineAttribs) @@ -186,15 +188,15 @@ void RenderDeviceMtlImpl::CreateQuery(const QueryDesc& Desc, IQuery** ppQuery) void RenderDeviceMtlImpl::CreateRenderPass(const RenderPassDesc& Desc, IRenderPass** ppRenderPass) { -// CreateDeviceObject( "RenderPass", Desc, ppRenderPass, -// [&]() -// { -// RenderPassMtlImpl* pRenderPassMtl( NEW_RC_OBJ(m_RenderPassAllocator, "RenderPassMtlImpl instance", RenderPassMtlImpl) -// (this, Desc) ); -// pRenderPassMtl->RenderPassInterface( IID_RenderPass, reinterpret_cast<IObject**>(ppRenderPass) ); -// OnCreateDeviceObject( pRenderPassMtl ); -// } -// ); + CreateDeviceObject( "RenderPass", Desc, ppRenderPass, + [&]() + { + RenderPassMtlImpl* pRenderPassMtl( NEW_RC_OBJ(m_RenderPassAllocator, "RenderPassMtlImpl instance", RenderPassMtlImpl) + (this, Desc) ); + pRenderPassMtl->QueryInterface( IID_RenderPass, reinterpret_cast<IObject**>(ppRenderPass) ); + OnCreateDeviceObject( pRenderPassMtl ); + } + ); } void RenderDeviceMtlImpl::IdleGPU() diff --git a/Graphics/GraphicsEngineMetal/src/RenderPassMtlImpl.mm b/Graphics/GraphicsEngineMetal/src/RenderPassMtlImpl.mm new file mode 100644 index 00000000..c35f9aad --- /dev/null +++ b/Graphics/GraphicsEngineMetal/src/RenderPassMtlImpl.mm @@ -0,0 +1,41 @@ +/* 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 + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS. + * + * 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. + */ + +#include "RenderPassMtlImpl.h" +#include "EngineMemory.h" + +namespace Diligent +{ + +RenderPassMtlImpl :: RenderPassMtlImpl(IReferenceCounters* pRefCounters, + RenderDeviceMtlImpl* pDevice, + const RenderPassDesc& Desc) : + TQueryBase(pRefCounters, pDevice, Desc) +{ +} + +RenderPassMtlImpl :: ~RenderPassMtlImpl() +{ +} + +} diff --git a/Graphics/GraphicsEngineOpenGL/CMakeLists.txt b/Graphics/GraphicsEngineOpenGL/CMakeLists.txt index 1072d067..52251b68 100644 --- a/Graphics/GraphicsEngineOpenGL/CMakeLists.txt +++ b/Graphics/GraphicsEngineOpenGL/CMakeLists.txt @@ -20,6 +20,7 @@ set(INCLUDE include/PipelineStateGLImpl.hpp include/QueryGLImpl.hpp include/RenderDeviceGLImpl.hpp + include/RenderPassGLImpl.hpp include/SamplerGLImpl.hpp include/ShaderGLImpl.hpp include/ShaderResourceBindingGLImpl.hpp @@ -71,6 +72,7 @@ set(SOURCE src/PipelineStateGLImpl.cpp src/QueryGLImpl.cpp src/RenderDeviceGLImpl.cpp + src/RenderPassGLImpl.cpp src/SamplerGLImpl.cpp src/ShaderGLImpl.cpp src/ShaderResourceBindingGLImpl.cpp diff --git a/Graphics/GraphicsEngineOpenGL/include/RenderPassGLImpl.hpp b/Graphics/GraphicsEngineOpenGL/include/RenderPassGLImpl.hpp new file mode 100644 index 00000000..e5d77333 --- /dev/null +++ b/Graphics/GraphicsEngineOpenGL/include/RenderPassGLImpl.hpp @@ -0,0 +1,54 @@ +/* + * Copyright 2019-2020 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::RenderPassGLImpl class + +#include "RenderDeviceGL.h" +#include "RenderPassBase.hpp" +#include "RenderDeviceGLImpl.hpp" + +namespace Diligent +{ + +class FixedBlockMemoryAllocator; + +/// Render pass implementation in Direct3D11 backend. +class RenderPassGLImpl final : public RenderPassBase<IRenderPass, RenderDeviceGLImpl> +{ +public: + using TRenderPassBase = RenderPassBase<IRenderPass, RenderDeviceGLImpl>; + + RenderPassGLImpl(IReferenceCounters* pRefCounters, + RenderDeviceGLImpl* pDevice, + const RenderPassDesc& Desc); + ~RenderPassGLImpl(); +}; + +} // namespace Diligent diff --git a/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp index f47163d8..bc38d364 100644 --- a/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp @@ -46,6 +46,7 @@ #include "ShaderResourceBindingGLImpl.hpp" #include "FenceGLImpl.hpp" #include "QueryGLImpl.hpp" +#include "RenderPassGLImpl.hpp" #include "EngineMemory.h" #include "StringTools.hpp" @@ -75,7 +76,8 @@ RenderDeviceGLImpl::RenderDeviceGLImpl(IReferenceCounters* pRefCounters, sizeof(PipelineStateGLImpl), sizeof(ShaderResourceBindingGLImpl), sizeof(FenceGLImpl), - sizeof(QueryGLImpl) + sizeof(QueryGLImpl), + sizeof(RenderPassGLImpl) } }, // Device caps must be filled in before the constructor of Pipeline Cache is called! @@ -517,15 +519,15 @@ void RenderDeviceGLImpl::CreateQuery(const QueryDesc& Desc, IQuery** ppQuery) void RenderDeviceGLImpl::CreateRenderPass(const RenderPassDesc& Desc, IRenderPass** ppRenderPass) { - //CreateDeviceObject( - // "RenderPass", Desc, ppRenderPass, - // [&]() // - // { - // RenderPassGLImpl* pRenderPassOGL(NEW_RC_OBJ(m_RenderPassAllocator, "RenderPassGLImpl instance", RenderPassGLImpl)(this, Desc)); - // pRenderPassOGL->RenderPassInterface(IID_RenderPass, reinterpret_cast<IObject**>(ppRenderPass)); - // OnCreateDeviceObject(pRenderPassOGL); - // } // - //); + CreateDeviceObject( + "RenderPass", Desc, ppRenderPass, + [&]() // + { + RenderPassGLImpl* pRenderPassOGL(NEW_RC_OBJ(m_RenderPassAllocator, "RenderPassGLImpl instance", RenderPassGLImpl)(this, Desc)); + pRenderPassOGL->QueryInterface(IID_RenderPass, reinterpret_cast<IObject**>(ppRenderPass)); + OnCreateDeviceObject(pRenderPassOGL); + } // + ); } bool RenderDeviceGLImpl::CheckExtension(const Char* ExtensionString) diff --git a/Graphics/GraphicsEngineOpenGL/src/RenderPassGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/RenderPassGLImpl.cpp new file mode 100644 index 00000000..2a9d0609 --- /dev/null +++ b/Graphics/GraphicsEngineOpenGL/src/RenderPassGLImpl.cpp @@ -0,0 +1,47 @@ +/* + * Copyright 2019-2020 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. + */ + +#include "pch.h" + +#include "RenderPassGLImpl.hpp" +#include "EngineMemory.h" + +namespace Diligent +{ + +RenderPassGLImpl::RenderPassGLImpl(IReferenceCounters* pRefCounters, + RenderDeviceGLImpl* pDevice, + const RenderPassDesc& Desc) : + TRenderPassBase{pRefCounters, pDevice, Desc} +{ +} + +RenderPassGLImpl::~RenderPassGLImpl() +{ +} + +} // namespace Diligent diff --git a/Graphics/GraphicsEngineVulkan/CMakeLists.txt b/Graphics/GraphicsEngineVulkan/CMakeLists.txt index 28cf8b0f..1696283c 100644 --- a/Graphics/GraphicsEngineVulkan/CMakeLists.txt +++ b/Graphics/GraphicsEngineVulkan/CMakeLists.txt @@ -20,6 +20,7 @@ set(INCLUDE include/QueryManagerVk.hpp include/QueryVkImpl.hpp include/RenderDeviceVkImpl.hpp + include/RenderPassVkImpl.hpp include/RenderPassCache.hpp include/SamplerVkImpl.hpp include/ShaderVkImpl.hpp @@ -86,6 +87,7 @@ set(SRC src/QueryManagerVk.cpp src/QueryVkImpl.cpp src/RenderDeviceVkImpl.cpp + src/RenderPassVkImpl.cpp src/RenderPassCache.cpp src/SamplerVkImpl.cpp src/ShaderVkImpl.cpp diff --git a/Graphics/GraphicsEngineVulkan/include/RenderPassVkImpl.hpp b/Graphics/GraphicsEngineVulkan/include/RenderPassVkImpl.hpp new file mode 100644 index 00000000..bc50624f --- /dev/null +++ b/Graphics/GraphicsEngineVulkan/include/RenderPassVkImpl.hpp @@ -0,0 +1,54 @@ +/* + * Copyright 2019-2020 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::RenderPassVkImpl class + +#include "RenderDeviceVk.h" +#include "RenderPassBase.hpp" +#include "RenderDeviceVkImpl.hpp" + +namespace Diligent +{ + +class FixedBlockMemoryAllocator; + +/// Render pass implementation in Direct3D11 backend. +class RenderPassVkImpl final : public RenderPassBase<IRenderPass, RenderDeviceVkImpl> +{ +public: + using TRenderPassBase = RenderPassBase<IRenderPass, RenderDeviceVkImpl>; + + RenderPassVkImpl(IReferenceCounters* pRefCounters, + RenderDeviceVkImpl* pDevice, + const RenderPassDesc& Desc); + ~RenderPassVkImpl(); +}; + +} // namespace Diligent diff --git a/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp index 0f59e64c..012cb58f 100644 --- a/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp @@ -37,6 +37,7 @@ #include "DeviceContextVkImpl.hpp" #include "FenceVkImpl.hpp" #include "QueryVkImpl.hpp" +#include "RenderPassVkImpl.hpp" #include "EngineMemory.h" namespace Diligent @@ -71,7 +72,8 @@ RenderDeviceVkImpl::RenderDeviceVkImpl(IReferenceCounters* sizeof(PipelineStateVkImpl), sizeof(ShaderResourceBindingVkImpl), sizeof(FenceVkImpl), - sizeof(QueryVkImpl) + sizeof(QueryVkImpl), + sizeof(RenderPassVkImpl) } }, m_VulkanInstance {Instance }, @@ -620,15 +622,15 @@ void RenderDeviceVkImpl::CreateQuery(const QueryDesc& Desc, IQuery** ppQuery) void RenderDeviceVkImpl::CreateRenderPass(const RenderPassDesc& Desc, IRenderPass** ppRenderPass) { - //CreateDeviceObject( - // "RenderPass", Desc, ppRenderPass, - // [&]() // - // { - // RenderPassVkImpl* pRenderPassVk(NEW_RC_OBJ(m_RenderPassAllocator, "RenderPassVkImpl instance", RenderPassVkImpl)(this, Desc)); - // pRenderPassVk->RenderPassInterface(IID_RenderPass, reinterpret_cast<IObject**>(ppRenderPass)); - // OnCreateDeviceObject(pRenderPassVk); - // } // - //); + CreateDeviceObject( + "RenderPass", Desc, ppRenderPass, + [&]() // + { + RenderPassVkImpl* pRenderPassVk(NEW_RC_OBJ(m_RenderPassAllocator, "RenderPassVkImpl instance", RenderPassVkImpl)(this, Desc)); + pRenderPassVk->QueryInterface(IID_RenderPass, reinterpret_cast<IObject**>(ppRenderPass)); + OnCreateDeviceObject(pRenderPassVk); + } // + ); } } // namespace Diligent diff --git a/Graphics/GraphicsEngineVulkan/src/RenderPassVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/RenderPassVkImpl.cpp new file mode 100644 index 00000000..7ea5b8b9 --- /dev/null +++ b/Graphics/GraphicsEngineVulkan/src/RenderPassVkImpl.cpp @@ -0,0 +1,47 @@ +/* + * Copyright 2019-2020 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. + */ + +#include "pch.h" + +#include "RenderPassVkImpl.hpp" +#include "EngineMemory.h" + +namespace Diligent +{ + +RenderPassVkImpl::RenderPassVkImpl(IReferenceCounters* pRefCounters, + RenderDeviceVkImpl* pDevice, + const RenderPassDesc& Desc) : + TRenderPassBase{pRefCounters, pDevice, Desc} +{ +} + +RenderPassVkImpl::~RenderPassVkImpl() +{ +} + +} // namespace Diligent |
