[Mesa-dev] [PATCH 4/4] i965/blorp: allow all buffer formats provided src and dst match.

Paul Berry stereotype441 at gmail.com
Wed Jun 6 21:20:33 CEST 2012


Previously, blits using the "blorp" mechanism only worked for 8-bit
RGBA color buffers, 24-bit depth buffers, and 8 bit stencil buffers.
This was not enough, because the blorp mechanism must be used for
blitting whenever MSAA is in use.  This patch allows all formats to be
used, provided the source and destination formats match.

So far I have confirmed that the following formats work properly with
MSAA:
- GL_RGB
- GL_RGBA
- GL_ALPHA
- GL_ALPHA4
- GL_ALPHA8
- GL_R3_G3_B2
- GL_RGB4
- GL_RGB5
- GL_RGB8
- GL_RGB10
- GL_RGB12
- GL_RGB16
- GL_RGBA2
- GL_RGBA4
- GL_RGB5_A1
- GL_RGBA8
- GL_RGB10_A2
- GL_RGBA12
- GL_RGBA16

Fixes piglit tests "EXT_framebuffer_multisample/formats {2,4}" on
Sandy Bridge and Ivy Bridge.
---
 src/mesa/drivers/dri/i965/brw_blorp_blit.cpp |   32 +++++--------------------
 1 files changed, 7 insertions(+), 25 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
index 180468b..4de2d7a 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
+++ b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
@@ -151,19 +151,6 @@ try_blorp_blit(struct intel_context *intel,
    if (!src_mt) return false;
    if (buffer_bit == GL_STENCIL_BUFFER_BIT && src_mt->stencil_mt)
       src_mt = src_mt->stencil_mt;
-   switch (src_mt->format) {
-   case MESA_FORMAT_ARGB8888:
-   case MESA_FORMAT_X8_Z24:
-   case MESA_FORMAT_S8:
-      break; /* Supported */
-   default:
-      /* Unsupported format.
-       *
-       * TODO: need to support all formats that are allowed as multisample
-       * render targets.
-       */
-      return false;
-   }
 
    /* Validate destination */
    if (!dst_rb) return false;
@@ -172,19 +159,14 @@ try_blorp_blit(struct intel_context *intel,
    if (!dst_mt) return false;
    if (buffer_bit == GL_STENCIL_BUFFER_BIT && dst_mt->stencil_mt)
       dst_mt = dst_mt->stencil_mt;
-   switch (dst_mt->format) {
-   case MESA_FORMAT_ARGB8888:
-   case MESA_FORMAT_X8_Z24:
-   case MESA_FORMAT_S8:
-      break; /* Supported */
-   default:
-      /* Unsupported format.
-       *
-       * TODO: need to support all formats that are allowed as multisample
-       * render targets.
-       */
+
+   /* Blorp blits can't translate from one format to another.  For that we'll
+    * have to fall back to the meta-op blit.  Note: the meta-op blit doesn't
+    * support multisampled blits, but fortunately this is ok because
+    * multisampled blits require identical source and destination formats.
+    */
+   if (src_mt->format != dst_mt->format)
       return false;
-   }
 
    /* Account for the fact that in the system framebuffer, the origin is at
     * the lower left.
-- 
1.7.7.6



More information about the mesa-dev mailing list