summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineOpenGL
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2019-03-05 06:54:00 +0000
committerEgor Yusov <egor.yusov@gmail.com>2019-03-05 06:54:00 +0000
commit68bb0c88ba7d427550dd9ac5a796ff2d6d05262d (patch)
tree3a9cdda7df26be0b4b2f36acf7cda4e798a754b0 /Graphics/GraphicsEngineOpenGL
parentUpdated D3D11, D3D12, and Vk EngineFactory headers & structures (diff)
downloadDiligentCore-68bb0c88ba7d427550dd9ac5a796ff2d6d05262d.tar.gz
DiligentCore-68bb0c88ba7d427550dd9ac5a796ff2d6d05262d.zip
Updated GL engine factory headers and structures
Diffstat (limited to 'Graphics/GraphicsEngineOpenGL')
-rw-r--r--Graphics/GraphicsEngineOpenGL/CMakeLists.txt5
-rw-r--r--Graphics/GraphicsEngineOpenGL/interface/EngineFactoryOpenGL.h (renamed from Graphics/GraphicsEngineOpenGL/interface/RenderDeviceFactoryOpenGL.h)21
-rw-r--r--Graphics/GraphicsEngineOpenGL/interface/EngineGLAttribs.h48
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/EngineFactoryOpenGL.cpp (renamed from Graphics/GraphicsEngineOpenGL/src/RenderDeviceFactoryOpenGL.cpp)58
4 files changed, 41 insertions, 91 deletions
diff --git a/Graphics/GraphicsEngineOpenGL/CMakeLists.txt b/Graphics/GraphicsEngineOpenGL/CMakeLists.txt
index bfde3d05..6f69366b 100644
--- a/Graphics/GraphicsEngineOpenGL/CMakeLists.txt
+++ b/Graphics/GraphicsEngineOpenGL/CMakeLists.txt
@@ -39,10 +39,9 @@ set(INTERFACE
interface/BufferGL.h
interface/BufferViewGL.h
interface/DeviceContextGL.h
- interface/EngineGLAttribs.h
+ interface/EngineFactoryOpenGL.h
interface/FenceGL.h
interface/PipelineStateGL.h
- interface/RenderDeviceFactoryOpenGL.h
interface/RenderDeviceGL.h
interface/SamplerGL.h
interface/ShaderGL.h
@@ -56,6 +55,7 @@ set(SOURCE
src/BufferGLImpl.cpp
src/BufferViewGLImpl.cpp
src/DeviceContextGLImpl.cpp
+ src/EngineFactoryOpenGL.cpp
src/FBOCache.cpp
src/FenceGLImpl.cpp
src/GLContextState.cpp
@@ -64,7 +64,6 @@ set(SOURCE
src/GLProgramResources.cpp
src/GLTypeConversions.cpp
src/PipelineStateGLImpl.cpp
- src/RenderDeviceFactoryOpenGL.cpp
src/RenderDeviceGLImpl.cpp
src/SamplerGLImpl.cpp
src/ShaderGLImpl.cpp
diff --git a/Graphics/GraphicsEngineOpenGL/interface/RenderDeviceFactoryOpenGL.h b/Graphics/GraphicsEngineOpenGL/interface/EngineFactoryOpenGL.h
index 93b8d8f4..63627856 100644
--- a/Graphics/GraphicsEngineOpenGL/interface/RenderDeviceFactoryOpenGL.h
+++ b/Graphics/GraphicsEngineOpenGL/interface/EngineFactoryOpenGL.h
@@ -34,7 +34,6 @@
#include "../../HLSL2GLSLConverterLib/interface/HLSL2GLSLConverter.h"
-#include "EngineGLAttribs.h"
#if PLATFORM_ANDROID || PLATFORM_LINUX || PLATFORM_MACOS || PLATFORM_IOS || (PLATFORM_WIN32 && !defined(_MSC_VER))
@@ -55,16 +54,16 @@ namespace Diligent
class IEngineFactoryOpenGL
{
public:
- virtual void CreateDeviceAndSwapChainGL(const EngineGLAttribs& CreationAttribs,
- IRenderDevice **ppDevice,
- IDeviceContext **ppImmediateContext,
- const SwapChainDesc& SCDesc,
- ISwapChain **ppSwapChain ) = 0;
- virtual void CreateHLSL2GLSLConverter(IHLSL2GLSLConverter **ppConverter) = 0;
+ virtual void CreateDeviceAndSwapChainGL(const EngineGLCreateInfo& EngineCI,
+ IRenderDevice** ppDevice,
+ IDeviceContext** ppImmediateContext,
+ const SwapChainDesc& SCDesc,
+ ISwapChain** ppSwapChain ) = 0;
+ virtual void CreateHLSL2GLSLConverter(IHLSL2GLSLConverter** ppConverter) = 0;
- virtual void AttachToActiveGLContext( const EngineGLAttribs& CreationAttribs,
- IRenderDevice **ppDevice,
- IDeviceContext **ppImmediateContext ) = 0;
+ virtual void AttachToActiveGLContext(const EngineGLCreateInfo& EngineCI,
+ IRenderDevice** ppDevice,
+ IDeviceContext** ppImmediateContext) = 0;
};
@@ -74,7 +73,7 @@ public:
typedef IEngineFactoryOpenGL* (*GetEngineFactoryOpenGLType)();
- static bool LoadGraphicsEngineOpenGL(GetEngineFactoryOpenGLType &GetFactoryFunc)
+ static bool LoadGraphicsEngineOpenGL(GetEngineFactoryOpenGLType& GetFactoryFunc)
{
GetFactoryFunc = nullptr;
std::string LibName = "GraphicsEngineOpenGL_";
diff --git a/Graphics/GraphicsEngineOpenGL/interface/EngineGLAttribs.h b/Graphics/GraphicsEngineOpenGL/interface/EngineGLAttribs.h
deleted file mode 100644
index 89fd0590..00000000
--- a/Graphics/GraphicsEngineOpenGL/interface/EngineGLAttribs.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* 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.
- */
-
-#pragma once
-
-/// \file
-/// Definition of the Engine OpenGL/GLES attribs
-
-#include "../../GraphicsEngine/interface/GraphicsTypes.h"
-
-namespace Diligent
-{
- /// Attributes of the OpenGL-based engine implementation
- struct EngineGLAttribs : public EngineCreationAttribs
- {
- /// Native window handle
-
- /// * On Win32 platform, this is a window handle (HWND)
- /// * On Android platform, this is a pointer to the native window (ANativeWindow*)
- /// * On Linux, this is the native window (Window)
- void *pNativeWndHandle = nullptr;
-
-#if PLATFORM_LINUX
- /// For linux platform only, this is the pointer to the display
- void *pDisplay = nullptr;
-#endif
- };
-}
diff --git a/Graphics/GraphicsEngineOpenGL/src/RenderDeviceFactoryOpenGL.cpp b/Graphics/GraphicsEngineOpenGL/src/EngineFactoryOpenGL.cpp
index 474f914e..04d1ce83 100644
--- a/Graphics/GraphicsEngineOpenGL/src/RenderDeviceFactoryOpenGL.cpp
+++ b/Graphics/GraphicsEngineOpenGL/src/EngineFactoryOpenGL.cpp
@@ -67,24 +67,24 @@ public:
return &TheFactory;
}
- virtual void CreateDeviceAndSwapChainGL(const EngineGLAttribs& CreationAttribs,
- IRenderDevice **ppDevice,
- IDeviceContext **ppImmediateContext,
- const SwapChainDesc& SCDesc,
- ISwapChain **ppSwapChain )override final;
+ virtual void CreateDeviceAndSwapChainGL(const EngineGLCreateInfo& EngineCI,
+ IRenderDevice** ppDevice,
+ IDeviceContext** ppImmediateContext,
+ const SwapChainDesc& SCDesc,
+ ISwapChain** ppSwapChain )override final;
- virtual void CreateHLSL2GLSLConverter(IHLSL2GLSLConverter **ppConverter)override final;
+ virtual void CreateHLSL2GLSLConverter(IHLSL2GLSLConverter** ppConverter)override final;
- virtual void AttachToActiveGLContext( const EngineGLAttribs& CreationAttribs,
- IRenderDevice **ppDevice,
- IDeviceContext **ppImmediateContext )override final;
+ virtual void AttachToActiveGLContext(const EngineGLCreateInfo& EngineCI,
+ IRenderDevice** ppDevice,
+ IDeviceContext** ppImmediateContext )override final;
};
/// Creates render device, device context and swap chain for OpenGL/GLES-based engine implementation
-/// \param [in] CreationAttribs - Engine creation attributes.
+/// \param [in] EngineCI - Engine creation attributes.
/// \param [out] ppDevice - Address of the memory location where pointer to
/// the created device will be written.
/// \param [out] ppImmediateContext - Address of the memory location where pointers to
@@ -92,14 +92,14 @@ public:
/// \param [in] SCDesc - Swap chain description.
/// \param [out] ppSwapChain - Address of the memory location where pointer to the new
/// swap chain will be written.
-void EngineFactoryOpenGLImpl::CreateDeviceAndSwapChainGL(const EngineGLAttribs& CreationAttribs,
- IRenderDevice **ppDevice,
- IDeviceContext **ppImmediateContext,
- const SwapChainDesc& SCDesc,
- ISwapChain **ppSwapChain )
+void EngineFactoryOpenGLImpl::CreateDeviceAndSwapChainGL(const EngineGLCreateInfo& EngineCI,
+ IRenderDevice** ppDevice,
+ IDeviceContext** ppImmediateContext,
+ const SwapChainDesc& SCDesc,
+ ISwapChain** ppSwapChain)
{
- if (CreationAttribs.DebugMessageCallback != nullptr)
- SetDebugMessageCallback(CreationAttribs.DebugMessageCallback);
+ if (EngineCI.DebugMessageCallback != nullptr)
+ SetDebugMessageCallback(EngineCI.DebugMessageCallback);
VERIFY( ppDevice && ppImmediateContext && ppSwapChain, "Null pointer provided" );
if( !ppDevice || !ppImmediateContext || !ppSwapChain )
@@ -111,10 +111,10 @@ void EngineFactoryOpenGLImpl::CreateDeviceAndSwapChainGL(const EngineGLAttribs&
try
{
- SetRawAllocator(CreationAttribs.pRawMemAllocator);
+ SetRawAllocator(EngineCI.pRawMemAllocator);
auto &RawMemAllocator = GetRawAllocator();
- RenderDeviceGLImpl *pRenderDeviceOpenGL( NEW_RC_OBJ(RawMemAllocator, "TRenderDeviceGLImpl instance", TRenderDeviceGLImpl)(RawMemAllocator, CreationAttribs) );
+ RenderDeviceGLImpl *pRenderDeviceOpenGL( NEW_RC_OBJ(RawMemAllocator, "TRenderDeviceGLImpl instance", TRenderDeviceGLImpl)(RawMemAllocator, EngineCI) );
pRenderDeviceOpenGL->QueryInterface(IID_RenderDevice, reinterpret_cast<IObject**>(ppDevice) );
DeviceContextGLImpl *pDeviceContextOpenGL( NEW_RC_OBJ(RawMemAllocator, "DeviceContextGLImpl instance", DeviceContextGLImpl)(pRenderDeviceOpenGL, false ) );
@@ -123,7 +123,7 @@ void EngineFactoryOpenGLImpl::CreateDeviceAndSwapChainGL(const EngineGLAttribs&
pDeviceContextOpenGL->QueryInterface(IID_DeviceContext, reinterpret_cast<IObject**>(ppImmediateContext) );
pRenderDeviceOpenGL->SetImmediateContext(pDeviceContextOpenGL);
- TSwapChain *pSwapChainGL = NEW_RC_OBJ(RawMemAllocator, "SwapChainGLImpl instance", TSwapChain)(CreationAttribs, SCDesc, pRenderDeviceOpenGL, pDeviceContextOpenGL );
+ TSwapChain *pSwapChainGL = NEW_RC_OBJ(RawMemAllocator, "SwapChainGLImpl instance", TSwapChain)(EngineCI, SCDesc, pRenderDeviceOpenGL, pDeviceContextOpenGL );
pSwapChainGL->QueryInterface(IID_SwapChain, reinterpret_cast<IObject**>(ppSwapChain) );
pDeviceContextOpenGL->SetSwapChain(pSwapChainGL);
@@ -158,17 +158,17 @@ void EngineFactoryOpenGLImpl::CreateDeviceAndSwapChainGL(const EngineGLAttribs&
/// Creates render device, device context and attaches to existing GL context
-/// \param [in] CreationAttribs - Engine creation attributes.
+/// \param [in] EngineCI - Engine creation attributes.
/// \param [out] ppDevice - Address of the memory location where pointer to
/// the created device will be written.
/// \param [out] ppImmediateContext - Address of the memory location where pointers to
/// the immediate context will be written.
-void EngineFactoryOpenGLImpl::AttachToActiveGLContext( const EngineGLAttribs& CreationAttribs,
- IRenderDevice **ppDevice,
- IDeviceContext **ppImmediateContext )
+void EngineFactoryOpenGLImpl::AttachToActiveGLContext(const EngineGLCreateInfo& EngineCI,
+ IRenderDevice** ppDevice,
+ IDeviceContext** ppImmediateContext )
{
- if (CreationAttribs.DebugMessageCallback != nullptr)
- SetDebugMessageCallback(CreationAttribs.DebugMessageCallback);
+ if (EngineCI.DebugMessageCallback != nullptr)
+ SetDebugMessageCallback(EngineCI.DebugMessageCallback);
VERIFY( ppDevice && ppImmediateContext, "Null pointer provided" );
if( !ppDevice || !ppImmediateContext )
@@ -179,10 +179,10 @@ void EngineFactoryOpenGLImpl::AttachToActiveGLContext( const EngineGLAttribs& Cr
try
{
- SetRawAllocator(CreationAttribs.pRawMemAllocator);
+ SetRawAllocator(EngineCI.pRawMemAllocator);
auto &RawMemAllocator = GetRawAllocator();
- RenderDeviceGLImpl *pRenderDeviceOpenGL( NEW_RC_OBJ(RawMemAllocator, "TRenderDeviceGLImpl instance", TRenderDeviceGLImpl)(RawMemAllocator, CreationAttribs) );
+ RenderDeviceGLImpl *pRenderDeviceOpenGL( NEW_RC_OBJ(RawMemAllocator, "TRenderDeviceGLImpl instance", TRenderDeviceGLImpl)(RawMemAllocator, EngineCI) );
pRenderDeviceOpenGL->QueryInterface(IID_RenderDevice, reinterpret_cast<IObject**>(ppDevice) );
DeviceContextGLImpl *pDeviceContextOpenGL( NEW_RC_OBJ(RawMemAllocator, "DeviceContextGLImpl instance", DeviceContextGLImpl)(pRenderDeviceOpenGL, false ) );
@@ -228,7 +228,7 @@ void LoadGraphicsEngineOpenGL(GetEngineFactoryOpenGLType &GetFactoryFunc)
}
#endif
-void EngineFactoryOpenGLImpl::CreateHLSL2GLSLConverter(IHLSL2GLSLConverter **ppConverter)
+void EngineFactoryOpenGLImpl::CreateHLSL2GLSLConverter(IHLSL2GLSLConverter** ppConverter)
{
HLSL2GLSLConverterObject *pConverter( NEW_RC_OBJ(GetRawAllocator(), "HLSL2GLSLConverterObject instance", HLSL2GLSLConverterObject)() );
pConverter->QueryInterface( IID_HLSL2GLSLConverter, reinterpret_cast<IObject**>(ppConverter) );