diff options
| author | assiduous <assiduous@diligentgraphics.com> | 2019-12-25 03:23:32 +0000 |
|---|---|---|
| committer | assiduous <assiduous@diligentgraphics.com> | 2019-12-25 03:23:32 +0000 |
| commit | 040e4cb7e454d532d249d2a5de6f2aba0c902baa (patch) | |
| tree | c89a3a009e2d145c3c3cfdb053ad7392eedf6d98 /unityplugin/UnityEmulator | |
| parent | Added codacy bages (diff) | |
| download | DiligentEngine-040e4cb7e454d532d249d2a5de6f2aba0c902baa.tar.gz DiligentEngine-040e4cb7e454d532d249d2a5de6f2aba0c902baa.zip | |
Updated submodules; removed tests folder (tests are now part of every submodule)
Diffstat (limited to 'unityplugin/UnityEmulator')
3 files changed, 27 insertions, 7 deletions
diff --git a/unityplugin/UnityEmulator/src/DiligentGraphicsAdapterD3D11.cpp b/unityplugin/UnityEmulator/src/DiligentGraphicsAdapterD3D11.cpp index c01ff0a..fb1eb4d 100644 --- a/unityplugin/UnityEmulator/src/DiligentGraphicsAdapterD3D11.cpp +++ b/unityplugin/UnityEmulator/src/DiligentGraphicsAdapterD3D11.cpp @@ -134,8 +134,6 @@ void DiligentGraphicsAdapterD3D11::InitProxySwapChain() auto pProxySwapChainD3D11 = NEW_RC_OBJ(DefaultAllocator, "ProxySwapChainD3D11 instance", ProxySwapChainD3D11)(m_pDevice, m_pDeviceCtx, SCDesc); pProxySwapChainD3D11->QueryInterface(IID_SwapChain, reinterpret_cast<IObject**>(static_cast<ISwapChain**>(&m_pProxySwapChain))); pProxySwapChainD3D11->CreateViews(pBackBufferRTV, pDepthBufferDSV); - - m_pDeviceCtx->SetSwapChain(m_pProxySwapChain); } void DiligentGraphicsAdapterD3D11::BeginFrame() diff --git a/unityplugin/UnityEmulator/src/DiligentGraphicsAdapterD3D12.cpp b/unityplugin/UnityEmulator/src/DiligentGraphicsAdapterD3D12.cpp index 6c09f5c..3f02630 100644 --- a/unityplugin/UnityEmulator/src/DiligentGraphicsAdapterD3D12.cpp +++ b/unityplugin/UnityEmulator/src/DiligentGraphicsAdapterD3D12.cpp @@ -219,7 +219,6 @@ void DiligentGraphicsAdapterD3D12::InitProxySwapChain() auto ProxySwapChain = NEW_RC_OBJ(DefaultAllocator, "UnityCommandQueueImpl instance", ProxySwapChainD3D12)(m_pDevice, m_pDeviceCtx, SCDesc); ProxySwapChain->CreateBuffers(GraphicsImpl->GetDXGISwapChain(), GraphicsImpl->GetDepthBuffer()); m_pProxySwapChain = ProxySwapChain; - m_pDeviceCtx->SetSwapChain(ProxySwapChain); } void DiligentGraphicsAdapterD3D12::PreSwapChainResize() diff --git a/unityplugin/UnityEmulator/src/DiligentGraphicsAdapterGL.cpp b/unityplugin/UnityEmulator/src/DiligentGraphicsAdapterGL.cpp index 0e81625..364a9d1 100644 --- a/unityplugin/UnityEmulator/src/DiligentGraphicsAdapterGL.cpp +++ b/unityplugin/UnityEmulator/src/DiligentGraphicsAdapterGL.cpp @@ -9,6 +9,8 @@ #include "UnityGraphicsGL_Impl.h" #include "SwapChainGL.h" +#include "RenderDeviceGL.h" +#include "DeviceContextGL.h" using namespace Diligent; @@ -27,7 +29,26 @@ public: const SwapChainDesc& SCDesc ) : TBase(pRefCounters, pDevice, pDeviceContext,SCDesc), m_UnityGraphicsGL(UnityGraphicsGL) - {} + { + TextureDesc DummyTexDesc; + DummyTexDesc.Name = "Back buffer proxy"; + DummyTexDesc.Type = RESOURCE_DIM_TEX_2D; + DummyTexDesc.Format = SCDesc.ColorBufferFormat; + DummyTexDesc.Width = SCDesc.Width; + DummyTexDesc.Height = SCDesc.Height; + DummyTexDesc.BindFlags = BIND_RENDER_TARGET; + RefCntAutoPtr<IRenderDeviceGL> pDeviceGL(pDevice, IID_RenderDeviceGL); + RefCntAutoPtr<ITexture> pDummyRenderTarget; + pDeviceGL->CreateDummyTexture(DummyTexDesc, RESOURCE_STATE_RENDER_TARGET, &pDummyRenderTarget); + m_pRTV = pDummyRenderTarget->GetDefaultView(TEXTURE_VIEW_RENDER_TARGET); + + DummyTexDesc.Name = "Depth buffer proxy"; + DummyTexDesc.Format = SCDesc.DepthBufferFormat; + DummyTexDesc.BindFlags = BIND_DEPTH_STENCIL; + RefCntAutoPtr<ITexture> pDummyDepthBuffer; + pDeviceGL->CreateDummyTexture(DummyTexDesc, RESOURCE_STATE_DEPTH_WRITE, &pDummyDepthBuffer); + m_pDSV = pDummyDepthBuffer->GetDefaultView(TEXTURE_VIEW_DEPTH_STENCIL); + } virtual void Present(Uint32 SyncInterval)override final { @@ -54,11 +75,13 @@ public: return m_UnityGraphicsGL.GetGraphicsImpl()->GetDefaultFBO(); } - virtual ITextureView* GetCurrentBackBufferRTV()override final{return nullptr;} - virtual ITextureView* GetDepthBufferDSV()override final{return nullptr;} + virtual ITextureView* GetCurrentBackBufferRTV()override final{return m_pRTV;} + virtual ITextureView* GetDepthBufferDSV()override final{return m_pDSV;} private: const UnityGraphicsGLCoreES_Emulator& m_UnityGraphicsGL; + RefCntAutoPtr<ITextureView> m_pRTV; + RefCntAutoPtr<ITextureView> m_pDSV; }; } @@ -103,7 +126,7 @@ DiligentGraphicsAdapterGL::DiligentGraphicsAdapterGL(const UnityGraphicsGLCoreES 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); + RefCntAutoPtr<IDeviceContextGL>(m_pDeviceCtx, IID_DeviceContextGL)->SetSwapChain(pProxySwapChainGL); } void DiligentGraphicsAdapterGL::BeginFrame() |
