[Mesa-dev] [PATCH] swr: properly expose compressed format support

Ilia Mirkin imirkin at alum.mit.edu
Thu May 12 18:56:57 UTC 2016


Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>

On Thu, May 12, 2016 at 2:53 PM, Tim Rowley <timothy.o.rowley at intel.com> wrote:
> ---
>  src/gallium/auxiliary/util/u_format_s3tc.h |  6 ++++++
>  src/gallium/drivers/swr/swr_screen.cpp     | 17 +++++++++++++++++
>  2 files changed, 23 insertions(+)
>
> diff --git a/src/gallium/auxiliary/util/u_format_s3tc.h b/src/gallium/auxiliary/util/u_format_s3tc.h
> index 97770ab..ae20010 100644
> --- a/src/gallium/auxiliary/util/u_format_s3tc.h
> +++ b/src/gallium/auxiliary/util/u_format_s3tc.h
> @@ -32,6 +32,9 @@
>
>  #include "pipe/p_compiler.h"
>
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
>
>  enum util_format_dxtn {
>    UTIL_FORMAT_DXT1_RGB = 0x83F0,
> @@ -214,5 +217,8 @@ util_format_dxt5_srgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, co
>  void
>  util_format_dxt5_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
>
> +#ifdef __cplusplus
> +}
> +#endif
>
>  #endif /* U_FORMAT_S3TC_H_ */
> diff --git a/src/gallium/drivers/swr/swr_screen.cpp b/src/gallium/drivers/swr/swr_screen.cpp
> index daee05a..3d280e3 100644
> --- a/src/gallium/drivers/swr/swr_screen.cpp
> +++ b/src/gallium/drivers/swr/swr_screen.cpp
> @@ -27,6 +27,7 @@
>  #include "util/u_format.h"
>  #include "util/u_inlines.h"
>  #include "util/u_cpu_detect.h"
> +#include "util/u_format_s3tc.h"
>
>  #include "state_tracker/sw_winsys.h"
>
> @@ -128,6 +129,20 @@ swr_is_format_supported(struct pipe_screen *screen,
>           return FALSE;
>     }
>
> +   if (format_desc->layout == UTIL_FORMAT_LAYOUT_BPTC ||
> +       format_desc->layout == UTIL_FORMAT_LAYOUT_ASTC) {
> +      return FALSE;
> +   }
> +
> +   if (format_desc->layout == UTIL_FORMAT_LAYOUT_ETC &&
> +       format != PIPE_FORMAT_ETC1_RGB8) {
> +      return FALSE;
> +   }
> +
> +   if (format_desc->layout == UTIL_FORMAT_LAYOUT_S3TC) {
> +      return util_format_s3tc_enabled;
> +   }
> +
>     return TRUE;
>  }
>
> @@ -735,6 +750,8 @@ swr_create_screen(struct sw_winsys *winsys)
>
>     swr_fence_init(&screen->base);
>
> +   util_format_s3tc_init();
> +
>     return &screen->base;
>  }
>
> --
> 1.9.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list