summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineOpenGL
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2019-12-23 23:00:54 +0000
committerassiduous <assiduous@diligentgraphics.com>2019-12-23 23:00:54 +0000
commit915d3de059b7a3712b8db48e60f14fed3d589557 (patch)
tree58fec49ed0ab539082a4543016a0d7f81e1d951d /Graphics/GraphicsEngineOpenGL
parentAdded DILIGENT_IMPROVE_SPIRV_TOOLS_DEBUG_PERF option (diff)
downloadDiligentCore-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.cpp16
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");
}