+/**
+ * Converts a format description into an lp_type.
+ *
+ * Only works with "array formats".
+ *
+ * e.g. With PIPE_FORMAT_R32G32B32A32_FLOAT returns an lp_type with float[4]
+ */
+static inline void
+lp_type_from_format_desc(struct lp_type* type, const struct util_format_description *format_desc)
+{
+ assert(format_desc->is_array);
+ assert(!format_desc->is_mixed);
+
+ memset(type, 0, sizeof(struct lp_type));
+ type->floating = format_desc->channel[0].type == UTIL_FORMAT_TYPE_FLOAT;
+ type->fixed = format_desc->channel[0].type == UTIL_FORMAT_TYPE_FIXED;
+ type->sign = format_desc->channel[0].type != UTIL_FORMAT_TYPE_UNSIGNED;
+ type->norm = format_desc->channel[0].normalized;
+ type->width = format_desc->channel[0].size;
+ type->length = format_desc->nr_channels;
+}
+
+
+static inline void
+lp_type_from_format(struct lp_type* type, enum pipe_format format)
+{
+ lp_type_from_format_desc(type, util_format_description(format));
+}
+
+
+static inline unsigned
+lp_type_width(struct lp_type type)
+{
+ return type.width * type.length;
+}
+
+
+/** Create scalar float type */
+static inline struct lp_type