From: Lucas Stach Date: Thu, 29 Mar 2018 14:15:14 +0000 (+0200) Subject: gallium/util: implement util_format_is_yuv X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=dfe4a08ccddf5b9b6adf1e10510bb4534f36c459;p=mesa.git gallium/util: implement util_format_is_yuv This adds a helper to check if a pipe format is in YUV color space. Drivers want to know about this, as YUV mostly needs special handling. Signed-off-by: Lucas Stach Reviewed-by: Philipp Zabel Reviewed-by: Christian Gmeiner --- diff --git a/src/gallium/auxiliary/util/u_format.h b/src/gallium/auxiliary/util/u_format.h index 88bfd72d053..e497b4b3375 100644 --- a/src/gallium/auxiliary/util/u_format.h +++ b/src/gallium/auxiliary/util/u_format.h @@ -557,6 +557,18 @@ util_format_is_depth_and_stencil(enum pipe_format format) util_format_has_stencil(desc); } +static inline boolean +util_format_is_yuv(enum pipe_format format) +{ + const struct util_format_description *desc = util_format_description(format); + + assert(desc); + if (!desc) { + return FALSE; + } + + return desc->colorspace == UTIL_FORMAT_COLORSPACE_YUV; +} /** * Calculates the depth format type based upon the incoming format description.