struct util_format_description
{
enum pipe_format format;
+
const char *name;
+ /**
+ * Short name, striped of the prefix, lower case.
+ */
+ const char *short_name;
+
/**
* Pixel block dimensions.
*/
*/
unsigned is_array:1;
+ /**
+ * Whether the pixel format can be described as a bitfield structure.
+ *
+ * In particular:
+ * - pixel depth must be 8, 16, or 32 bits;
+ * - all channels must be unsigned, signed, or void
+ */
+ unsigned is_bitmask:1;
+
/**
* Whether channels have mixed types (ignoring UTIL_FORMAT_TYPE_VOID).
*/
}
}
+/**
+ * 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.