diff options
| author | assiduous <assiduous@diligentgraphics.com> | 2020-07-25 04:18:48 +0000 |
|---|---|---|
| committer | assiduous <assiduous@diligentgraphics.com> | 2020-08-02 19:21:37 +0000 |
| commit | 16dd04efc73e4093a991a517f786ebaf03f3f6d1 (patch) | |
| tree | 42ea302743a2a74de3f2b806a8e95a0690b04005 /Graphics/GraphicsEngineD3D11 | |
| parent | Added IFramebuffer interface (diff) | |
| download | DiligentCore-16dd04efc73e4093a991a517f786ebaf03f3f6d1.tar.gz DiligentCore-16dd04efc73e4093a991a517f786ebaf03f3f6d1.zip | |
Added framebuffer object implementation stubs
Diffstat (limited to 'Graphics/GraphicsEngineD3D11')
5 files changed, 121 insertions, 1 deletions
diff --git a/Graphics/GraphicsEngineD3D11/CMakeLists.txt b/Graphics/GraphicsEngineD3D11/CMakeLists.txt index 30a48152..ba6aeb46 100644 --- a/Graphics/GraphicsEngineD3D11/CMakeLists.txt +++ b/Graphics/GraphicsEngineD3D11/CMakeLists.txt @@ -14,6 +14,7 @@ set(INCLUDE include/EngineD3D11Defines.h include/pch.h include/FenceD3D11Impl.hpp + include/FramebufferD3D11Impl.hpp include/PipelineStateD3D11Impl.hpp include/QueryD3D11Impl.hpp include/RenderDeviceD3D11Impl.hpp @@ -59,6 +60,7 @@ set(SRC src/DeviceContextD3D11Impl.cpp src/EngineFactoryD3D11.cpp src/FenceD3D11Impl.cpp + src/FramebufferD3D11Impl.cpp src/GUIDDef.cpp src/PipelineStateD3D11Impl.cpp src/QueryD3D11Impl.cpp diff --git a/Graphics/GraphicsEngineD3D11/include/FramebufferD3D11Impl.hpp b/Graphics/GraphicsEngineD3D11/include/FramebufferD3D11Impl.hpp new file mode 100644 index 00000000..5449d4f9 --- /dev/null +++ b/Graphics/GraphicsEngineD3D11/include/FramebufferD3D11Impl.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::FramebufferD3D11Impl class + +#include "RenderDeviceD3D11.h" +#include "FramebufferBase.hpp" +#include "RenderDeviceD3D11Impl.hpp" + +namespace Diligent +{ + +class FixedBlockMemoryAllocator; + +/// Render pass implementation in Direct3D11 backend. +class FramebufferD3D11Impl final : public FramebufferBase<IFramebuffer, RenderDeviceD3D11Impl> +{ +public: + using TFramebufferBase = FramebufferBase<IFramebuffer, RenderDeviceD3D11Impl>; + + FramebufferD3D11Impl(IReferenceCounters* pRefCounters, + RenderDeviceD3D11Impl* pDevice, + const FramebufferDesc& Desc); + ~FramebufferD3D11Impl(); +}; + +} // namespace Diligent diff --git a/Graphics/GraphicsEngineD3D11/include/RenderDeviceD3D11Impl.hpp b/Graphics/GraphicsEngineD3D11/include/RenderDeviceD3D11Impl.hpp index 8f50f8f8..f041806c 100644 --- a/Graphics/GraphicsEngineD3D11/include/RenderDeviceD3D11Impl.hpp +++ b/Graphics/GraphicsEngineD3D11/include/RenderDeviceD3D11Impl.hpp @@ -85,6 +85,10 @@ public: virtual void DILIGENT_CALL_TYPE CreateRenderPass(const RenderPassDesc& Desc, IRenderPass** ppRenderPass) override final; + /// Implementation of IRenderDevice::CreateFramebuffer() in Direct3D11 backend. + virtual void DILIGENT_CALL_TYPE CreateFramebuffer(const FramebufferDesc& Desc, + IFramebuffer** ppFramebuffer) override final; + /// Implementation of IRenderDeviceD3D11::GetD3D11Device() in Direct3D11 backend. ID3D11Device* DILIGENT_CALL_TYPE GetD3D11Device() override final { return m_pd3d11Device; } diff --git a/Graphics/GraphicsEngineD3D11/src/FramebufferD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/FramebufferD3D11Impl.cpp new file mode 100644 index 00000000..469dc3c5 --- /dev/null +++ b/Graphics/GraphicsEngineD3D11/src/FramebufferD3D11Impl.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 "FramebufferD3D11Impl.hpp" +#include "EngineMemory.h" + +namespace Diligent +{ + +FramebufferD3D11Impl::FramebufferD3D11Impl(IReferenceCounters* pRefCounters, + RenderDeviceD3D11Impl* pDevice, + const FramebufferDesc& Desc) : + TFramebufferBase{pRefCounters, pDevice, Desc} +{ +} + +FramebufferD3D11Impl::~FramebufferD3D11Impl() +{ +} + +} // namespace Diligent diff --git a/Graphics/GraphicsEngineD3D11/src/RenderDeviceD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/RenderDeviceD3D11Impl.cpp index 729eb687..d413ac5f 100644 --- a/Graphics/GraphicsEngineD3D11/src/RenderDeviceD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/RenderDeviceD3D11Impl.cpp @@ -41,6 +41,7 @@ #include "FenceD3D11Impl.hpp" #include "QueryD3D11Impl.hpp" #include "RenderPassD3D11Impl.hpp" +#include "FramebufferD3D11Impl.hpp" #include "EngineMemory.h" namespace Diligent @@ -99,7 +100,8 @@ RenderDeviceD3D11Impl::RenderDeviceD3D11Impl(IReferenceCounters* pRefCo sizeof(ShaderResourceBindingD3D11Impl), sizeof(FenceD3D11Impl), sizeof(QueryD3D11Impl), - sizeof(RenderPassD3D11Impl) + sizeof(RenderPassD3D11Impl), + sizeof(FramebufferD3D11Impl) } }, m_EngineAttribs{EngineAttribs}, @@ -385,6 +387,17 @@ void RenderDeviceD3D11Impl::CreateRenderPass(const RenderPassDesc& Desc, IRender }); } +void RenderDeviceD3D11Impl::CreateFramebuffer(const FramebufferDesc& Desc, IFramebuffer** ppFramebuffer) +{ + CreateDeviceObject("Framebuffer", Desc, ppFramebuffer, + [&]() // + { + FramebufferD3D11Impl* pFramebufferD3D11(NEW_RC_OBJ(m_FramebufferAllocator, "FramebufferD3D11Impl instance", FramebufferD3D11Impl)(this, Desc)); + pFramebufferD3D11->QueryInterface(IID_Framebuffer, reinterpret_cast<IObject**>(ppFramebuffer)); + OnCreateDeviceObject(pFramebufferD3D11); + }); +} + void RenderDeviceD3D11Impl::IdleGPU() { if (auto pImmediateCtx = m_wpImmediateContext.Lock()) |
