X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fgallium%2Fauxiliary%2Futil%2Fu_format.h;h=c08fdcafcc8deca38f5013e5570924687f15c070;hb=2689dd304c6d644b04c941e6da63e466be5de0d6;hp=e8fa0022b5b54eb707f95e8509feb231083b7993;hpb=4ca70c489baed3e23dbf5e5e5794385113e22252;p=mesa.git diff --git a/src/gallium/auxiliary/util/u_format.h b/src/gallium/auxiliary/util/u_format.h index e8fa0022b5b..c08fdcafcc8 100644 --- a/src/gallium/auxiliary/util/u_format.h +++ b/src/gallium/auxiliary/util/u_format.h @@ -120,8 +120,14 @@ struct util_format_channel_description 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. */ @@ -139,6 +145,15 @@ struct util_format_description */ 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). */ @@ -400,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.