glsl: move half<->float convertion to util
[mesa.git] / src / glsl / glsl_types.h
index 23ada15b854125b74eb7b0e5ae514c9715fc7ca0..3ec764219de9fdb4ac7bb597a3b484aa216a2c40 100644 (file)
@@ -577,6 +577,25 @@ struct glsl_type {
       return t;
    }
 
+   /**
+    * Return the total number of elements in an array including the elements
+    * in arrays of arrays.
+    */
+   unsigned arrays_of_arrays_size() const
+   {
+      if (!is_array())
+         return 0;
+
+      unsigned size = length;
+      const glsl_type *base_type = fields.array;
+
+      while (base_type->is_array()) {
+         size = size * base_type->length;
+         base_type = base_type->fields.array;
+      }
+      return size;
+   }
+
    /**
     * Return the amount of atomic counter storage required for a type.
     */