int dstX0, int dstY0,
int dstX1, int dstY1)
{
- if (MAX2(srcX0, srcX1) < MIN2(dstX0, dstX1))
+ if (MAX2(srcX0, srcX1) <= MIN2(dstX0, dstX1))
return false; /* dst completely right of src */
- if (MAX2(dstX0, dstX1) < MIN2(srcX0, srcX1))
+ if (MAX2(dstX0, dstX1) <= MIN2(srcX0, srcX1))
return false; /* dst completely left of src */
- if (MAX2(srcY0, srcY1) < MIN2(dstY0, dstY1))
+ if (MAX2(srcY0, srcY1) <= MIN2(dstY0, dstY1))
return false; /* dst completely above src */
- if (MAX2(dstY0, dstY1) < MIN2(srcY0, srcY1))
+ if (MAX2(dstY0, dstY1) <= MIN2(srcY0, srcY1))
return false; /* dst completely below src */
return true; /* some overlap */
{
GLenum readFormat, drawFormat;
- /* The simple case where we know the backing Mesa formats are the same.
- */
- if (_mesa_get_srgb_format_linear(readRb->Format) ==
- _mesa_get_srgb_format_linear(drawRb->Format)) {
- return GL_TRUE;
- }
-
- /* The Mesa formats are different, so we must check whether the internal
- * formats are compatible.
+ /* This checks whether the internal formats are compatible rather than the
+ * Mesa format for two reasons:
+ *
+ * • Under some circumstances, the user may request e.g. two GL_RGBA8
+ * textures and get two entirely different Mesa formats like RGBA8888 and
+ * ARGB8888. Drivers behaving like that should be able to cope with
+ * non-matching formats by themselves, because it's not the user's fault.
+ *
+ * • Picking two different internal formats can end up with the same Mesa
+ * format. For example the driver might be simulating GL_RGB textures
+ * with GL_RGBA internally and in that case both internal formats would
+ * end up with RGBA8888.
*
- * Under some circumstances, the user may request e.g. two GL_RGBA8
- * textures and get two entirely different Mesa formats like RGBA8888 and
- * ARGB8888. Drivers behaving like that should be able to cope with
- * non-matching formats by themselves, because it's not the user's fault.
+ * This function is used to generate a GL error according to the spec so in
+ * both cases we want to be looking at the application-level format, which
+ * is InternalFormat.
*
* Blits between linear and sRGB formats are also allowed.
*/
if (!is_valid_blit_filter(ctx, filter)) {
_mesa_error(ctx, GL_INVALID_ENUM, "%s(invalid filter %s)", func,
- _mesa_lookup_enum_by_nr(filter));
+ _mesa_enum_to_string(filter));
return;
}
filter == GL_SCALED_RESOLVE_NICEST_EXT) &&
(readFb->Visual.samples == 0 || drawFb->Visual.samples > 0)) {
_mesa_error(ctx, GL_INVALID_OPERATION, "%s(%s: invalid samples)", func,
- _mesa_lookup_enum_by_nr(filter));
+ _mesa_enum_to_string(filter));
return;
}
}
/* extra checks for multisample copies... */
if (readFb->Visual.samples > 0 || drawFb->Visual.samples > 0) {
- /* color formats must match */
- if (!compatible_resolve_formats(colorReadRb, colorDrawRb)) {
+ /* color formats must match on GLES. This isn't checked on
+ * desktop GL because the GL 4.4 spec was changed to allow it.
+ * In the section entitled “Changes in the released
+ * Specification of July 22, 2013” it says:
+ *
+ * “Relax BlitFramebuffer in section 18.3.1 so that format
+ * conversion can take place during multisample blits, since
+ * drivers already allow this and some apps depend on it.”
+ */
+ if (_mesa_is_gles(ctx) &&
+ !compatible_resolve_formats(colorReadRb, colorDrawRb)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"%s(bad src/dst multisample pixel formats)", func);
return;
" %d, %d, %d, %d, 0x%x, %s)\n",
srcX0, srcY0, srcX1, srcY1,
dstX0, dstY0, dstX1, dstY1,
- mask, _mesa_lookup_enum_by_nr(filter));
+ mask, _mesa_enum_to_string(filter));
_mesa_blit_framebuffer(ctx, ctx->ReadBuffer, ctx->DrawBuffer,
srcX0, srcY0, srcX1, srcY1,
readFramebuffer, drawFramebuffer,
srcX0, srcY0, srcX1, srcY1,
dstX0, dstY0, dstX1, dstY1,
- mask, _mesa_lookup_enum_by_nr(filter));
+ mask, _mesa_enum_to_string(filter));
/*
* According to PDF page 533 of the OpenGL 4.5 core spec (30.10.2014,