i965: Bail on the BLT path if BlitFramebuffer requires sRGB conversion.
authorKenneth Graunke <kenneth@whitecape.org>
Wed, 3 Aug 2016 03:58:30 +0000 (20:58 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Mon, 8 Aug 2016 21:01:51 +0000 (14:01 -0700)
Modern OpenGL BlitFramebuffer require sRGB encode/decode when
GL_FRAMEBUFFER_SRGB is enabled.  The blitter can't handle this,
so we need to bail.  On Gen4-5, this means falling back to Meta,
which should handle it.

We allow sRGB <-> sRGB blits, as decode then encode ought to be a noop
(other than potential precision loss, which nobody wants anyway).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/mesa/drivers/dri/i965/intel_blit.c
src/mesa/drivers/dri/i965/intel_fbo.c

index 23e1ab62c4f7db47091c4256ddd3fa90c2f1af21..8df5b4871cc80fa29b4eb848dd385b5096e2a676 100644 (file)
@@ -211,8 +211,8 @@ intel_miptree_blit(struct brw_context *brw,
       return false;
 
    /* No sRGB decode or encode is done by the hardware blitter, which is
-    * consistent with what we want in the callers (glCopyTexSubImage(),
-    * glBlitFramebuffer(), texture validation, etc.).
+    * consistent with what we want in many callers (glCopyTexSubImage(),
+    * texture validation, etc.).
     */
    mesa_format src_format = _mesa_get_srgb_format_linear(src_mt->format);
    mesa_format dst_format = _mesa_get_srgb_format_linear(dst_mt->format);
index 707a9d2af3d88dfab46a9f02a521ea59ac387483..573c3a854cd31ce789ea33f17de2cc63807e90d4 100644 (file)
@@ -828,6 +828,14 @@ intel_blit_framebuffer_with_blitter(struct gl_context *ctx,
             return mask;
          }
 
+         if (ctx->Color.sRGBEnabled &&
+             _mesa_get_format_color_encoding(src_irb->mt->format) !=
+             _mesa_get_format_color_encoding(dst_irb->mt->format)) {
+            perf_debug("glBlitFramebuffer() with sRGB conversion cannot be "
+                       "handled by BLT path.\n");
+            return mask;
+         }
+
          if (!intel_miptree_blit(brw,
                                  src_irb->mt,
                                  src_irb->mt_level, src_irb->mt_layer,