Merge branch '7.8'
[mesa.git] / src / gallium / auxiliary / util / u_format.h
index b2aa5bfb188cba57ab3b78a75a937b1b97964d81..c08fdcafcc8deca38f5013e5570924687f15c070 100644 (file)
@@ -415,6 +415,16 @@ util_format_has_alpha(enum pipe_format format)
    }
 }
 
+/**
+ * Return the number of components stored.
+ * Formats with block size != 1x1 will always have 1 component (the block).
+ */
+static INLINE unsigned
+util_format_get_nr_components(enum pipe_format format)
+{
+   const struct util_format_description *desc = util_format_description(format);
+   return desc->nr_channels;
+}
 
 /*
  * Format access functions.