summaryrefslogtreecommitdiffstats
path: root/unityplugin/UnityEmulator
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-02-12 17:29:47 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-02-12 17:51:40 +0000
commit93807ee42f29379bba55de875cb23af511d5b65f (patch)
tree81a38d99c4f849525064c14741c68517ffc73a37 /unityplugin/UnityEmulator
parentAdded dev team for iOS build (diff)
downloadDiligentEngine-93807ee42f29379bba55de875cb23af511d5b65f.tar.gz
DiligentEngine-93807ee42f29379bba55de875cb23af511d5b65f.zip
Fixed unity emulator on iOS
Diffstat (limited to 'unityplugin/UnityEmulator')
-rw-r--r--unityplugin/UnityEmulator/src/DiligentGraphicsAdapterGL.cpp13
-rw-r--r--unityplugin/UnityEmulator/src/UnityAppBase.cpp5
2 files changed, 13 insertions, 5 deletions
diff --git a/unityplugin/UnityEmulator/src/DiligentGraphicsAdapterGL.cpp b/unityplugin/UnityEmulator/src/DiligentGraphicsAdapterGL.cpp
index 9a8a164..3779bca 100644
--- a/unityplugin/UnityEmulator/src/DiligentGraphicsAdapterGL.cpp
+++ b/unityplugin/UnityEmulator/src/DiligentGraphicsAdapterGL.cpp
@@ -21,10 +21,12 @@ public:
using TBase = SwapChainBase<ISwapChainGL>;
ProxySwapChainGL( IReferenceCounters *pRefCounters,
+ const UnityGraphicsGLCoreES_Emulator& UnityGraphicsGL,
IRenderDevice *pDevice,
IDeviceContext *pDeviceContext,
const SwapChainDesc& SCDesc ) :
- TBase(pRefCounters, pDevice, pDeviceContext,SCDesc)
+ TBase(pRefCounters, pDevice, pDeviceContext,SCDesc),
+ m_UnityGraphicsGL(UnityGraphicsGL)
{}
virtual void Present()override final
@@ -39,8 +41,11 @@ public:
virtual GLuint GetDefaultFBO()const override final
{
- return 0;
+ return m_UnityGraphicsGL.GetGraphicsImpl()->GetDefaultFBO();
}
+
+private:
+ const UnityGraphicsGLCoreES_Emulator& m_UnityGraphicsGL;
};
}
@@ -83,7 +88,7 @@ DiligentGraphicsAdapterGL::DiligentGraphicsAdapterGL(const UnityGraphicsGLCoreES
SCDesc.BufferCount = 0;
auto &DefaultAllocator = DefaultRawMemoryAllocator::GetAllocator();
- auto pProxySwapChainGL = NEW_RC_OBJ(DefaultAllocator, "ProxySwapChainGL instance", ProxySwapChainGL)(m_pDevice, m_pDeviceCtx, SCDesc);
+ auto pProxySwapChainGL = NEW_RC_OBJ(DefaultAllocator, "ProxySwapChainGL instance", ProxySwapChainGL)(m_UnityGraphicsGL, m_pDevice, m_pDeviceCtx, SCDesc);
pProxySwapChainGL->QueryInterface(IID_SwapChain, reinterpret_cast<IObject**>(static_cast<ISwapChain**>(&m_pProxySwapChain)));
m_pDeviceCtx->SetSwapChain(m_pProxySwapChain);
@@ -107,4 +112,4 @@ bool DiligentGraphicsAdapterGL::UsesReverseZ()
return m_UnityGraphicsGL.UsesReverseZ();
}
-#endif // OPENGL_SUPPORTED \ No newline at end of file
+#endif // OPENGL_SUPPORTED
diff --git a/unityplugin/UnityEmulator/src/UnityAppBase.cpp b/unityplugin/UnityEmulator/src/UnityAppBase.cpp
index e84333b..14a8cfc 100644
--- a/unityplugin/UnityEmulator/src/UnityAppBase.cpp
+++ b/unityplugin/UnityEmulator/src/UnityAppBase.cpp
@@ -243,6 +243,9 @@ void UnityAppBase::WindowResize(int width, int height)
m_DiligentGraphics->PreSwapChainResize();
m_GraphicsEmulator->ResizeSwapChain(width, height);
m_DiligentGraphics->PostSwapChainResize();
- m_Scene->OnWindowResize(width, height);
+ unsigned int SCWidth = 0;
+ unsigned int SCHeight = 0;
+ m_GraphicsEmulator->GetBackBufferSize(SCWidth, SCHeight);
+ m_Scene->OnWindowResize(SCWidth, SCHeight);
}
}