Commit 166af499 by Alexis Hetu Committed by Alexis Hétu

More blitFramebuffer fixes

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/8213Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com>
parent 58ead9ec
...@@ -4047,6 +4047,7 @@ void Context::blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1 ...@@ -4047,6 +4047,7 @@ void Context::blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1
partialBufferCopy = true; partialBufferCopy = true;
} }
bool sameBounds = (srcX0 == dstX0 && srcY0 == dstY0 && srcX1 == dstX1 && srcY1 == dstY1);
bool blitRenderTarget = false; bool blitRenderTarget = false;
bool blitDepth = false; bool blitDepth = false;
bool blitStencil = false; bool blitStencil = false;
...@@ -4062,7 +4063,7 @@ void Context::blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1 ...@@ -4062,7 +4063,7 @@ void Context::blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1
return error(GL_INVALID_OPERATION); return error(GL_INVALID_OPERATION);
} }
if(partialBufferCopy && readBufferSamples > 1) if(partialBufferCopy && readBufferSamples > 1 && !sameBounds)
{ {
return error(GL_INVALID_OPERATION); return error(GL_INVALID_OPERATION);
} }
...@@ -4079,7 +4080,10 @@ void Context::blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1 ...@@ -4079,7 +4080,10 @@ void Context::blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1
{ {
if(readFramebuffer->getDepthbuffer() && drawFramebuffer->getDepthbuffer()) 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); return error(GL_INVALID_OPERATION);
} }
...@@ -4094,7 +4098,10 @@ void Context::blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1 ...@@ -4094,7 +4098,10 @@ void Context::blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1
{ {
if(readFramebuffer->getStencilbuffer() && drawFramebuffer->getStencilbuffer()) 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); return error(GL_INVALID_OPERATION);
} }
...@@ -4119,8 +4126,7 @@ void Context::blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1 ...@@ -4119,8 +4126,7 @@ void Context::blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1
// INVALID_OPERATION error is generated. // INVALID_OPERATION error is generated.
if((drawDSBuffer && drawDSBuffer->getSamples() > 1) || if((drawDSBuffer && drawDSBuffer->getSamples() > 1) ||
((readDSBuffer && readDSBuffer->getSamples() > 1) && ((readDSBuffer && readDSBuffer->getSamples() > 1) &&
((srcX0 != dstX0 || srcY0 != dstY0 || srcX1 != dstX1 || srcY1 != dstY1) || (!sameBounds || (drawDSBuffer->getFormat() != readDSBuffer->getFormat()))))
(drawDSBuffer->getFormat() != readDSBuffer->getFormat()))))
{ {
return error(GL_INVALID_OPERATION); return error(GL_INVALID_OPERATION);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment