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