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/GraphicsEngineVulkan | |
| parent | Added IFramebuffer interface (diff) | |
| download | DiligentCore-16dd04efc73e4093a991a517f786ebaf03f3f6d1.tar.gz DiligentCore-16dd04efc73e4093a991a517f786ebaf03f3f6d1.zip | |
Added framebuffer object implementation stubs
Diffstat (limited to 'Graphics/GraphicsEngineVulkan')
5 files changed, 120 insertions, 1 deletions
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 |
