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

Roland Scheidegger sroland at vmware.com
Mon Nov 2 10:42:34 PST 2015


Am 31.10.2015 um 14:37 schrieb Brian Paul:
> 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.
I think this logic should be disabled for the 32bit per channel ones.
There are no such unorm formats, and those are also the ones which
actually work in llvmpipe (most 8 and 16 bit ones are disabled already
in _some_ cases, notably if they have rt flag, albeit it's something
which should be fixed).
Eventually could instead fix up the util copy instead (since some
formats just don't even have 3-channel ones even if they'd work in
llvmpipe, albeit I'm not really sure why not (wouldn't be that difficult
I guess, essentially just needed to copy each pixel separately, albeit
might not be worth it...).
I actually just realized the existing format check in llvmpipe to
disable certain 3-channel formats is bugged, since it will only disable
3-channel rgb16 if it's non-float to avoid crash in the backend, but of
course with a view we could end up with a non-float format there even if
the format was float (albeit that crash might have been fixed with newer
llvm version I guess...)...




> +          */
> +         return FALSE;
> +      }
> +   }
> +
>     if (bind & PIPE_BIND_DISPLAY_TARGET) {
>        if(!winsys->is_displaytarget_format_supported(winsys, bind, format))
>           return FALSE;
> 

Roland



More information about the mesa-dev mailing list