summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
authorLucas Stach <l.stach@pengutronix.de>2018-03-29 16:15:14 +0200
committerChristian Gmeiner <christian.gmeiner@gmail.com>2018-04-08 22:10:57 +0200
commitdfe4a08ccddf5b9b6adf1e10510bb4534f36c459 (patch)
treece66a627665a8674a9495739f3db1386b88448dc /src/gallium/auxiliary
parent19254a977bf12c1efa64aec5a480e38e48044dd6 (diff)
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 <l.stach@pengutronix.de> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/util/u_format.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/util/u_format.h b/src/gallium/auxiliary/util/u_format.h
index 88bfd72d05..e497b4b337 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.