From 16dd04efc73e4093a991a517f786ebaf03f3f6d1 Mon Sep 17 00:00:00 2001 From: assiduous Date: Fri, 24 Jul 2020 21:18:48 -0700 Subject: Added framebuffer object implementation stubs --- Graphics/GraphicsEngineOpenGL/CMakeLists.txt | 2 + .../include/FramebufferGLImpl.hpp | 54 ++++++++++++++++++++++ .../include/RenderDeviceGLImpl.hpp | 4 ++ .../GraphicsEngineOpenGL/src/FramebufferGLImpl.cpp | 47 +++++++++++++++++++ .../src/RenderDeviceGLImpl.cpp | 15 +++++- 5 files changed, 121 insertions(+), 1 deletion(-) create mode 100644 Graphics/GraphicsEngineOpenGL/include/FramebufferGLImpl.hpp create mode 100644 Graphics/GraphicsEngineOpenGL/src/FramebufferGLImpl.cpp (limited to 'Graphics/GraphicsEngineOpenGL') 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 +{ +public: + using TFramebufferBase = FramebufferBase; + + 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(ppFramebuffer)); + OnCreateDeviceObject(pFramebufferGL); + }); +} + bool RenderDeviceGLImpl::CheckExtension(const Char* ExtensionString) { return m_ExtensionStrings.find(ExtensionString) != m_ExtensionStrings.end(); -- cgit v1.2.3