summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineOpenGL
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/GraphicsEngineOpenGL
parentAdded IFramebuffer interface (diff)
downloadDiligentCore-16dd04efc73e4093a991a517f786ebaf03f3f6d1.tar.gz
DiligentCore-16dd04efc73e4093a991a517f786ebaf03f3f6d1.zip
Added framebuffer object implementation stubs
Diffstat (limited to 'Graphics/GraphicsEngineOpenGL')
-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
5 files changed, 121 insertions, 1 deletions
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();