summaryrefslogtreecommitdiffstats
path: root/Graphics
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2020-07-25 04:18:48 +0000
committerassiduous <assiduous@diligentgraphics.com>2020-08-02 19:21:37 +0000
commit16dd04efc73e4093a991a517f786ebaf03f3f6d1 (patch)
tree42ea302743a2a74de3f2b806a8e95a0690b04005 /Graphics
parentAdded IFramebuffer interface (diff)
downloadDiligentCore-16dd04efc73e4093a991a517f786ebaf03f3f6d1.tar.gz
DiligentCore-16dd04efc73e4093a991a517f786ebaf03f3f6d1.zip
Added framebuffer object implementation stubs
Diffstat (limited to 'Graphics')
-rw-r--r--Graphics/GraphicsEngine/CMakeLists.txt1
-rw-r--r--Graphics/GraphicsEngine/include/FramebufferBase.hpp77
-rw-r--r--Graphics/GraphicsEngine/include/RenderDeviceBase.hpp29
-rw-r--r--Graphics/GraphicsEngine/include/RenderPassBase.hpp2
-rw-r--r--Graphics/GraphicsEngine/interface/RenderDevice.h14
-rw-r--r--Graphics/GraphicsEngineD3D11/CMakeLists.txt2
-rw-r--r--Graphics/GraphicsEngineD3D11/include/FramebufferD3D11Impl.hpp54
-rw-r--r--Graphics/GraphicsEngineD3D11/include/RenderDeviceD3D11Impl.hpp4
-rw-r--r--Graphics/GraphicsEngineD3D11/src/FramebufferD3D11Impl.cpp47
-rw-r--r--Graphics/GraphicsEngineD3D11/src/RenderDeviceD3D11Impl.cpp15
-rw-r--r--Graphics/GraphicsEngineD3D12/CMakeLists.txt2
-rw-r--r--Graphics/GraphicsEngineD3D12/include/FramebufferD3D12Impl.hpp54
-rw-r--r--Graphics/GraphicsEngineD3D12/include/RenderDeviceD3D12Impl.hpp4
-rw-r--r--Graphics/GraphicsEngineD3D12/src/FramebufferD3D12Impl.cpp47
-rw-r--r--Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp15
-rw-r--r--Graphics/GraphicsEngineMetal/include/FramebufferMtlImpl.h54
-rw-r--r--Graphics/GraphicsEngineMetal/include/RenderDeviceMtlImpl.h2
-rw-r--r--Graphics/GraphicsEngineMetal/src/FramebufferMtlImpl.mm41
-rw-r--r--Graphics/GraphicsEngineMetal/src/RenderDeviceMtlImpl.mm17
-rw-r--r--Graphics/GraphicsEngineOpenGL/CMakeLists.txt2
-rw-r--r--Graphics/GraphicsEngineOpenGL/include/FramebufferGLImpl.hpp54
-rw-r--r--Graphics/GraphicsEngineOpenGL/include/RenderDeviceGLImpl.hpp4
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/FramebufferGLImpl.cpp47
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp15
-rw-r--r--Graphics/GraphicsEngineVulkan/CMakeLists.txt2
-rw-r--r--Graphics/GraphicsEngineVulkan/include/FramebufferVkImpl.hpp53
-rw-r--r--Graphics/GraphicsEngineVulkan/include/RenderDeviceVkImpl.hpp4
-rw-r--r--Graphics/GraphicsEngineVulkan/src/FramebufferVkImpl.cpp47
-rw-r--r--Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp15
29 files changed, 706 insertions, 18 deletions
diff --git a/Graphics/GraphicsEngine/CMakeLists.txt b/Graphics/GraphicsEngine/CMakeLists.txt
index 7a8a4715..daafe96e 100644
--- a/Graphics/GraphicsEngine/CMakeLists.txt
+++ b/Graphics/GraphicsEngine/CMakeLists.txt
@@ -13,6 +13,7 @@ set(INCLUDE
include/EngineFactoryBase.hpp
include/EngineMemory.h
include/FenceBase.hpp
+ include/FramebufferBase.hpp
include/pch.h
include/PipelineStateBase.hpp
include/QueryBase.hpp
diff --git a/Graphics/GraphicsEngine/include/FramebufferBase.hpp b/Graphics/GraphicsEngine/include/FramebufferBase.hpp
new file mode 100644
index 00000000..ad33e9c0
--- /dev/null
+++ b/Graphics/GraphicsEngine/include/FramebufferBase.hpp
@@ -0,0 +1,77 @@
+/*
+ * 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::FramebufferBase template class
+
+#include "Framebuffer.h"
+#include "DeviceObjectBase.hpp"
+#include "RenderDeviceBase.hpp"
+
+namespace Diligent
+{
+
+void ValidateFramebufferDesc(const FramebufferDesc& Desc);
+
+/// Template class implementing base functionality for the framebuffer object.
+
+/// \tparam BaseInterface - base interface that this class will inheret
+/// (e.g. Diligent::IFramebufferVk).
+/// \tparam RenderDeviceImplType - type of the render device implementation
+/// (Diligent::RenderDeviceD3D11Impl, Diligent::RenderDeviceD3D12Impl,
+/// Diligent::RenderDeviceGLImpl, or Diligent::RenderDeviceVkImpl)
+template <class BaseInterface, class RenderDeviceImplType>
+class FramebufferBase : public DeviceObjectBase<BaseInterface, RenderDeviceImplType, FramebufferDesc>
+{
+public:
+ using TDeviceObjectBase = DeviceObjectBase<BaseInterface, RenderDeviceImplType, FramebufferDesc>;
+
+ /// \param pRefCounters - reference counters object that controls the lifetime of this framebuffer pass.
+ /// \param pDevice - pointer to the device.
+ /// \param Desc - Framebuffer description.
+ /// \param bIsDeviceInternal - flag indicating if the Framebuffer is an internal device object and
+ /// must not keep a strong reference to the device.
+ FramebufferBase(IReferenceCounters* pRefCounters,
+ RenderDeviceImplType* pDevice,
+ const FramebufferDesc& Desc,
+ bool bIsDeviceInternal = false) :
+ TDeviceObjectBase{pRefCounters, pDevice, Desc, bIsDeviceInternal}
+ {
+ }
+
+ ~FramebufferBase()
+ {
+ }
+
+ IMPLEMENT_QUERY_INTERFACE_IN_PLACE(IID_Framebuffer, TDeviceObjectBase)
+
+private:
+};
+
+} // namespace Diligent
diff --git a/Graphics/GraphicsEngine/include/RenderDeviceBase.hpp b/Graphics/GraphicsEngine/include/RenderDeviceBase.hpp
index 854e5ec9..a0ffeda6 100644
--- a/Graphics/GraphicsEngine/include/RenderDeviceBase.hpp
+++ b/Graphics/GraphicsEngine/include/RenderDeviceBase.hpp
@@ -223,6 +223,9 @@ public:
/// Size of the render pass object (RenderPassD3D12Impl, RenderPassVkImpl, etc.), in bytes
const size_t RenderPassObjSize;
+
+ /// Size of the framebuffer object (FramebufferD3D12Impl, FramebufferVkImpl, etc.), in bytes
+ const size_t FramebufferObjSize;
};
/// \param pRefCounters - reference counters object that controls the lifetime of this render device
@@ -246,18 +249,19 @@ 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_RenderPassAllocator {RawMemAllocator, ObjectSizes.RenderPassObjSize, 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 },
+ m_FramebufferAllocator {RawMemAllocator, ObjectSizes.FramebufferObjSize, 16 }
// clang-format on
{
// Initialize texture format info
@@ -431,6 +435,7 @@ protected:
FixedBlockMemoryAllocator m_FenceAllocator; ///< Allocator for fence objects
FixedBlockMemoryAllocator m_QueryAllocator; ///< Allocator for query objects
FixedBlockMemoryAllocator m_RenderPassAllocator; ///< Allocator for render pass objects
+ FixedBlockMemoryAllocator m_FramebufferAllocator; ///< Allocator for framebuffer objects
};
diff --git a/Graphics/GraphicsEngine/include/RenderPassBase.hpp b/Graphics/GraphicsEngine/include/RenderPassBase.hpp
index a8d73dc2..8099abb2 100644
--- a/Graphics/GraphicsEngine/include/RenderPassBase.hpp
+++ b/Graphics/GraphicsEngine/include/RenderPassBase.hpp
@@ -42,7 +42,7 @@ void ValidateRenderPassDesc(const RenderPassDesc& Desc);
/// Template class implementing base functionality for the render pass object.
/// \tparam BaseInterface - base interface that this class will inheret
-/// (Diligent::IRenderPassVk).
+/// (e.g. Diligent::IRenderPassVk).
/// \tparam RenderDeviceImplType - type of the render device implementation
/// (Diligent::RenderDeviceD3D11Impl, Diligent::RenderDeviceD3D12Impl,
/// Diligent::RenderDeviceGLImpl, or Diligent::RenderDeviceVkImpl)
diff --git a/Graphics/GraphicsEngine/interface/RenderDevice.h b/Graphics/GraphicsEngine/interface/RenderDevice.h
index 24c641bc..ddbc75b2 100644
--- a/Graphics/GraphicsEngine/interface/RenderDevice.h
+++ b/Graphics/GraphicsEngine/interface/RenderDevice.h
@@ -47,6 +47,7 @@
#include "Fence.h"
#include "Query.h"
#include "RenderPass.h"
+#include "Framebuffer.h"
#include "DepthStencilState.h"
#include "RasterizerState.h"
@@ -201,6 +202,19 @@ DILIGENT_BEGIN_INTERFACE(IRenderDevice, IObject)
IRenderPass** ppRenderPass) PURE;
+
+ /// Creates a framebuffer object
+
+ /// \param [in] Desc - Framebuffer description, see Diligent::FramebufferDesc for details.
+ /// \param [out] ppFramebuffer - Address of the memory location where the pointer to the
+ /// framebuffer interface will be stored.
+ /// The function calls AddRef(), so that the new object will contain
+ /// one reference.
+ VIRTUAL void METHOD(CreateFramebuffer)(THIS_
+ const FramebufferDesc REF Desc,
+ IFramebuffer** ppFramebuffer) PURE;
+
+
/// Gets the device capabilities, see Diligent::DeviceCaps for details
VIRTUAL const DeviceCaps REF METHOD(GetDeviceCaps)(THIS) CONST PURE;
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())
diff --git a/Graphics/GraphicsEngineD3D12/CMakeLists.txt b/Graphics/GraphicsEngineD3D12/CMakeLists.txt
index 06c2bfcf..f818813f 100644
--- a/Graphics/GraphicsEngineD3D12/CMakeLists.txt
+++ b/Graphics/GraphicsEngineD3D12/CMakeLists.txt
@@ -18,6 +18,7 @@ set(INCLUDE
include/DeviceContextD3D12Impl.hpp
include/D3D12DynamicHeap.hpp
include/FenceD3D12Impl.hpp
+ include/FramebufferD3D12Impl.hpp
include/GenerateMips.hpp
include/pch.h
include/PipelineStateD3D12Impl.hpp
@@ -70,6 +71,7 @@ set(SRC
src/D3D12DynamicHeap.cpp
src/EngineFactoryD3D12.cpp
src/FenceD3D12Impl.cpp
+ src/FramebufferD3D12Impl.cpp
src/GenerateMips.cpp
src/PipelineStateD3D12Impl.cpp
src/QueryD3D12Impl.cpp
diff --git a/Graphics/GraphicsEngineD3D12/include/FramebufferD3D12Impl.hpp b/Graphics/GraphicsEngineD3D12/include/FramebufferD3D12Impl.hpp
new file mode 100644
index 00000000..59642660
--- /dev/null
+++ b/Graphics/GraphicsEngineD3D12/include/FramebufferD3D12Impl.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::FramebufferD3D12Impl class
+
+#include "RenderDeviceD3D12.h"
+#include "FramebufferBase.hpp"
+#include "RenderDeviceD3D12Impl.hpp"
+
+namespace Diligent
+{
+
+class FixedBlockMemoryAllocator;
+
+/// Render pass implementation in Direct3D11 backend.
+class FramebufferD3D12Impl final : public FramebufferBase<IFramebuffer, RenderDeviceD3D12Impl>
+{
+public:
+ using TFramebufferBase = FramebufferBase<IFramebuffer, RenderDeviceD3D12Impl>;
+
+ FramebufferD3D12Impl(IReferenceCounters* pRefCounters,
+ RenderDeviceD3D12Impl* pDevice,
+ const FramebufferDesc& Desc);
+ ~FramebufferD3D12Impl();
+};
+
+} // namespace Diligent
diff --git a/Graphics/GraphicsEngineD3D12/include/RenderDeviceD3D12Impl.hpp b/Graphics/GraphicsEngineD3D12/include/RenderDeviceD3D12Impl.hpp
index 3e0e841b..ddcc4f14 100644
--- a/Graphics/GraphicsEngineD3D12/include/RenderDeviceD3D12Impl.hpp
+++ b/Graphics/GraphicsEngineD3D12/include/RenderDeviceD3D12Impl.hpp
@@ -96,6 +96,10 @@ public:
virtual void DILIGENT_CALL_TYPE CreateRenderPass(const RenderPassDesc& Desc,
IRenderPass** ppRenderPass) override final;
+ /// Implementation of IRenderDevice::CreateFramebuffer() in Direct3D12 backend.
+ virtual void DILIGENT_CALL_TYPE CreateFramebuffer(const FramebufferDesc& Desc,
+ IFramebuffer** ppFramebuffer) override final;
+
/// Implementation of IRenderDeviceD3D12::GetD3D12Device().
virtual ID3D12Device* DILIGENT_CALL_TYPE GetD3D12Device() override final { return m_pd3d12Device; }
diff --git a/Graphics/GraphicsEngineD3D12/src/FramebufferD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/FramebufferD3D12Impl.cpp
new file mode 100644
index 00000000..38b8b956
--- /dev/null
+++ b/Graphics/GraphicsEngineD3D12/src/FramebufferD3D12Impl.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 "FramebufferD3D12Impl.hpp"
+#include "EngineMemory.h"
+
+namespace Diligent
+{
+
+FramebufferD3D12Impl::FramebufferD3D12Impl(IReferenceCounters* pRefCounters,
+ RenderDeviceD3D12Impl* pDevice,
+ const FramebufferDesc& Desc) :
+ TFramebufferBase{pRefCounters, pDevice, Desc}
+{
+}
+
+FramebufferD3D12Impl::~FramebufferD3D12Impl()
+{
+}
+
+} // namespace Diligent
diff --git a/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp
index f1d00587..381ecb95 100644
--- a/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp
@@ -39,6 +39,7 @@
#include "FenceD3D12Impl.hpp"
#include "QueryD3D12Impl.hpp"
#include "RenderPassD3D12Impl.hpp"
+#include "FramebufferD3D12Impl.hpp"
#include "EngineMemory.h"
namespace Diligent
@@ -111,7 +112,8 @@ RenderDeviceD3D12Impl::RenderDeviceD3D12Impl(IReferenceCounters* pRefCo
sizeof(ShaderResourceBindingD3D12Impl),
sizeof(FenceD3D12Impl),
sizeof(QueryD3D12Impl),
- sizeof(RenderPassD3D12Impl)
+ sizeof(RenderPassD3D12Impl),
+ sizeof(FramebufferD3D12Impl)
}
},
m_pd3d12Device {pd3d12Device},
@@ -535,6 +537,17 @@ void RenderDeviceD3D12Impl::CreateRenderPass(const RenderPassDesc& Desc, IRender
});
}
+void RenderDeviceD3D12Impl::CreateFramebuffer(const FramebufferDesc& Desc, IFramebuffer** ppFramebuffer)
+{
+ CreateDeviceObject("Framebuffer", Desc, ppFramebuffer,
+ [&]() //
+ {
+ FramebufferD3D12Impl* pFramebufferD3D12(NEW_RC_OBJ(m_FramebufferAllocator, "FramebufferD3D12Impl instance", FramebufferD3D12Impl)(this, Desc));
+ pFramebufferD3D12->QueryInterface(IID_Framebuffer, reinterpret_cast<IObject**>(ppFramebuffer));
+ OnCreateDeviceObject(pFramebufferD3D12);
+ });
+}
+
DescriptorHeapAllocation RenderDeviceD3D12Impl::AllocateDescriptor(D3D12_DESCRIPTOR_HEAP_TYPE Type, UINT Count /*= 1*/)
{
VERIFY(Type >= D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV && Type < D3D12_DESCRIPTOR_HEAP_TYPE_NUM_TYPES, "Invalid heap type");
diff --git a/Graphics/GraphicsEngineMetal/include/FramebufferMtlImpl.h b/Graphics/GraphicsEngineMetal/include/FramebufferMtlImpl.h
new file mode 100644
index 00000000..8bbde9c7
--- /dev/null
+++ b/Graphics/GraphicsEngineMetal/include/FramebufferMtlImpl.h
@@ -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::FramebufferMtlImpl class
+
+#include "RenderDeviceMtl.h"
+#include "FramebufferBase.hpp"
+#include "RenderDeviceMtlImpl.hpp"
+
+namespace Diligent
+{
+
+class FixedBlockMemoryAllocator;
+
+/// Render pass implementation in Direct3D11 backend.
+class FramebufferMtlImpl final : public FramebufferBase<IFramebuffer, RenderDeviceMtlImpl>
+{
+public:
+ using TFramebufferBase = FramebufferBase<IFramebuffer, RenderDeviceMtlImpl>;
+
+ FramebufferMtlImpl(IReferenceCounters* pRefCounters,
+ RenderDeviceMtlImpl* pDevice,
+ const FramebufferDesc& Desc);
+ ~FramebufferMtlImpl();
+};
+
+} // namespace Diligent
diff --git a/Graphics/GraphicsEngineMetal/include/RenderDeviceMtlImpl.h b/Graphics/GraphicsEngineMetal/include/RenderDeviceMtlImpl.h
index 1a5693bb..5080ea59 100644
--- a/Graphics/GraphicsEngineMetal/include/RenderDeviceMtlImpl.h
+++ b/Graphics/GraphicsEngineMetal/include/RenderDeviceMtlImpl.h
@@ -63,6 +63,8 @@ public:
virtual void CreateRenderPass(const RenderPassDesc& Desc, IRenderPass** ppRenderPass) override final;
+ virtual void CreateFramebuffer(const FramebufferDesc& Desc, IFramebuffer** ppFramebuffer) override final;
+
virtual void ReleaseStaleResources(bool ForceRelease = false) override final {}
virtual void IdleGPU() override final;
diff --git a/Graphics/GraphicsEngineMetal/src/FramebufferMtlImpl.mm b/Graphics/GraphicsEngineMetal/src/FramebufferMtlImpl.mm
new file mode 100644
index 00000000..6cac14a6
--- /dev/null
+++ b/Graphics/GraphicsEngineMetal/src/FramebufferMtlImpl.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 "FramebufferMtlImpl.h"
+#include "EngineMemory.h"
+
+namespace Diligent
+{
+
+FramebufferMtlImpl :: FramebufferMtlImpl(IReferenceCounters* pRefCounters,
+ RenderDeviceMtlImpl* pDevice,
+ const FramebufferDesc& Desc) :
+ TQueryBase(pRefCounters, pDevice, Desc)
+{
+}
+
+FramebufferMtlImpl :: ~FramebufferMtlImpl()
+{
+}
+
+}
diff --git a/Graphics/GraphicsEngineMetal/src/RenderDeviceMtlImpl.mm b/Graphics/GraphicsEngineMetal/src/RenderDeviceMtlImpl.mm
index 7e7e57c5..93a98e6b 100644
--- a/Graphics/GraphicsEngineMetal/src/RenderDeviceMtlImpl.mm
+++ b/Graphics/GraphicsEngineMetal/src/RenderDeviceMtlImpl.mm
@@ -33,6 +33,7 @@
#include "ShaderResourceBindingMtlImpl.h"
#include "FenceMtlImpl.h"
#include "RenderPassMtlImpl.h"
+#include "FramebufferMtlImpl.h"
#include "EngineMemory.h"
namespace Diligent
@@ -60,7 +61,8 @@ RenderDeviceMtlImpl :: RenderDeviceMtlImpl(IReferenceCounters* pRefCounte
sizeof(PipelineStateMtlImpl),
sizeof(ShaderResourceBindingMtlImpl),
sizeof(FenceMtlImpl),
- sizeof(RenderPassMtlImpl)
+ sizeof(RenderPassMtlImpl),
+ sizeof(FramebufferMtlImpl)
}
},
m_EngineAttribs(EngineAttribs)
@@ -199,6 +201,19 @@ void RenderDeviceMtlImpl::CreateRenderPass(const RenderPassDesc& Desc, IRenderPa
);
}
+void RenderDeviceMtlImpl::CreateFramebuffer(const FramebufferDesc& Desc, IFramebuffer** ppFramebuffer)
+{
+ CreateDeviceObject( "Framebuffer", Desc, ppFramebuffer,
+ [&]()
+ {
+ FramebufferMtlImpl* pFramebufferMtl( NEW_RC_OBJ(m_FramebufferAllocator, "FramebufferMtlImpl instance", FramebufferMtlImpl)
+ (this, Desc) );
+ pFramebufferMtl->QueryInterface( IID_Framebuffer, reinterpret_cast<IObject**>(ppFramebuffer) );
+ OnCreateDeviceObject( pFramebufferMtl );
+ }
+ );
+}
+
void RenderDeviceMtlImpl::IdleGPU()
{
LOG_ERROR_MESSAGE("RenderDeviceMtlImpl::IdleGPU() is not implemented");
diff --git a/Graphics/GraphicsEngineOpenGL/CMakeLists.txt b/Graphics/GraphicsEngineOpenGL/CMakeLists.txt
index 52251b68..76c51a8c 100644
--- a/Graphics/GraphicsEngineOpenGL/CMakeLists.txt
+++ b/Graphics/GraphicsEngineOpenGL/CMakeLists.txt
@@ -9,6 +9,7 @@ set(INCLUDE
include/DeviceContextGLImpl.hpp
include/FBOCache.hpp
include/FenceGLImpl.hpp
+ include/FramebufferGLImpl.hpp
include/GLContext.hpp
include/GLContextState.hpp
include/GLObjectWrapper.hpp
@@ -63,6 +64,7 @@ set(SOURCE
src/EngineFactoryOpenGL.cpp
src/FBOCache.cpp
src/FenceGLImpl.cpp
+ src/FramebufferGLImpl.cpp
src/GLContextState.cpp
src/GLObjectWrapper.cpp
src/GLProgramResourceCache.cpp
diff --git a/Graphics/GraphicsEngineOpenGL/include/FramebufferGLImpl.hpp b/Graphics/GraphicsEngineOpenGL/include/FramebufferGLImpl.hpp
new file mode 100644
index 00000000..8144ffe3
--- /dev/null
+++ b/Graphics/GraphicsEngineOpenGL/include/FramebufferGLImpl.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::FramebufferGLImpl class
+
+#include "RenderDeviceGL.h"
+#include "FramebufferBase.hpp"
+#include "RenderDeviceGLImpl.hpp"
+
+namespace Diligent
+{
+
+class FixedBlockMemoryAllocator;
+
+/// Render pass implementation in Direct3D11 backend.
+class FramebufferGLImpl final : public FramebufferBase<IFramebuffer, RenderDeviceGLImpl>
+{
+public:
+ using TFramebufferBase = FramebufferBase<IFramebuffer, RenderDeviceGLImpl>;
+
+ FramebufferGLImpl(IReferenceCounters* pRefCounters,
+ RenderDeviceGLImpl* pDevice,
+ const FramebufferDesc& Desc);
+ ~FramebufferGLImpl();
+};
+
+} // namespace Diligent
diff --git a/Graphics/GraphicsEngineOpenGL/include/RenderDeviceGLImpl.hpp b/Graphics/GraphicsEngineOpenGL/include/RenderDeviceGLImpl.hpp
index 39084c3e..dbdb51c8 100644
--- a/Graphics/GraphicsEngineOpenGL/include/RenderDeviceGLImpl.hpp
+++ b/Graphics/GraphicsEngineOpenGL/include/RenderDeviceGLImpl.hpp
@@ -117,6 +117,10 @@ public:
virtual void DILIGENT_CALL_TYPE CreateRenderPass(const RenderPassDesc& Desc,
IRenderPass** ppRenderPass) override final;
+ /// Implementation of IRenderDevice::CreateFramebuffer() in OpenGL backend.
+ virtual void DILIGENT_CALL_TYPE CreateFramebuffer(const FramebufferDesc& Desc,
+ IFramebuffer** ppFramebuffer) override final;
+
/// Implementation of IRenderDeviceGL::CreateTextureFromGLHandle().
virtual void DILIGENT_CALL_TYPE CreateTextureFromGLHandle(Uint32 GLHandle,
Uint32 GLBindTarget,
diff --git a/Graphics/GraphicsEngineOpenGL/src/FramebufferGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/FramebufferGLImpl.cpp
new file mode 100644
index 00000000..6ec1d1f1
--- /dev/null
+++ b/Graphics/GraphicsEngineOpenGL/src/FramebufferGLImpl.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 "FramebufferGLImpl.hpp"
+#include "EngineMemory.h"
+
+namespace Diligent
+{
+
+FramebufferGLImpl::FramebufferGLImpl(IReferenceCounters* pRefCounters,
+ RenderDeviceGLImpl* pDevice,
+ const FramebufferDesc& Desc) :
+ TFramebufferBase{pRefCounters, pDevice, Desc}
+{
+}
+
+FramebufferGLImpl::~FramebufferGLImpl()
+{
+}
+
+} // namespace Diligent
diff --git a/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp
index bc38d364..6506c5df 100644
--- a/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp
+++ b/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp
@@ -47,6 +47,7 @@
#include "FenceGLImpl.hpp"
#include "QueryGLImpl.hpp"
#include "RenderPassGLImpl.hpp"
+#include "FramebufferGLImpl.hpp"
#include "EngineMemory.h"
#include "StringTools.hpp"
@@ -77,7 +78,8 @@ RenderDeviceGLImpl::RenderDeviceGLImpl(IReferenceCounters* pRefCounters,
sizeof(ShaderResourceBindingGLImpl),
sizeof(FenceGLImpl),
sizeof(QueryGLImpl),
- sizeof(RenderPassGLImpl)
+ sizeof(RenderPassGLImpl),
+ sizeof(FramebufferGLImpl)
}
},
// Device caps must be filled in before the constructor of Pipeline Cache is called!
@@ -530,6 +532,17 @@ void RenderDeviceGLImpl::CreateRenderPass(const RenderPassDesc& Desc, IRenderPas
);
}
+void RenderDeviceGLImpl::CreateFramebuffer(const FramebufferDesc& Desc, IFramebuffer** ppFramebuffer)
+{
+ CreateDeviceObject("Framebuffer", Desc, ppFramebuffer,
+ [&]() //
+ {
+ FramebufferGLImpl* pFramebufferGL(NEW_RC_OBJ(m_FramebufferAllocator, "FramebufferGLImpl instance", FramebufferGLImpl)(this, Desc));
+ pFramebufferGL->QueryInterface(IID_Framebuffer, reinterpret_cast<IObject**>(ppFramebuffer));
+ OnCreateDeviceObject(pFramebufferGL);
+ });
+}
+
bool RenderDeviceGLImpl::CheckExtension(const Char* ExtensionString)
{
return m_ExtensionStrings.find(ExtensionString) != m_ExtensionStrings.end();
diff --git a/Graphics/GraphicsEngineVulkan/CMakeLists.txt b/Graphics/GraphicsEngineVulkan/CMakeLists.txt
index 102044b7..26e89bba 100644
--- a/Graphics/GraphicsEngineVulkan/CMakeLists.txt
+++ b/Graphics/GraphicsEngineVulkan/CMakeLists.txt
@@ -11,6 +11,7 @@ set(INCLUDE
include/DescriptorPoolManager.hpp
include/DeviceContextVkImpl.hpp
include/FenceVkImpl.hpp
+ include/FramebufferVkImpl.hpp
include/VulkanDynamicHeap.hpp
include/FramebufferCache.hpp
include/GenerateMipsVkHelper.hpp
@@ -80,6 +81,7 @@ set(SRC
src/DeviceContextVkImpl.cpp
src/EngineFactoryVk.cpp
src/FenceVkImpl.cpp
+ src/FramebufferVkImpl.cpp
src/VulkanDynamicHeap.cpp
src/FramebufferCache.cpp
src/GenerateMipsVkHelper.cpp
diff --git a/Graphics/GraphicsEngineVulkan/include/FramebufferVkImpl.hpp b/Graphics/GraphicsEngineVulkan/include/FramebufferVkImpl.hpp
new file mode 100644
index 00000000..63e56496
--- /dev/null
+++ b/Graphics/GraphicsEngineVulkan/include/FramebufferVkImpl.hpp
@@ -0,0 +1,53 @@
+/*
+ * 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::FramebufferVkImpl class
+
+#include "FramebufferBase.hpp"
+#include "RenderDeviceVkImpl.hpp"
+
+namespace Diligent
+{
+
+class FixedBlockMemoryAllocator;
+
+/// Render pass implementation in Direct3D11 backend.
+class FramebufferVkImpl final : public FramebufferBase<IFramebuffer, RenderDeviceVkImpl>
+{
+public:
+ using TFramebufferBase = FramebufferBase<IFramebuffer, RenderDeviceVkImpl>;
+
+ FramebufferVkImpl(IReferenceCounters* pRefCounters,
+ RenderDeviceVkImpl* pDevice,
+ const FramebufferDesc& Desc);
+ ~FramebufferVkImpl();
+};
+
+} // namespace Diligent
diff --git a/Graphics/GraphicsEngineVulkan/include/RenderDeviceVkImpl.hpp b/Graphics/GraphicsEngineVulkan/include/RenderDeviceVkImpl.hpp
index f339e33e..6ec79aad 100644
--- a/Graphics/GraphicsEngineVulkan/include/RenderDeviceVkImpl.hpp
+++ b/Graphics/GraphicsEngineVulkan/include/RenderDeviceVkImpl.hpp
@@ -102,6 +102,10 @@ public:
virtual void DILIGENT_CALL_TYPE CreateRenderPass(const RenderPassDesc& Desc,
IRenderPass** ppRenderPass) override final;
+ /// Implementation of IRenderDevice::CreateFramebuffer() in Vulkan backend.
+ virtual void DILIGENT_CALL_TYPE CreateFramebuffer(const FramebufferDesc& Desc,
+ IFramebuffer** ppFramebuffer) override final;
+
/// Implementation of IRenderDeviceVk::GetVkDevice().
virtual VkDevice DILIGENT_CALL_TYPE GetVkDevice() override final { return m_LogicalVkDevice->GetVkDevice(); }
diff --git a/Graphics/GraphicsEngineVulkan/src/FramebufferVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/FramebufferVkImpl.cpp
new file mode 100644
index 00000000..ba515950
--- /dev/null
+++ b/Graphics/GraphicsEngineVulkan/src/FramebufferVkImpl.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 "FramebufferVkImpl.hpp"
+#include "EngineMemory.h"
+
+namespace Diligent
+{
+
+FramebufferVkImpl::FramebufferVkImpl(IReferenceCounters* pRefCounters,
+ RenderDeviceVkImpl* pDevice,
+ const FramebufferDesc& Desc) :
+ TFramebufferBase{pRefCounters, pDevice, Desc}
+{
+}
+
+FramebufferVkImpl::~FramebufferVkImpl()
+{
+}
+
+} // namespace Diligent
diff --git a/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp
index 012cb58f..d5f38ade 100644
--- a/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp
@@ -38,6 +38,7 @@
#include "FenceVkImpl.hpp"
#include "QueryVkImpl.hpp"
#include "RenderPassVkImpl.hpp"
+#include "FramebufferVkImpl.hpp"
#include "EngineMemory.h"
namespace Diligent
@@ -73,7 +74,8 @@ RenderDeviceVkImpl::RenderDeviceVkImpl(IReferenceCounters*
sizeof(ShaderResourceBindingVkImpl),
sizeof(FenceVkImpl),
sizeof(QueryVkImpl),
- sizeof(RenderPassVkImpl)
+ sizeof(RenderPassVkImpl),
+ sizeof(FramebufferVkImpl)
}
},
m_VulkanInstance {Instance },
@@ -633,4 +635,15 @@ void RenderDeviceVkImpl::CreateRenderPass(const RenderPassDesc& Desc, IRenderPas
);
}
+void RenderDeviceVkImpl::CreateFramebuffer(const FramebufferDesc& Desc, IFramebuffer** ppFramebuffer)
+{
+ CreateDeviceObject("Framebuffer", Desc, ppFramebuffer,
+ [&]() //
+ {
+ FramebufferVkImpl* pFramebufferVk(NEW_RC_OBJ(m_FramebufferAllocator, "FramebufferVkImpl instance", FramebufferVkImpl)(this, Desc));
+ pFramebufferVk->QueryInterface(IID_Framebuffer, reinterpret_cast<IObject**>(ppFramebuffer));
+ OnCreateDeviceObject(pFramebufferVk);
+ });
+}
+
} // namespace Diligent