From 166af499d36f7ca1d542bfc46ca37468bf9fbdab Mon Sep 17 00:00:00 2001 From: Alexis Hetu Date: Wed, 30 Nov 2016 14:34:07 -0500 Subject: [PATCH] More blitFramebuffer fixes MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit A few minor adjustments: - The validity of blit operations with the same bounds on source and destination buffer also extends to color buffers - Renderbuffers, whether GL_RENDERBUFFER or GL_FRAMEBUFFER_DEFAULT are considered of the same type for the purpose of blitting Change-Id: I0de7c19aa8b07fa57ed33b98be4a4ab609e6e115 Reviewed-on: https://swiftshader-review.googlesource.com/8213 Tested-by: Alexis Hétu Reviewed-by: Nicolas Capens --- src/OpenGL/libGLESv2/Context.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/OpenGL/libGLESv2/Context.cpp b/src/OpenGL/libGLESv2/Context.cpp index 7ccfc9d30..47feec661 100644 --- a/src/OpenGL/libGLESv2/Context.cpp +++ b/src/OpenGL/libGLESv2/Context.cpp @@ -4047,6 +4047,7 @@ void Context::blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1 partialBufferCopy = true; } + bool sameBounds = (srcX0 == dstX0 && srcY0 == dstY0 && srcX1 == dstX1 && srcY1 == dstY1); bool blitRenderTarget = false; bool blitDepth = false; bool blitStencil = false; @@ -4062,7 +4063,7 @@ void Context::blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1 return error(GL_INVALID_OPERATION); } - if(partialBufferCopy && readBufferSamples > 1) + if(partialBufferCopy && readBufferSamples > 1 && !sameBounds) { return error(GL_INVALID_OPERATION); } @@ -4079,7 +4080,10 @@ void Context::blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1 { if(readFramebuffer->getDepthbuffer() && drawFramebuffer->getDepthbuffer()) { - if(readFramebuffer->getDepthbufferType() != drawFramebuffer->getDepthbufferType()) + GLenum readDepthBufferType = readFramebuffer->getDepthbufferType(); + GLenum drawDepthBufferType = drawFramebuffer->getDepthbufferType(); + if((readDepthBufferType != drawDepthBufferType) && + !(Framebuffer::IsRenderbuffer(readDepthBufferType) && Framebuffer::IsRenderbuffer(drawDepthBufferType))) { return error(GL_INVALID_OPERATION); } @@ -4094,7 +4098,10 @@ void Context::blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1 { if(readFramebuffer->getStencilbuffer() && drawFramebuffer->getStencilbuffer()) { - if(readFramebuffer->getStencilbufferType() != drawFramebuffer->getStencilbufferType()) + GLenum readStencilBufferType = readFramebuffer->getStencilbufferType(); + GLenum drawStencilBufferType = drawFramebuffer->getStencilbufferType(); + if((readStencilBufferType != drawStencilBufferType) && + !(Framebuffer::IsRenderbuffer(readStencilBufferType) && Framebuffer::IsRenderbuffer(drawStencilBufferType))) { return error(GL_INVALID_OPERATION); } @@ -4119,8 +4126,7 @@ void Context::blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1 // INVALID_OPERATION error is generated. if((drawDSBuffer && drawDSBuffer->getSamples() > 1) || ((readDSBuffer && readDSBuffer->getSamples() > 1) && - ((srcX0 != dstX0 || srcY0 != dstY0 || srcX1 != dstX1 || srcY1 != dstY1) || - (drawDSBuffer->getFormat() != readDSBuffer->getFormat())))) + (!sameBounds || (drawDSBuffer->getFormat() != readDSBuffer->getFormat())))) { return error(GL_INVALID_OPERATION); } -- 2.11.0