summaryrefslogtreecommitdiffstats
path: root/src/render/renderers/opengl/graphicshelpers
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2018-05-22 15:45:06 +0200
committerAndy Nichols <andy.nichols@qt.io>2018-05-29 12:32:00 +0000
commit2b2df724e14f5696bf751a53f5898e5be9bbac0c (patch)
tree2c554a870ad050d67f7564803f3f64d5305a186c /src/render/renderers/opengl/graphicshelpers
parent74402c49a4c6e9411a06fd1b0a8e8de6725433a8 (diff)
Fix BlitFramebuffer on GLES
Task-number: QTBUG-68395 Change-Id: I216f32bd22d12c6fa6f2efd09765ad95754326b4 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/render/renderers/opengl/graphicshelpers')
-rw-r--r--src/render/renderers/opengl/graphicshelpers/graphicscontext.cpp5
-rw-r--r--src/render/renderers/opengl/graphicshelpers/graphicscontext_p.h1
-rw-r--r--src/render/renderers/opengl/graphicshelpers/submissioncontext.cpp12
3 files changed, 16 insertions, 2 deletions
diff --git a/src/render/renderers/opengl/graphicshelpers/graphicscontext.cpp b/src/render/renderers/opengl/graphicshelpers/graphicscontext.cpp
index c2ec3db59..af1fb5675 100644
--- a/src/render/renderers/opengl/graphicshelpers/graphicscontext.cpp
+++ b/src/render/renderers/opengl/graphicshelpers/graphicscontext.cpp
@@ -705,6 +705,11 @@ void GraphicsContext::drawBuffer(GLenum mode)
m_glHelper->drawBuffer(mode);
}
+void GraphicsContext::drawBuffers(GLsizei n, const int *bufs)
+{
+ m_glHelper->drawBuffers(n, bufs);
+}
+
void GraphicsContext::applyUniform(const ShaderUniform &description, const UniformValue &v)
{
const UniformType type = m_glHelper->uniformTypeFromGLType(description.m_type);
diff --git a/src/render/renderers/opengl/graphicshelpers/graphicscontext_p.h b/src/render/renderers/opengl/graphicshelpers/graphicscontext_p.h
index 82db57433..7bc79996c 100644
--- a/src/render/renderers/opengl/graphicshelpers/graphicscontext_p.h
+++ b/src/render/renderers/opengl/graphicshelpers/graphicscontext_p.h
@@ -158,6 +158,7 @@ public:
void pointSize(bool programmable, GLfloat value);
void readBuffer(GLenum mode);
void drawBuffer(GLenum mode);
+ void drawBuffers(GLsizei n, const int *bufs);
void setMSAAEnabled(bool enabled);
void setAlphaCoverageEnabled(bool enabled);
void setClipPlane(int clipPlane, const QVector3D &normal, float distance);
diff --git a/src/render/renderers/opengl/graphicshelpers/submissioncontext.cpp b/src/render/renderers/opengl/graphicshelpers/submissioncontext.cpp
index ecaa12d8b..20aca81bc 100644
--- a/src/render/renderers/opengl/graphicshelpers/submissioncontext.cpp
+++ b/src/render/renderers/opengl/graphicshelpers/submissioncontext.cpp
@@ -1618,8 +1618,12 @@ void SubmissionContext::blitFramebuffer(Qt3DCore::QNodeId inputRenderTargetId,
if (!inputBufferIsDefault)
readBuffer(GL_COLOR_ATTACHMENT0 + inputAttachmentPoint);
- if (!outputBufferIsDefault)
- drawBuffer(GL_COLOR_ATTACHMENT0 + outputAttachmentPoint);
+ if (!outputBufferIsDefault) {
+ // Note that we use glDrawBuffers, not glDrawBuffer. The
+ // latter is not available with GLES.
+ const int buf = outputAttachmentPoint;
+ drawBuffers(1, &buf);
+ }
// Blit framebuffer
const GLenum mode = interpolationMethod ? GL_NEAREST : GL_LINEAR;
@@ -1629,6 +1633,10 @@ void SubmissionContext::blitFramebuffer(Qt3DCore::QNodeId inputRenderTargetId,
// Reset draw buffer
bindFramebuffer(lastDrawFboId, GraphicsHelperInterface::FBOReadAndDraw);
+ if (outputAttachmentPoint != QRenderTargetOutput::Color0) {
+ const int buf = QRenderTargetOutput::Color0;
+ drawBuffers(1, &buf);
+ }
}
} // namespace Render