[Mesa-dev] [PATCH 9/9] llvmpipe: enable PIPE_CAP_COPY_IMAGE

Brian Paul brianp at vmware.com
Thu Aug 27 16:48:01 PDT 2015


We have to disallow the 8 and 16-bit 3-component formats for non-display
target surfaces as we do for softpipe (see earlier commit).

v2: Simplify 3-component format check, per Marek.
Also check that target != PIPE_BUFFER
---
 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 fa43b72..2fe0c86 100644
--- a/src/gallium/drivers/llvmpipe/lp_screen.c
+++ b/src/gallium/drivers/llvmpipe/lp_screen.c
@@ -293,8 +293,9 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
    case PIPE_CAP_RESOURCE_FROM_USER_MEMORY:
    case PIPE_CAP_DEVICE_RESET_STATUS_QUERY:
    case PIPE_CAP_MAX_SHADER_PATCH_VARYINGS:
-   case PIPE_CAP_COPY_IMAGE:
       return 0;
+   case PIPE_CAP_COPY_IMAGE:
+      return 1;
    }
    /* should only get here on unhandled cases */
    debug_printf("Unexpected PIPE_CAP %d query\n", param);
@@ -435,6 +436,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