[Mesa-dev] [PATCH 2/2] llvmpipe: enable PIPE_CAP_COPY_BETWEEN_COMPRESSED_AND_PLAIN_FORMATS

Brian Paul brianp at vmware.com
Sat Oct 31 06:37:59 PDT 2015


We disable all 3-channel array formats since we don't support 3-channel
UNORM8 formats.

Recall that if a 3-channel format is requested by the user, we might
actually wind up using a 4-channel format instead.  In fact, llvmpipe
does this frequently.  If we don't disable all 3-channel formats, we
might be asked to copy from a true 3-channel format to a "3->4 upgraded"
format and that'll fail.

This enables GL_ARB_copy_image for llvmpipe.
Piglit's arb_copy_image-formats test passes 100%.
---
 src/gallium/drivers/llvmpipe/lp_screen.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c
index d1c50ae..dc216d6 100644
--- a/src/gallium/drivers/llvmpipe/lp_screen.c
+++ b/src/gallium/drivers/llvmpipe/lp_screen.c
@@ -299,8 +299,9 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
    case PIPE_CAP_TGSI_TXQS:
    case PIPE_CAP_FORCE_PERSAMPLE_INTERP:
    case PIPE_CAP_SHAREABLE_SHADERS:
-   case PIPE_CAP_COPY_BETWEEN_COMPRESSED_AND_PLAIN_FORMATS:
       return 0;
+   case PIPE_CAP_COPY_BETWEEN_COMPRESSED_AND_PLAIN_FORMATS:
+      return 1;
    }
    /* should only get here on unhandled cases */
    debug_printf("Unexpected PIPE_CAP %d query\n", param);
@@ -441,6 +442,20 @@ llvmpipe_is_format_supported( struct pipe_screen *_screen,
       }
    }
 
+   if ((bind & (PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW)) &&
+       ((bind & PIPE_BIND_DISPLAY_TARGET) == 0) &&
+       target != PIPE_BUFFER) {
+      const struct util_format_description *desc =
+         util_format_description(format);
+      if (desc->nr_channels == 3 && desc->is_array) {
+         /* Don't support any 3-component formats here since we don't support
+          * the 3-component UNORM formats.  This allows GL_ARB_copy_image
+          * to work.
+          */
+         return FALSE;
+      }
+   }
+
    if (bind & PIPE_BIND_DISPLAY_TARGET) {
       if(!winsys->is_displaytarget_format_supported(winsys, bind, format))
          return FALSE;
-- 
1.9.1



More information about the mesa-dev mailing list