summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineOpenGL
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2019-11-11 00:56:07 +0000
committerEgor Yusov <egor.yusov@gmail.com>2019-11-11 00:56:07 +0000
commit5d9fbd889b4d45581a6e28e593865ce5fabbf156 (patch)
treed7fee49c66c6c7b372f3b924b17e3009ca47aa36 /Graphics/GraphicsEngineOpenGL
parentImplemented ResolveTextureSubresource in GL backend (fixed https://github.com... (diff)
downloadDiligentCore-5d9fbd889b4d45581a6e28e593865ce5fabbf156.tar.gz
DiligentCore-5d9fbd889b4d45581a6e28e593865ce5fabbf156.zip
OpenGL backend: fixed setting RTV and DSV from the swap chain
Diffstat (limited to 'Graphics/GraphicsEngineOpenGL')
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp
index 898f0fb1..bdac5e7c 100644
--- a/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp
+++ b/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp
@@ -331,7 +331,16 @@ namespace Diligent
TextureViewGLImpl* pBoundRTVs[MaxRenderTargets] = {};
for (Uint32 rt = 0; rt < NumRenderTargets; ++rt)
+ {
pBoundRTVs[rt] = m_pBoundRenderTargets[rt];
+ DEV_CHECK_ERR(!pBoundRTVs[rt] || pBoundRTVs[rt]->GetTexture<TextureBaseGL>()->GetGLHandle(),
+ "Color buffer of the default framebuffer can only be bound with the default framebuffer's depth buffer "
+ "and cannot be combined with any other render target or depth buffer in OpenGL backend.");
+ }
+
+ DEV_CHECK_ERR(!m_pBoundDepthStencil || m_pBoundDepthStencil->GetTexture<TextureBaseGL>()->GetGLHandle(),
+ "Depth buffer of the default framebuffer can only be bound with the default framebuffer's color buffer "
+ "and cannot be combined with any other render target in OpenGL backend.");
auto CurrentNativeGLContext = m_ContextState.GetCurrentGLContext();
auto& FBOCache = m_pDevice->GetFBOCache(CurrentNativeGLContext);
@@ -351,7 +360,25 @@ namespace Diligent
RESOURCE_STATE_TRANSITION_MODE StateTransitionMode)
{
if (TDeviceContextBase::SetRenderTargets( NumRenderTargets, ppRenderTargets, pDepthStencil))
+ {
+ if (!m_IsDefaultFramebufferBound)
+ {
+ if (m_NumBoundRenderTargets == 1 && m_pBoundRenderTargets[0] && m_pBoundRenderTargets[0]->GetTexture<TextureBaseGL>()->GetGLHandle() == 0)
+ {
+ DEV_CHECK_ERR(!m_pBoundDepthStencil || m_pBoundDepthStencil->GetTexture<TextureBaseGL>()->GetGLHandle() == 0,
+ "Attempting to bind texture '", m_pBoundDepthStencil->GetTexture()->GetDesc().Name, "' as depth buffer with the "
+ "default framebuffer's color buffer: color buffer of the default framebuffer can only be bound with the default "
+ "framebuffer's depth buffer and cannot be combined with any other depth buffer in OpenGL backend.");
+ m_IsDefaultFramebufferBound = true;
+ }
+ else if (m_NumBoundRenderTargets == 0 && m_pBoundDepthStencil && m_pBoundDepthStencil->GetTexture<TextureBaseGL>()->GetGLHandle() == 0)
+ {
+ m_IsDefaultFramebufferBound = true;
+ }
+ }
+
CommitRenderTargets();
+ }
}
void DeviceContextGLImpl::BindProgramResources(Uint32& NewMemoryBarriers, IShaderResourceBinding* pResBinding)