diff options
author | Andy Nichols <andy.nichols@qt.io> | 2018-04-12 12:48:40 +0200 |
---|---|---|
committer | Andy Nichols <andy.nichols@qt.io> | 2018-04-12 15:03:35 +0000 |
commit | e4846ce77490d3e6b33b33de1e4775cfcf5aed6f (patch) | |
tree | 96673c4385553d88df7fd4b01d190f249a8fd249 /src | |
parent | 8beae9a0944b30f0008f81cbc0376af03bb4c90f (diff) |
ES2: Ignore mode when calling bindFrameBufferObject
When using bindFrameBufferObject with ES2 the only available target is
GL_FRAMEBUFFER.
Change-Id: Ie8fd50a57deeae3e8e02885e954ff73d85712c14
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src')
3 files changed, 29 insertions, 21 deletions
diff --git a/src/render/renderers/opengl/graphicshelpers/graphicshelperes2.cpp b/src/render/renderers/opengl/graphicshelpers/graphicshelperes2.cpp index 798457edb..2b2645505 100644 --- a/src/render/renderers/opengl/graphicshelpers/graphicshelperes2.cpp +++ b/src/render/renderers/opengl/graphicshelpers/graphicshelperes2.cpp @@ -63,15 +63,6 @@ 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 { @@ -371,18 +362,10 @@ void GraphicsHelperES2::releaseFrameBufferObject(GLuint frameBufferId) void GraphicsHelperES2::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; - } + Q_UNUSED(mode) + // For ES2 the spec states for target: The symbolic constant must be GL_FRAMEBUFFER + // so mode is ignored and is always set to GL_FRAMEBUFFER + m_funcs->glBindFramebuffer(GL_FRAMEBUFFER, frameBufferId); } GLuint GraphicsHelperES2::boundFrameBufferObject() diff --git a/src/render/renderers/opengl/graphicshelpers/graphicshelperes3.cpp b/src/render/renderers/opengl/graphicshelpers/graphicshelperes3.cpp index d324baf1f..87a160a85 100644 --- a/src/render/renderers/opengl/graphicshelpers/graphicshelperes3.cpp +++ b/src/render/renderers/opengl/graphicshelpers/graphicshelperes3.cpp @@ -139,6 +139,14 @@ QT_BEGIN_NAMESPACE #define GL_UNIFORM_BLOCK_DATA_SIZE 0x8A40 #endif +#ifndef GL_DRAW_FRAMEBUFFER +#define GL_DRAW_FRAMEBUFFER 0x8CA9 +#endif + +#ifndef GL_READ_FRAMEBUFFER +#define GL_READ_FRAMEBUFFER 0x8CA8 +#endif + namespace Qt3DRender { namespace Render { @@ -267,6 +275,22 @@ void GraphicsHelperES3::bindFrameBufferAttachment(QOpenGLTexture *texture, const texture->release(); } +void GraphicsHelperES3::bindFrameBufferObject(GLuint frameBufferId, GraphicsHelperInterface::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; + } +} + bool GraphicsHelperES3::supportsFeature(GraphicsHelperInterface::Feature feature) const { switch (feature) { diff --git a/src/render/renderers/opengl/graphicshelpers/graphicshelperes3_p.h b/src/render/renderers/opengl/graphicshelpers/graphicshelperes3_p.h index 518226116..1df710625 100644 --- a/src/render/renderers/opengl/graphicshelpers/graphicshelperes3_p.h +++ b/src/render/renderers/opengl/graphicshelpers/graphicshelperes3_p.h @@ -69,6 +69,7 @@ public: void bindBufferBase(GLenum target, GLuint index, GLuint buffer) override; bool frameBufferNeedsRenderBuffer(const Attachment &attachment) override; void bindFrameBufferAttachment(QOpenGLTexture *texture, const Attachment &attachment) override; + void bindFrameBufferObject(GLuint frameBufferId, FBOBindMode mode) override; void bindUniformBlock(GLuint programId, GLuint uniformBlockIndex, GLuint uniformBlockBinding) override; void blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) override; void buildUniformBuffer(const QVariant &v, const ShaderUniform &description, QByteArray &buffer) override; |