summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/render/backend/renderer.cpp6
-rw-r--r--src/render/graphicshelpers/graphicscontext.cpp5
-rw-r--r--src/render/graphicshelpers/graphicscontext_p.h1
3 files changed, 12 insertions, 0 deletions
diff --git a/src/render/backend/renderer.cpp b/src/render/backend/renderer.cpp
index c91eff86e..49f2f4434 100644
--- a/src/render/backend/renderer.cpp
+++ b/src/render/backend/renderer.cpp
@@ -908,6 +908,12 @@ Renderer::ViewSubmissionResultData Renderer::submitRenderViews(const QVector<Ren
frameElapsed = timer.elapsed();
}
+ // Bind lastBoundFBOId back. Needed also in threaded mode.
+ // lastBoundFBOId != m_graphicsContext->activeFBO() when the last FrameGraph leaf node/renderView
+ // contains RenderTargetSelector/RenderTarget
+ if (lastBoundFBOId != m_graphicsContext->activeFBO())
+ m_graphicsContext->bindFramebuffer(lastBoundFBOId);
+
// Reset state and call doneCurrent if the surface
// is valid and was actually activated
if (surface && m_graphicsContext->hasValidGLHelper()) {
diff --git a/src/render/graphicshelpers/graphicscontext.cpp b/src/render/graphicshelpers/graphicscontext.cpp
index 2fc36c306..3a67db729 100644
--- a/src/render/graphicshelpers/graphicscontext.cpp
+++ b/src/render/graphicshelpers/graphicscontext.cpp
@@ -843,6 +843,11 @@ void GraphicsContext::alphaTest(GLenum mode1, GLenum mode2)
m_glHelper->alphaTest(mode1, mode2);
}
+void GraphicsContext::bindFramebuffer(GLuint fbo)
+{
+ m_glHelper->bindFrameBufferObject(fbo);
+}
+
void GraphicsContext::depthTest(GLenum mode)
{
m_glHelper->depthTest(mode);
diff --git a/src/render/graphicshelpers/graphicscontext_p.h b/src/render/graphicshelpers/graphicscontext_p.h
index 1aa4c3e5a..cc63a03b6 100644
--- a/src/render/graphicshelpers/graphicscontext_p.h
+++ b/src/render/graphicshelpers/graphicscontext_p.h
@@ -180,6 +180,7 @@ public:
// Wrapper methods
void alphaTest(GLenum mode1, GLenum mode2);
+ void bindFramebuffer(GLuint fbo);
void bindBufferBase(GLenum target, GLuint bindingIndex, GLuint buffer);
void bindFragOutputs(GLuint shader, const QHash<QString, int> &outputs);
void bindUniformBlock(GLuint programId, GLuint uniformBlockIndex, GLuint uniformBlockBinding);