Nothing was bothering to clip the blit. If the src rect was partially outside the framebuffer, we'd end up picking up more copies of the edge texels due to clamping.
Note that this is slight overkill -- we could get away with clipping src only, since fragments outside the destination surface will be discarded anyway. Fixes piglit's fbo-blit-stretch test on drivers which use the meta path. (i965: should fix Broadwell, but also fixes Sandybridge/Ivybridge/Haswell since this test falls off the blorp path now due to format conversion) Signed-off-by: Chris Forbes <chr...@ijw.co.nz> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77414 --- src/mesa/drivers/common/meta_blit.c | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/src/mesa/drivers/common/meta_blit.c b/src/mesa/drivers/common/meta_blit.c index 31e494f..38d53ef 100644 --- a/src/mesa/drivers/common/meta_blit.c +++ b/src/mesa/drivers/common/meta_blit.c @@ -33,6 +33,7 @@ #include "main/enable.h" #include "main/enums.h" #include "main/fbobject.h" +#include "main/image.h" #include "main/macros.h" #include "main/matrix.h" #include "main/multisample.h" @@ -590,12 +591,9 @@ blitframebuffer_texture(struct gl_context *ctx, return true; } -/** - * Meta implementation of ctx->Driver.BlitFramebuffer() in terms - * of texture mapping and polygon rendering. - */ -void -_mesa_meta_BlitFramebuffer(struct gl_context *ctx, + +static void +_mesa_meta_blit_preclipped(struct gl_context *ctx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) @@ -804,6 +802,27 @@ fallback: } } +/** + * Meta implementation of ctx->Driver.BlitFramebuffer() in terms + * of texture mapping and polygon rendering. + */ +void +_mesa_meta_BlitFramebuffer(struct gl_context *ctx, + GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, + GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, + GLbitfield mask, GLenum filter) +{ + if (!_mesa_clip_blit(ctx, &srcX0, &srcY0, &srcX1, &srcY1, + &dstX0, &dstY0, &dstX1, &dstY1)) { + /* nothing left! */ + return; + } + + _mesa_meta_blit_preclipped(ctx, srcX0, srcY0, srcX1, srcY1, + dstX0, dstY0, dstX1, dstY1, + mask, filter); +} + void _mesa_meta_glsl_blit_cleanup(struct blit_state *blit) { -- 1.9.1 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev