diff options
| author | assiduous <assiduous@diligentgraphics.com> | 2019-12-23 23:00:54 +0000 |
|---|---|---|
| committer | assiduous <assiduous@diligentgraphics.com> | 2019-12-23 23:00:54 +0000 |
| commit | 915d3de059b7a3712b8db48e60f14fed3d589557 (patch) | |
| tree | 58fec49ed0ab539082a4543016a0d7f81e1d951d /Graphics/GraphicsEngineOpenGL | |
| parent | Added DILIGENT_IMPROVE_SPIRV_TOOLS_DEBUG_PERF option (diff) | |
| download | DiligentCore-915d3de059b7a3712b8db48e60f14fed3d589557.tar.gz DiligentCore-915d3de059b7a3712b8db48e60f14fed3d589557.zip | |
OpenGL backend: fixed issue with copying default framebuffer
Diffstat (limited to 'Graphics/GraphicsEngineOpenGL')
| -rw-r--r-- | Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp index 9b402e9e..746701f2 100644 --- a/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp @@ -1166,9 +1166,14 @@ void DeviceContextGLImpl::CopyTexture(const CopyTextureAttribs& CopyAttribs) } else if (SrcTexDesc.Usage != USAGE_STAGING && DstTexDesc.Usage == USAGE_STAGING) { - auto CurrentNativeGLContext = m_ContextState.GetCurrentGLContext(); - auto& FBOCache = m_pDevice->GetFBOCache(CurrentNativeGLContext); - + if (pSrcTexGL->GetGLTextureHandle() == 0) + { + auto* pSwapChainGL = m_pSwapChain.RawPtr<ISwapChainGL>(); + GLuint DefaultFBOHandle = pSwapChainGL->GetDefaultFBO(); + glBindFramebuffer(GL_READ_FRAMEBUFFER, DefaultFBOHandle); + DEV_CHECK_GL_ERROR("Failed to bind default FBO as read framebuffer"); + } + else { TextureViewDesc SrcTexViewDesc; SrcTexViewDesc.ViewType = TEXTURE_VIEW_RENDER_TARGET; @@ -1184,8 +1189,11 @@ void DeviceContextGLImpl::CopyTexture(const CopyTextureAttribs& CopyAttribs) false // bIsDefaultView }; + auto CurrentNativeGLContext = m_ContextState.GetCurrentGLContext(); + auto& fboCache = m_pDevice->GetFBOCache(CurrentNativeGLContext); + TextureViewGLImpl* pSrcViews[] = {&SrcTexView}; - const auto& SrcFBO = FBOCache.GetFBO(1, pSrcViews, nullptr, m_ContextState); + const auto& SrcFBO = fboCache.GetFBO(1, pSrcViews, nullptr, m_ContextState); glBindFramebuffer(GL_READ_FRAMEBUFFER, SrcFBO); DEV_CHECK_GL_ERROR("Failed to bind FBO as read framebuffer"); } |
