From d3748a48ea2718444e710a668664b0ad7b65a371 Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Sat, 3 Feb 2018 10:20:05 -0800 Subject: Updated Engine GL initialization --- Projects/Asteroids/src/asteroids_DE.cpp | 10 ++++++---- .../PluginSource/src/RenderAPI_OpenGLCoreES.cpp | 2 +- unityplugin/UnityEmulator/src/DiligentGraphicsAdapterGL.cpp | 13 ++++++++++--- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/Projects/Asteroids/src/asteroids_DE.cpp b/Projects/Asteroids/src/asteroids_DE.cpp index 7593f36..d620d29 100644 --- a/Projects/Asteroids/src/asteroids_DE.cpp +++ b/Projects/Asteroids/src/asteroids_DE.cpp @@ -51,8 +51,6 @@ namespace AsteroidsDE { // Create Direct3D device and swap chain void Asteroids::InitDevice(HWND hWnd, DeviceType DevType) { - EngineCreationAttribs EngineCreationAttribs; - EngineCreationAttribs.strShaderCachePath = "bin\\tmp\\ShaderCache"; SwapChainDesc SwapChainDesc; SwapChainDesc.SamplesCount = 1; SwapChainDesc.BufferCount = NUM_SWAP_CHAIN_BUFFERS; @@ -104,14 +102,18 @@ void Asteroids::InitDevice(HWND hWnd, DeviceType DevType) break; case DeviceType::OpenGL: + { #ifdef ENGINE_DLL - if(GetEngineFactoryOpenGL == nullptr) + if (GetEngineFactoryOpenGL == nullptr) { LoadGraphicsEngineOpenGL(GetEngineFactoryOpenGL); } #endif + EngineGLAttribs CreationAttribs; + CreationAttribs.pNativeWndHandle = hWnd; GetEngineFactoryOpenGL()->CreateDeviceAndSwapChainGL( - EngineCreationAttribs, &mDevice, &mDeviceCtxt, SwapChainDesc, hWnd, &mSwapChain ); + CreationAttribs, &mDevice, &mDeviceCtxt, SwapChainDesc, &mSwapChain); + } break; default: diff --git a/unityplugin/GhostCubePlugin/PluginSource/src/RenderAPI_OpenGLCoreES.cpp b/unityplugin/GhostCubePlugin/PluginSource/src/RenderAPI_OpenGLCoreES.cpp index 2a07cc2..b5e1a0c 100644 --- a/unityplugin/GhostCubePlugin/PluginSource/src/RenderAPI_OpenGLCoreES.cpp +++ b/unityplugin/GhostCubePlugin/PluginSource/src/RenderAPI_OpenGLCoreES.cpp @@ -49,7 +49,7 @@ void RenderAPI_OpenGLCoreES::ProcessDeviceEvent(UnityGfxDeviceEventType type, IU if (type == kUnityGfxDeviceEventInitialize) { auto *pFactoryGL = GetEngineFactoryOpenGL(); - EngineCreationAttribs Attribs; + EngineGLAttribs Attribs; pFactoryGL->AttachToActiveGLContext(Attribs, &m_Device, &m_Context); if (m_Context) { diff --git a/unityplugin/UnityEmulator/src/DiligentGraphicsAdapterGL.cpp b/unityplugin/UnityEmulator/src/DiligentGraphicsAdapterGL.cpp index b9ab052..9a8a164 100644 --- a/unityplugin/UnityEmulator/src/DiligentGraphicsAdapterGL.cpp +++ b/unityplugin/UnityEmulator/src/DiligentGraphicsAdapterGL.cpp @@ -6,17 +6,19 @@ #include "RenderDeviceFactoryOpenGL.h" #include "SwapChainBase.h" #include "DefaultRawMemoryAllocator.h" + #include "UnityGraphicsGL_Impl.h" +#include "SwapChainGL.h" using namespace Diligent; namespace { -class ProxySwapChainGL : public SwapChainBase +class ProxySwapChainGL : public SwapChainBase { public: - using TBase = SwapChainBase; + using TBase = SwapChainBase; ProxySwapChainGL( IReferenceCounters *pRefCounters, IRenderDevice *pDevice, @@ -34,6 +36,11 @@ public: { TBase::Resize(NewWidth, NewHeight, 0); } + + virtual GLuint GetDefaultFBO()const override final + { + return 0; + } }; } @@ -44,7 +51,7 @@ DiligentGraphicsAdapterGL::DiligentGraphicsAdapterGL(const UnityGraphicsGLCoreES auto *UnityGraphicsGLImpl = UnityGraphicsGL.GetGraphicsImpl(); auto *pFactoryGL = GetEngineFactoryOpenGL(); - EngineCreationAttribs Attribs; + EngineGLAttribs Attribs; pFactoryGL->AttachToActiveGLContext(Attribs, &m_pDevice, &m_pDeviceCtx); auto BackBufferGLFormat = UnityGraphicsGLImpl->GetBackBufferFormat(); -- cgit v1.2.3 From 361c532902072fcc9cb5dc175d5515aed8b3366b Mon Sep 17 00:00:00 2001 From: Egor Date: Sat, 3 Feb 2018 12:23:48 -0800 Subject: Updated submodules --- DiligentCore | 2 +- DiligentSamples | 2 +- DiligentTools | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/DiligentCore b/DiligentCore index ac71537..e5d695a 160000 --- a/DiligentCore +++ b/DiligentCore @@ -1 +1 @@ -Subproject commit ac71537172ba593b2525bbe85e0116c6703ed6e8 +Subproject commit e5d695a20e555cb50435c8c82adcb809d6a2c0cf diff --git a/DiligentSamples b/DiligentSamples index a3319de..3033f82 160000 --- a/DiligentSamples +++ b/DiligentSamples @@ -1 +1 @@ -Subproject commit a3319de427b1f2c83634bc6e0e1f65aa0b16b86b +Subproject commit 3033f82f8af05924c44e2381c036b4eac9eb8002 diff --git a/DiligentTools b/DiligentTools index 541d563..1875b56 160000 --- a/DiligentTools +++ b/DiligentTools @@ -1 +1 @@ -Subproject commit 541d563ee11d4ffe8b0a8e93d534256a28f83a13 +Subproject commit 1875b565d5e305a8991cd2ea4e92d654f2b1b70d -- cgit v1.2.3 From 6e48bb2c6f41f821a9f88a0d5a604b24a0a04639 Mon Sep 17 00:00:00 2001 From: Egor Date: Sat, 3 Feb 2018 12:29:40 -0800 Subject: Updated Core submodule --- DiligentCore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DiligentCore b/DiligentCore index e5d695a..aa4aef2 160000 --- a/DiligentCore +++ b/DiligentCore @@ -1 +1 @@ -Subproject commit e5d695a20e555cb50435c8c82adcb809d6a2c0cf +Subproject commit aa4aef2e2ca5558a2c945f351cb82c3d3d322e36 -- cgit v1.2.3 From f388a101a8724a04851af9a4a4beb19edbde323e Mon Sep 17 00:00:00 2001 From: Egor Date: Sat, 3 Feb 2018 12:35:22 -0800 Subject: Updated core submodule --- DiligentCore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DiligentCore b/DiligentCore index aa4aef2..06a339f 160000 --- a/DiligentCore +++ b/DiligentCore @@ -1 +1 @@ -Subproject commit aa4aef2e2ca5558a2c945f351cb82c3d3d322e36 +Subproject commit 06a339f9f08827001eb77c6b0216c0fb8237d78d -- cgit v1.2.3