[Mesa-dev] [PATCH 1/9] u_format: add util_format_is_subsampled helper function

Christian König deathsimple at vodafone.de
Thu Mar 8 05:14:26 PST 2012


Also fix comment about subsampled formats.

Signed-off-by: Christian König <deathsimple at vodafone.de>
---
 src/gallium/auxiliary/util/u_format.h |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_format.h b/src/gallium/auxiliary/util/u_format.h
index b9ae7c1..3f47e7a 100644
--- a/src/gallium/auxiliary/util/u_format.h
+++ b/src/gallium/auxiliary/util/u_format.h
@@ -54,7 +54,7 @@ enum util_format_layout {
    /**
     * Formats with sub-sampled channels.
     *
-    * This is for formats like YV12 where there is less than one sample per
+    * This is for formats like YVYU where there is less than one sample per
     * pixel.
     */
    UTIL_FORMAT_LAYOUT_SUBSAMPLED = 3,
@@ -468,6 +468,13 @@ util_format_is_s3tc(enum pipe_format format)
 }
 
 static INLINE boolean 
+util_format_is_subsampled(enum pipe_format format)
+{
+   const struct util_format_description *desc = util_format_description(format);
+   return desc->layout == UTIL_FORMAT_LAYOUT_SUBSAMPLED ? TRUE : FALSE;
+}
+
+static INLINE boolean
 util_format_is_srgb(enum pipe_format format)
 {
    const struct util_format_description *desc = util_format_description(format);
-- 
1.7.5.4



More information about the mesa-dev mailing list