diff options
author | Sean Harmer <sean.harmer@kdab.com> | 2017-08-19 15:53:30 +0100 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2017-08-19 16:28:52 +0100 |
commit | 8f863343a9e2e2f3630f22407f4e5e30e72745cf (patch) | |
tree | 5574e3c2215d74345e15df5f45ed3211e065541a /src/render/graphicshelpers | |
parent | 3edb85002b848033bbeefa33001d19fb514ef489 (diff) | |
parent | 9d8c9ada161ad97634992c444196add0abb4f9d1 (diff) |
Merge branch '5.9' into dev
Conflicts:
src/render/backend/renderer.cpp
src/render/backend/renderview.cpp
src/render/graphicshelpers/graphicscontext_p.h
src/render/graphicshelpers/graphicshelperes2_p.h
src/render/graphicshelpers/graphicshelpergl2_p.h
src/render/graphicshelpers/graphicshelpergl3_2_p.h
src/render/graphicshelpers/graphicshelpergl3_3_p.h
src/render/graphicshelpers/graphicshelpergl4_p.h
src/render/graphicshelpers/graphicshelperinterface_p.h
src/render/jobs/pickboundingvolumejob.cpp
tests/auto/animation/clipanimator/tst_clipanimator.cpp
tests/auto/auto.pro
tests/manual/manual.pro
Also disabled the QQmlMetaType codepaths following commit
49a11e882059ee1729f776722e085dd21d378c36 in qtdeclarative. The
QQmlMetaType codepaths will be re-enabled once a qt5.git
integration has succeeded.
Change-Id: Ia654d75425e6d406c472d19864383612208cad2b
Diffstat (limited to 'src/render/graphicshelpers')
-rw-r--r-- | src/render/graphicshelpers/graphicscontext.cpp | 10 | ||||
-rw-r--r-- | src/render/graphicshelpers/graphicscontext_p.h | 3 | ||||
-rw-r--r-- | src/render/graphicshelpers/graphicshelperes2.cpp | 24 | ||||
-rw-r--r-- | src/render/graphicshelpers/graphicshelperes2_p.h | 2 | ||||
-rw-r--r-- | src/render/graphicshelpers/graphicshelpergl2.cpp | 20 | ||||
-rw-r--r-- | src/render/graphicshelpers/graphicshelpergl2_p.h | 2 | ||||
-rw-r--r-- | src/render/graphicshelpers/graphicshelpergl3_2.cpp | 15 | ||||
-rw-r--r-- | src/render/graphicshelpers/graphicshelpergl3_2_p.h | 2 | ||||
-rw-r--r-- | src/render/graphicshelpers/graphicshelpergl3_3.cpp | 15 | ||||
-rw-r--r-- | src/render/graphicshelpers/graphicshelpergl3_3_p.h | 2 | ||||
-rw-r--r-- | src/render/graphicshelpers/graphicshelpergl4.cpp | 17 | ||||
-rw-r--r-- | src/render/graphicshelpers/graphicshelpergl4_p.h | 2 | ||||
-rw-r--r-- | src/render/graphicshelpers/graphicshelperinterface_p.h | 8 |
13 files changed, 97 insertions, 25 deletions
diff --git a/src/render/graphicshelpers/graphicscontext.cpp b/src/render/graphicshelpers/graphicscontext.cpp index 7910c828a..f09336243 100644 --- a/src/render/graphicshelpers/graphicscontext.cpp +++ b/src/render/graphicshelpers/graphicscontext.cpp @@ -592,7 +592,7 @@ void GraphicsContext::activateRenderTarget(Qt3DCore::QNodeId renderTargetNodeId, // Insert FBO into hash m_renderTargets.insert(renderTargetNodeId, fboId); // Bind FBO - m_glHelper->bindFrameBufferObject(fboId); + m_glHelper->bindFrameBufferObject(fboId, GraphicsHelperInterface::FBODraw); bindFrameBufferAttachmentHelper(fboId, attachments); } else { qCritical() << "Failed to create FBO"; @@ -616,13 +616,13 @@ void GraphicsContext::activateRenderTarget(Qt3DCore::QNodeId renderTargetNodeId, } if (needsResize) { - m_glHelper->bindFrameBufferObject(fboId); + m_glHelper->bindFrameBufferObject(fboId, GraphicsHelperInterface::FBODraw); bindFrameBufferAttachmentHelper(fboId, attachments); } } } m_activeFBO = fboId; - m_glHelper->bindFrameBufferObject(m_activeFBO); + m_glHelper->bindFrameBufferObject(m_activeFBO, GraphicsHelperInterface::FBODraw); // Set active drawBuffers activateDrawBuffers(attachments); } @@ -972,9 +972,9 @@ void GraphicsContext::alphaTest(GLenum mode1, GLenum mode2) m_glHelper->alphaTest(mode1, mode2); } -void GraphicsContext::bindFramebuffer(GLuint fbo) +void GraphicsContext::bindFramebuffer(GLuint fbo, GraphicsHelperInterface::FBOBindMode mode) { - m_glHelper->bindFrameBufferObject(fbo); + m_glHelper->bindFrameBufferObject(fbo, mode); } void GraphicsContext::depthTest(GLenum mode) diff --git a/src/render/graphicshelpers/graphicscontext_p.h b/src/render/graphicshelpers/graphicscontext_p.h index 9252bb467..fcb17ade7 100644 --- a/src/render/graphicshelpers/graphicscontext_p.h +++ b/src/render/graphicshelpers/graphicscontext_p.h @@ -70,6 +70,7 @@ #include <Qt3DRender/private/qgraphicsapifilter_p.h> #include <Qt3DRender/private/shadercache_p.h> #include <Qt3DRender/private/uniform_p.h> +#include <Qt3DRender/private/graphicshelperinterface_p.h> #include <qmath.h> QT_BEGIN_NAMESPACE @@ -194,7 +195,7 @@ public: // Wrapper methods void alphaTest(GLenum mode1, GLenum mode2); - void bindFramebuffer(GLuint fbo); + void bindFramebuffer(GLuint fbo, GraphicsHelperInterface::FBOBindMode mode); 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); diff --git a/src/render/graphicshelpers/graphicshelperes2.cpp b/src/render/graphicshelpers/graphicshelperes2.cpp index 4954aac9e..a72e6159c 100644 --- a/src/render/graphicshelpers/graphicshelperes2.cpp +++ b/src/render/graphicshelpers/graphicshelperes2.cpp @@ -63,6 +63,15 @@ QT_BEGIN_NAMESPACE #define GL_SAMPLER_2D_ARRAY_SHADOW 0x8DC4 #endif +// ES 2.0 FBO +#ifndef GL_DRAW_FRAMEBUFFER +#define GL_DRAW_FRAMEBUFFER 0x8CA9 +#endif + +#ifndef GL_READ_FRAMEBUFFER +#define GL_READ_FRAMEBUFFER 0x8CA8 +#endif + namespace Qt3DRender { namespace Render { @@ -344,9 +353,20 @@ void GraphicsHelperES2::releaseFrameBufferObject(GLuint frameBufferId) m_funcs->glDeleteFramebuffers(1, &frameBufferId); } -void GraphicsHelperES2::bindFrameBufferObject(GLuint frameBufferId) +void GraphicsHelperES2::bindFrameBufferObject(GLuint frameBufferId, FBOBindMode mode) { - m_funcs->glBindFramebuffer(GL_FRAMEBUFFER, frameBufferId); + switch (mode) { + case FBODraw: + m_funcs->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, frameBufferId); + return; + case FBORead: + m_funcs->glBindFramebuffer(GL_READ_FRAMEBUFFER, frameBufferId); + return; + case FBOReadAndDraw: + default: + m_funcs->glBindFramebuffer(GL_FRAMEBUFFER, frameBufferId); + return; + } } GLuint GraphicsHelperES2::boundFrameBufferObject() diff --git a/src/render/graphicshelpers/graphicshelperes2_p.h b/src/render/graphicshelpers/graphicshelperes2_p.h index d068b5307..b93268188 100644 --- a/src/render/graphicshelpers/graphicshelperes2_p.h +++ b/src/render/graphicshelpers/graphicshelperes2_p.h @@ -75,7 +75,7 @@ public: bool frameBufferNeedsRenderBuffer(const Attachment &attachment) Q_DECL_OVERRIDE; void bindFrameBufferAttachment(QOpenGLTexture *texture, const Attachment &attachment) Q_DECL_OVERRIDE; void bindFrameBufferAttachment(RenderBuffer *renderBuffer, const Attachment &attachment) Q_DECL_OVERRIDE; - void bindFrameBufferObject(GLuint frameBufferId) Q_DECL_OVERRIDE; + void bindFrameBufferObject(GLuint frameBufferId, FBOBindMode mode) Q_DECL_OVERRIDE; void bindShaderStorageBlock(GLuint programId, GLuint shaderStorageBlockIndex, GLuint shaderStorageBlockBinding) Q_DECL_OVERRIDE; void bindUniformBlock(GLuint programId, GLuint uniformBlockIndex, GLuint uniformBlockBinding) Q_DECL_OVERRIDE; void blendEquation(GLenum mode) Q_DECL_OVERRIDE; diff --git a/src/render/graphicshelpers/graphicshelpergl2.cpp b/src/render/graphicshelpers/graphicshelpergl2.cpp index 28d1a91c9..9abc392ee 100644 --- a/src/render/graphicshelpers/graphicshelpergl2.cpp +++ b/src/render/graphicshelpers/graphicshelpergl2.cpp @@ -418,12 +418,24 @@ void GraphicsHelperGL2::bindFragDataLocation(GLuint, const QHash<QString, int> & qCritical() << "bindFragDataLocation is not supported by GL 2.0"; } -void GraphicsHelperGL2::bindFrameBufferObject(GLuint frameBufferId) +void GraphicsHelperGL2::bindFrameBufferObject(GLuint frameBufferId, FBOBindMode mode) { - if (m_fboFuncs != nullptr) - m_fboFuncs->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, frameBufferId); - else + if (m_fboFuncs != nullptr) { + switch (mode) { + case FBODraw: + m_fboFuncs->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, frameBufferId); + return; + case FBORead: + m_fboFuncs->glBindFramebuffer(GL_READ_FRAMEBUFFER, frameBufferId); + return; + case FBOReadAndDraw: + default: + m_fboFuncs->glBindFramebuffer(GL_FRAMEBUFFER, frameBufferId); + return; + } + } else { qWarning() << "FBO not supported by your OpenGL hardware"; + } } GLuint GraphicsHelperGL2::boundFrameBufferObject() diff --git a/src/render/graphicshelpers/graphicshelpergl2_p.h b/src/render/graphicshelpers/graphicshelpergl2_p.h index 7d617937d..3a15af260 100644 --- a/src/render/graphicshelpers/graphicshelpergl2_p.h +++ b/src/render/graphicshelpers/graphicshelpergl2_p.h @@ -75,7 +75,7 @@ public: bool frameBufferNeedsRenderBuffer(const Attachment &attachment) Q_DECL_OVERRIDE; void bindFrameBufferAttachment(QOpenGLTexture *texture, const Attachment &attachment) Q_DECL_OVERRIDE; void bindFrameBufferAttachment(RenderBuffer *renderBuffer, const Attachment &attachment) Q_DECL_OVERRIDE; - void bindFrameBufferObject(GLuint frameBufferId) Q_DECL_OVERRIDE; + void bindFrameBufferObject(GLuint frameBufferId, FBOBindMode mode) Q_DECL_OVERRIDE; void bindShaderStorageBlock(GLuint programId, GLuint shaderStorageBlockIndex, GLuint shaderStorageBlockBinding) Q_DECL_OVERRIDE; void bindUniformBlock(GLuint programId, GLuint uniformBlockIndex, GLuint uniformBlockBinding) Q_DECL_OVERRIDE; void blendEquation(GLenum mode) Q_DECL_OVERRIDE; diff --git a/src/render/graphicshelpers/graphicshelpergl3_2.cpp b/src/render/graphicshelpers/graphicshelpergl3_2.cpp index 47e850871..54c46babe 100644 --- a/src/render/graphicshelpers/graphicshelpergl3_2.cpp +++ b/src/render/graphicshelpers/graphicshelpergl3_2.cpp @@ -392,9 +392,20 @@ void GraphicsHelperGL3_2::releaseFrameBufferObject(GLuint frameBufferId) m_funcs->glDeleteFramebuffers(1, &frameBufferId); } -void GraphicsHelperGL3_2::bindFrameBufferObject(GLuint frameBufferId) +void GraphicsHelperGL3_2::bindFrameBufferObject(GLuint frameBufferId, FBOBindMode mode) { - m_funcs->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, frameBufferId); + switch (mode) { + case FBODraw: + m_funcs->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, frameBufferId); + return; + case FBORead: + m_funcs->glBindFramebuffer(GL_READ_FRAMEBUFFER, frameBufferId); + return; + case FBOReadAndDraw: + default: + m_funcs->glBindFramebuffer(GL_FRAMEBUFFER, frameBufferId); + return; + } } GLuint GraphicsHelperGL3_2::boundFrameBufferObject() diff --git a/src/render/graphicshelpers/graphicshelpergl3_2_p.h b/src/render/graphicshelpers/graphicshelpergl3_2_p.h index 94ff4b4eb..bebe14ade 100644 --- a/src/render/graphicshelpers/graphicshelpergl3_2_p.h +++ b/src/render/graphicshelpers/graphicshelpergl3_2_p.h @@ -77,7 +77,7 @@ public: bool frameBufferNeedsRenderBuffer(const Attachment &attachment) Q_DECL_OVERRIDE; void bindFrameBufferAttachment(QOpenGLTexture *texture, const Attachment &attachment) Q_DECL_OVERRIDE; void bindFrameBufferAttachment(RenderBuffer *renderBuffer, const Attachment &attachment) Q_DECL_OVERRIDE; - void bindFrameBufferObject(GLuint frameBufferId) Q_DECL_OVERRIDE; + void bindFrameBufferObject(GLuint frameBufferId, FBOBindMode mode) Q_DECL_OVERRIDE; void bindShaderStorageBlock(GLuint programId, GLuint shaderStorageBlockIndex, GLuint shaderStorageBlockBinding) Q_DECL_OVERRIDE; void bindUniformBlock(GLuint programId, GLuint uniformBlockIndex, GLuint uniformBlockBinding) Q_DECL_OVERRIDE; void blendEquation(GLenum mode) Q_DECL_OVERRIDE; diff --git a/src/render/graphicshelpers/graphicshelpergl3_3.cpp b/src/render/graphicshelpers/graphicshelpergl3_3.cpp index fbb1455c6..e1ae23e6d 100644 --- a/src/render/graphicshelpers/graphicshelpergl3_3.cpp +++ b/src/render/graphicshelpers/graphicshelpergl3_3.cpp @@ -379,9 +379,20 @@ void GraphicsHelperGL3_3::releaseFrameBufferObject(GLuint frameBufferId) m_funcs->glDeleteFramebuffers(1, &frameBufferId); } -void GraphicsHelperGL3_3::bindFrameBufferObject(GLuint frameBufferId) +void GraphicsHelperGL3_3::bindFrameBufferObject(GLuint frameBufferId, FBOBindMode mode) { - m_funcs->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, frameBufferId); + switch (mode) { + case FBODraw: + m_funcs->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, frameBufferId); + return; + case FBORead: + m_funcs->glBindFramebuffer(GL_READ_FRAMEBUFFER, frameBufferId); + return; + case FBOReadAndDraw: + default: + m_funcs->glBindFramebuffer(GL_FRAMEBUFFER, frameBufferId); + return; + } } GLuint GraphicsHelperGL3_3::boundFrameBufferObject() diff --git a/src/render/graphicshelpers/graphicshelpergl3_3_p.h b/src/render/graphicshelpers/graphicshelpergl3_3_p.h index 3b03cf851..e890fd1a4 100644 --- a/src/render/graphicshelpers/graphicshelpergl3_3_p.h +++ b/src/render/graphicshelpers/graphicshelpergl3_3_p.h @@ -77,7 +77,7 @@ public: bool frameBufferNeedsRenderBuffer(const Attachment &attachment) Q_DECL_OVERRIDE; void bindFrameBufferAttachment(QOpenGLTexture *texture, const Attachment &attachment) Q_DECL_OVERRIDE; void bindFrameBufferAttachment(RenderBuffer *renderBuffer, const Attachment &attachment) Q_DECL_OVERRIDE; - void bindFrameBufferObject(GLuint frameBufferId) Q_DECL_OVERRIDE; + void bindFrameBufferObject(GLuint frameBufferId, FBOBindMode mode) Q_DECL_OVERRIDE; void bindShaderStorageBlock(GLuint programId, GLuint shaderStorageBlockIndex, GLuint shaderStorageBlockBinding) Q_DECL_OVERRIDE; void bindUniformBlock(GLuint programId, GLuint uniformBlockIndex, GLuint uniformBlockBinding) Q_DECL_OVERRIDE; void blendEquation(GLenum mode) Q_DECL_OVERRIDE; diff --git a/src/render/graphicshelpers/graphicshelpergl4.cpp b/src/render/graphicshelpers/graphicshelpergl4.cpp index 9cb1f02ee..badbaf67d 100644 --- a/src/render/graphicshelpers/graphicshelpergl4.cpp +++ b/src/render/graphicshelpers/graphicshelpergl4.cpp @@ -652,9 +652,20 @@ void GraphicsHelperGL4::releaseFrameBufferObject(GLuint frameBufferId) m_funcs->glDeleteFramebuffers(1, &frameBufferId); } -void GraphicsHelperGL4::bindFrameBufferObject(GLuint frameBufferId) -{ - m_funcs->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, frameBufferId); +void GraphicsHelperGL4::bindFrameBufferObject(GLuint frameBufferId, FBOBindMode mode) +{ + switch (mode) { + case FBODraw: + m_funcs->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, frameBufferId); + return; + case FBORead: + m_funcs->glBindFramebuffer(GL_READ_FRAMEBUFFER, frameBufferId); + return; + case FBOReadAndDraw: + default: + m_funcs->glBindFramebuffer(GL_FRAMEBUFFER, frameBufferId); + return; + } } GLuint GraphicsHelperGL4::boundFrameBufferObject() diff --git a/src/render/graphicshelpers/graphicshelpergl4_p.h b/src/render/graphicshelpers/graphicshelpergl4_p.h index e636832b3..1effbc9b9 100644 --- a/src/render/graphicshelpers/graphicshelpergl4_p.h +++ b/src/render/graphicshelpers/graphicshelpergl4_p.h @@ -75,7 +75,7 @@ public: bool frameBufferNeedsRenderBuffer(const Attachment &attachment) Q_DECL_OVERRIDE; void bindFrameBufferAttachment(QOpenGLTexture *texture, const Attachment &attachment) Q_DECL_OVERRIDE; void bindFrameBufferAttachment(RenderBuffer *renderBuffer, const Attachment &attachment) Q_DECL_OVERRIDE; - void bindFrameBufferObject(GLuint frameBufferId) Q_DECL_OVERRIDE; + void bindFrameBufferObject(GLuint frameBufferId, FBOBindMode mode) Q_DECL_OVERRIDE; void bindShaderStorageBlock(GLuint programId, GLuint shaderStorageBlockIndex, GLuint shaderStorageBlockBinding) Q_DECL_OVERRIDE; void bindUniformBlock(GLuint programId, GLuint uniformBlockIndex, GLuint uniformBlockBinding) Q_DECL_OVERRIDE; void blendEquation(GLenum mode) Q_DECL_OVERRIDE; diff --git a/src/render/graphicshelpers/graphicshelperinterface_p.h b/src/render/graphicshelpers/graphicshelperinterface_p.h index 45326eb91..9ded1835e 100644 --- a/src/render/graphicshelpers/graphicshelperinterface_p.h +++ b/src/render/graphicshelpers/graphicshelperinterface_p.h @@ -85,6 +85,12 @@ public: MapBuffer }; + enum FBOBindMode { + FBODraw, + FBORead, + FBOReadAndDraw + }; + virtual ~GraphicsHelperInterface() {} virtual void alphaTest(GLenum mode1, GLenum mode2) = 0; virtual void bindBufferBase(GLenum target, GLuint index, GLuint buffer) = 0; @@ -92,7 +98,7 @@ public: virtual bool frameBufferNeedsRenderBuffer(const Attachment &attachment) = 0; virtual void bindFrameBufferAttachment(QOpenGLTexture *texture, const Attachment &attachment) = 0; virtual void bindFrameBufferAttachment(RenderBuffer *renderBuffer, const Attachment &attachment) = 0; - virtual void bindFrameBufferObject(GLuint frameBufferId) = 0; + virtual void bindFrameBufferObject(GLuint frameBufferId, FBOBindMode mode) = 0; virtual void bindShaderStorageBlock(GLuint programId, GLuint shaderStorageBlockIndex, GLuint shaderStorageBlockBinding) = 0; virtual void bindUniformBlock(GLuint programId, GLuint uniformBlockIndex, GLuint uniformBlockBinding) = 0; virtual void blendEquation(GLenum mode) = 0; |